Repository navigation
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
🚧 Files skipped from review as they are similar to previous changes (4)
Included review availability: Your plan includes up to 10 reviews per rolling hour; 5 remain after this review. 📝 WalkthroughWalkthroughThe change adds a native Windows agent-hook launcher and packages it with Windows builds. The build script compiles both Windows launchers. TypeScript utilities install content-addressed launcher copies and construct quoted commands. Managed hook configuration refresh migrates commands with guarded atomic writes. Claude, Cursor, and Grok services use the launcher for Windows hooks. WSL and non-WSL hook execution hides spawned Windows processes. Tests cover installation, command generation, configuration migration, service integration, and process options. Merge Risk: ⚪ Minimal · up to The change replaces visible Windows hook execution with a windowless, bounded launcher and protocol-safe output; no actionable merge-blocking risk remains after normal checks and review. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (5)
config/scripts/build-windows-cli-launcher.mjs (1)
29-31: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueUpdate the error text to cover both binaries.
The script now compiles
orca.exeandorca-agent-hook.exe. The message names onlyorca.exe.♻️ Proposed wording change
- throw new Error('Unable to find the .NET Framework C# compiler required for orca.exe.') + throw new Error( + 'Unable to find the .NET Framework C# compiler required for orca.exe and orca-agent-hook.exe.' + )src/main/agent-hooks/windows-agent-hook-launcher.ts (2)
14-62: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winExtract the duplicated candidate list.
resolveBundledLauncherPathandresolveBundledLauncherPathAsyncbuild the same three candidate paths. Extract onegetBundledLauncherCandidatePaths()function and let both resolvers consume it. This keeps the packaged and development lookup order in one place.♻️ Proposed refactor
+function getBundledLauncherCandidatePaths(): string[] { + return [ + ...(process.resourcesPath ? [join(process.resourcesPath, 'bin', LAUNCHER_FILE_NAME)] : []), + ...(process.env.ORCA_DEV_REPO_ROOT + ? [ + join( + process.env.ORCA_DEV_REPO_ROOT, + 'native', + 'windows-agent-hook-launcher', + '.build', + LAUNCHER_FILE_NAME + ) + ] + : []), + join(process.cwd(), 'native', 'windows-agent-hook-launcher', '.build', LAUNCHER_FILE_NAME) + ] +} + function resolveBundledLauncherPath(): string { - const candidates = [ /* ... */ ] + const candidates = getBundledLauncherCandidatePaths() const sourcePath = candidates.find((candidate) => existsSync(candidate))
64-133: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueStale content-addressed launchers accumulate.
Each launcher build produces a new
orca-agent-hook-<digest>.exein~/.orca/agent-hooks. Old copies are never removed. After several app updates the directory keeps every historical binary.Consider removing
orca-agent-hook-*.exeentries that do not match the current digest after a successful publish. Skip files that are still referenced by installed hook commands.src/main/agent-hooks/windows-agent-hook-launcher.test.ts (1)
35-44: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd an idempotency test for repeated installs.
The suite installs the launcher once. The production code contains a content-comparison short circuit and a rename-race fallback. Neither path is exercised.
Add a test that calls
installWindowsAgentHookLauncher(sourcePath)twice and asserts the same destination path and a single file in~/.orca/agent-hooks. Consider also coveringinstallWindowsAgentHookLauncherAsync.src/main/agent-hooks/managed-hook-config-refresh.ts (1)
110-123: 🗄️ Data Integrity & Integration | 🔵 Trivial | 💤 Low valuePreserve user formatting if required.
parseHooksJsonTextusesJSON.parse, so comments and trailing commas are rejected. Valid JSON properties are retained, but reserialization normalizes indentation, whitespace, the trailing newline, and a leading BOM. If formatting preservation is required, update only the migrated fields instead of reserializing the entire file.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 288c0dd5-2bed-4cf2-a884-b962ddc90103
📒 Files selected for processing (16)
config/electron-builder.config.cjsconfig/scripts/build-windows-cli-launcher.mjsnative/windows-agent-hook-launcher/OrcaAgentHookLauncher.cssrc/main/agent-hooks/managed-hook-config-refresh.tssrc/main/agent-hooks/managed-hook-script-refresh.test.tssrc/main/agent-hooks/windows-agent-hook-launcher.test.tssrc/main/agent-hooks/windows-agent-hook-launcher.tssrc/main/claude/hook-service.test.tssrc/main/claude/hook-service.tssrc/main/claude/hook-settings.tssrc/main/cursor/hook-service.test.tssrc/main/cursor/hook-service.tssrc/main/grok/hook-service.test.tssrc/main/grok/hook-service.tssrc/main/hooks.test.tssrc/main/hooks.ts
Included review availability: Your plan includes up to 10 reviews per rolling hour; 7 remain after this review.
Independent delivery audit (
|
Formal compliance (
|
|
Follow-up from live Windows regression audit (�c78e99973): startup refresh now migrates an existing managed Claude statusLine.command together with lifecycle hooks in one guarded config write. This closes the gap where CLI-unavailable refresh replaced conhost.exe lifecycle entries but could leave the legacy encoded-PowerShell statusline until a later full install. User-authored statuslines remain outside the managed matcher. Added coverage for lifecycle + statusline migration without CLI presence. Validation: focused Vitest 6 files / 120 passed; targeted oxlint --deny-warnings; ypecheck:node; git diff --check. Existing Cursor agent processes cache hook commands in memory, so already-running sessions may keep their pre-update command until restarted; no process was terminated during this audit. |
|
Closing. #14825 merged as I re-verified the other two linked issues against merged
If anything here is still wanted — the GUI-subsystem launcher, the process deadline, or the startup config migration — it should come as a small PR on top of |
ELI5
On Windows, agent hooks could briefly open black terminal windows, steal focus, hang after a tool call, or expose hook protocol output such as raw JSON. Orca now runs those hooks through a small windowless launcher, gives Claude-compatible hooks the valid neutral JSON they expect, and forcibly bounds abandoned stdin and child processes so no console or orphan remains.
What Changed
cmd.exewith no window, redirects all standard streams, and never resolves executables through the workspace orPATH.--neutral-json, avoiding the older-Claude behavior that ignored separateargsand rejected empty stdout..exethat a concurrent hook still has open.PATH. Missing or user-removed configs are not recreated, legacy Claudeargsare removed, symlinked configs remain attached to their targets, and writes remain guarded and atomic.windowsHide: trueas a second backstop.Why
The previous Windows paths had several related failure modes:
conhost.exewindow and steal focus;argscould execute only the host command or treat empty stdout as invalid JSON;cmd.exe/curl.exechains alive;A GUI-subsystem launcher fixes the window creation at the process boundary. Bounded redirected streams solve the hang/orphan class, while protocol-specific neutral JSON keeps Claude fail-open without leaking output into a visible terminal.
Linked Issue
Fixes #14815
Fixes #14818
Fixes #14828
Fixes #14837
Related PRs
Canonical Windows hook fix for #14815 (Claude, Cursor, and Grok). #14825 is a Claude-only predecessor that still emits
conhost.exe --headlessplus encoded PowerShell; it does not cover Cursor/Grok and does not address the #14837 conhost hang class or Cursor's invalid-JSON block (#14818). Prefer this PR; do not merge #14825 first.Hosted CI
This is a cross-repository fork PR (
Tauri-EPO/orca→stablyai/orca). GitHub Actions onb157fd3101a56206bddf06d2221b5f2b965a29a4have not produced check runs:gh pr checksreports none, commit statusestotal_count: 0,statusCheckRollupis empty,mergeStateStatusisUNSTABLE. Workflow runs exist but never spawned jobs (conclusion: action_required, fork-workflow approval,approvals: []):Maintainer action: approve and run those workflows. Independent Windows unit tests and native launcher probes are in Testing below.
Visual Proof
N/Afor rendered Orca UI — no Orca view, layout, or in-app control changes. Linked issues #14815, #14818, #14828, and #14837 have no screenshot or video attachments (the only extra #14828 file is a Discordmessage.txt, not an image), so none is copied here and none is invented.This is still an OS-console / focus-steal interaction. Public before/after evidence is textual and process-level, not a tab-switchable screenshot pair:
Before (already public):
conhost.exewindows; hook JSON typed into the shell (A sintaxe do nome do arquivo, do nome do diretório ou do rótulo do volume está incorreta.)Hook "C:\Windows\System32\conhost.exe" returned invalid JSON. The command was blocked for safety.conhost/cmd/curlAfter (already public on this PR; re-verified on head
b157fd3):2=IMAGE_SUBSYSTEM_WINDOWS_GUI--neutral-json+ childexit /b 7+ leaked echo: exit 7, stdout exactly{}\n(7B-7D-0A), stderr empty, 77ms{}\n, 50msTesting
Author-reported Windows 11 live sessions (not re-run in this compliance pass):
{}plus newline, stderr was empty, all 11 managed commands used one command string with noargs, and no launcher/curl process remained.PreToolUsereturned valid neutral JSON without blocking; Cursor-native hooks exited with no stdout; all probes completed in 82–1145 ms with no stderr or orphaned process.{}and exit 0 with zero active launchers/curl processes.This compliance pass on detached
b157fd3101a56206bddf06d2221b5f2b965a29a4(Windows 11):pnpm exec vitest run --config config/vitest.config.tson the 6 changed test files: 6 files, 120 passedpnpm exec oxlint --deny-warningson changed TypeScript/JavaScript files: exit 0git diff --check origin/main...HEAD: cleannative/windows-agent-hook-launcher/.build/orca-agent-hook.exePE subsystem 2 (IMAGE_SUBSYSTEM_WINDOWS_GUI); live launcher probes as in Visual Proofpnpm lint,pnpm typecheck,pnpm test, andpnpm buildwere not re-run here; those remain the hosted-CI gate after maintainer fork-workflow approvaloxfmt --checkis not claimed: it also fails on unchangedsrc/main/wsl.tsin this worktree, so it is not treated as a PR-specific defectAI Disclosure
Investigation and implementation were AI-assisted with Claude, Grok, and OpenAI Codex. The final patch, scope, tests, and live Windows evidence were reviewed and verified by me before submission.
Review
PATHexecutable lookup, quotes the managed script path, and only migrates configs that already contain an Orca-managed command.windowsHidespawn option on the Windows host side..cmd,.ps1, and.shreferences without touching user-authored hooks.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)Author