Skip to content

fix(devin): register Windows status hooks with a path sh can run - #26187

Closed
bbingz wants to merge 1 commit into
stablyai:mainfrom
bbingz:fix/20855-devin-windows-hook-path
Closed

bbingz wants to merge 1 commit into
stablyai:mainfrom
bbingz:fix/20855-devin-windows-hook-path

Conversation

@bbingz

@bbingz bbingz commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

ELI5

On Windows, Orca tells the Devin CLI "run this little script whenever something happens" so Orca can show whether Devin is working or done. Orca wrote the script's location with Windows backslashes. Devin hands that line to a Unix-style shell, and that shell treats backslashes as escape characters and throws them away. The script location became nonsense, the script never ran, and Orca never learned anything about Devin. This PR writes the location with forward slashes, which both the shell and Windows understand.

What Changed

Before (as the user sees it): a Devin session on Windows shows no agent status at all. There is no working spinner and no done indicator, and orca worktree ps --json reports agents: [] even while Devin is working. The reporter of #20855 traced it to the hook command Orca writes into %APPDATA%\devin\config.json:

C:\Users\<user>\.orca\agent-hooks\devin-hook.cmd

Devin runs hook commands through Git Bash sh -c, which strips the backslashes, so every event fails:

sh: line 1: C:Users<user>.orcaagent-hooksdevin-hook.cmd: command not found
WARN agent_ext::hooks::event_handler: Effects evaluator failed for hook None: Command exited with code 127

The reporter verified sh -c "C:\Users\...\devin-hook.cmd" exits 127, while sh -c "C:/Users/.../devin-hook.cmd" exits 0 and status starts flowing.

After: Orca registers C:/Users/<user>/.orca/agent-hooks/devin-hook.cmd, the same forward-slash form the reporter used as a workaround. Devin's status shows up again for sessions started after Orca rewrites the config.

Mechanism: getDevinManagedCommand in src/main/devin/hook-settings.ts used to return the shared wrapWindowsCmdHookCommand result, which is the bare backslash path when the path is cmd-safe. It now returns that same cmd-safe path with backslashes turned into forward slashes. Paths that are not cmd-safe (for example a user folder with a space) keep the existing PowerShell -EncodedCommand launcher, whose executable path is already written with forward slashes. Upgrading users need no manual step: Orca's managed-hook matcher already normalises backslashes before matching, so the next hook install removes the old backslash entries and writes the new one. Only Devin changes. The shared wrapper and the other agents are untouched.

Why

A forward-slash path is the narrowest change that works for every way Devin might run the command. An older code comment (from #8737) says Devin spawns the command directly as argv[0]; the reporter's log shows it now goes through sh -c. A bare forward-slash path to a .cmd file should work under both. sh leaves it alone, which the reporter verified. For a direct spawn, Rust's std::process::Command routes a .cmd through cmd.exe with the path quoted, and Windows accepts forward slashes in a drive-letter path. That direct-spawn case is reasoned from documentation, not tested on Windows. Alternatives considered:

The cmd-safe check still runs on the original path, so the forward-slash output only ever contains letters, digits, _ . : ~ - and /. None of those need quoting in sh, cmd.exe or a direct spawn.

Linked Issue

Fixes #20855

Visual Proof

N/A. The change is the text of a command written into Devin's config file. There is no Orca UI change. The visible effect is that Devin's existing status indicator starts working on Windows.

Testing

Tested on macOS only. I did not run this on a Windows host, so the end-to-end Devin run on Windows relies on the reporter's verified sh -c result above.

  • src/main/devin/hook-service.test.ts adds two tests. The first pins that a Windows backslash script path becomes C:/Users/ada/.orca/agent-hooks/devin-hook.cmd, and that a reinstall replaces an old backslash entry with the new one. It failed on main with Received: "C:\Users\ada\.orca\agent-hooks\devin-hook.cmd" and passes with the fix. The second pins that POSIX paths still produce the unchanged POSIX wrapper.

  • Ran the Devin tests plus the shared hook contract, stdin lifecycle, Windows hook interpreter, installer, remote installer and timeout suites: 8 files, all passing.

  • oxlint and oxfmt --check on the changed files are clean.

  • Full main-process typecheck (tsc --noEmit -p config/tsconfig.node.json) passes.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

AI Disclosure

Written with Claude (Anthropic) in Claude Code. Reviewed by OpenAI Codex (codex exec, read-only) before pushing.

Review

OpenAI Codex reviewed the diff read-only and reported no actionable findings. It confirmed that the matcher sweeps old backslash entries, the PowerShell fallback is unchanged, and the new tests restore process.platform. It noted one remaining risk: if Devin ever handed a .cmd path straight to raw CreateProcess without a command interpreter, it might not run. The old backslash command had the same exposure, so this PR does not make that worse.

  • Cross-platform: only the Windows branch changes. macOS and Linux keep the same POSIX wrapper, pinned by a test.
  • SSH/remote: remote installs use getDevinRemoteManagedCommand, which is unchanged and always POSIX.
  • Agents and integrations: only Devin's local Windows command changes. The shared Windows wrapper used by other agents is untouched.
  • Backwards compatibility: existing backslash entries are swept on the next install because the managed-hook matcher already compares paths with forward slashes.
  • Security: no new process, shell or interpreter. The command is still a single absolute path to Orca's managed script, with no quoting or user text.
  • Performance: none. This is the same direct .cmd launch.

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Ensure no issues in: Security, Cross-platoform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

Not verified on a Windows machine. Open PR #11081 adds a test that expects Devin's Windows command to be a backslash path. If both land, that one assertion needs to accept the forward-slash form.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

Devin runs hook commands through Git Bash sh -c, which strips the
backslashes from the bare .cmd path Orca registered, so every Devin
status hook exited 127 on Windows. Register the cmd-safe script path
with forward slashes instead; spaced paths keep the PowerShell launcher.

Fixes stablyai#20855
@coderabbitai

coderabbitai Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4f1f813d-46fa-49a2-b77f-065574ffde72
📥 Commits

Reviewing files that changed from the base of the PR and between 2584ed9 and df1ee7e.

📒 Files selected for processing (2)
  • src/main/devin/hook-service.test.ts
  • src/main/devin/hook-settings.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.


📝 Walkthrough

Walkthrough

On Windows, getDevinManagedCommand now converts backslashes to forward slashes when the script path matches WINDOWS_CMD_SAFE_PATH. Other Windows paths use wrapWindowsHookCommand. Tests verify that applying managed hooks replaces the legacy Windows command and that POSIX commands remain wrapped with wrapPosixHookCommand.

Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to df1ee

The change targets the reported Windows hook-path issue, and no remaining defect is established. Windows end-to-end behavior was not exercised, so confirm the fix in a Windows environment.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the Devin Windows status-hook fix and the forward-slash path change.
Description check ✅ Passed The description covers the required sections, explains the change and its reason, links issue #20855, and documents testing and platform limitations. It also identifies the unchecked full lint, typech…
Linked Issues check ✅ Passed [#20855] requires Devin's Windows hook command to survive sh -c and reach Orca. getDevinManagedCommand now converts cmd-safe Windows paths to forward slashes. The added tests verify the converted …
Out of Scope Changes check ✅ Passed The changes are limited to Devin's Windows managed-hook command and tests for that behavior, legacy-entry replacement, and unchanged POSIX behavior. These changes support [#20855]. No unrelated change…
  • Fix all pre-merge checks with AI
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@bbingz

bbingz commented Oct 18, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #27713. The forward-slash Devin hook path is on main; #20855 stays open.

@bbingz bbingz closed this Oct 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Devin CLI status hooks never fire on Windows — .cmd path not runnable via sh

1 participant