mirror of
https://github.com/stablyai/orca.git
synced 2026-09-22 00:02:31 +00:00
* fix(hooks): register the Claude hook script directly on Windows (#18875) The Windows Claude Code lifecycle hook was registered as `powershell.exe -NoProfile -EncodedCommand <...>` whose entire decoded payload was a `Test-Path` and a call to `~/.orca/agent-hooks/claude-hook.cmd`. Every hook event paid a full PowerShell start-up to reach a script that exits at its first `ORCA_PANE_KEY` guard, so sessions outside Orca paid it to do nothing. Register the script path itself instead, with `|| echo {}` for the neutral-JSON-when-missing contract (#14818). Measured on Windows 11, invoked as Claude Code invokes it (`printf payload | bash -c -l "<command>"`): idle (n=12) baseline 177ms | before 471ms | after 213ms 10-way conc (n=40) -- | before 656ms | after 296ms p95 under load -- | before 696ms | after 337ms It also drops an interpreter from the chain the hook's timeout kill must tear down. Killing the hook does not kill its PowerShell grandchild, which still holds the stdout handle the agent reads to EOF -- measured, EOF arrived 352ms AFTER the kill, when the orphan exited by itself. msys2 creates children suspended and resumes them after, so a kill landing in that window strands one that never exits and EOF never comes; that is the reported frozen session. The encoded launcher stays as the fallback for profile paths the shells cannot carry bare (space, `%`, `^`, `&`, non-ASCII) and for hosts where Git Bash is not resolvable, because PowerShell 5.1 rejects `||`. Every other agent's hook is untouched, as is the remote/SSH path. Not adopted from the report: `cmd.exe /d /c <path>` (MSYS rewrites the `/c` under Git Bash -- measured, the invocation fails), and raising the 10s timeout (the orphan survives the kill regardless; the fast path puts the hook 30x under the budget so the kill effectively stops firing). * fix(build): list the new hook launcher modules in the CLI tsconfig project config/tsconfig.cli.json enumerates its files explicitly, so the two new imports reached by src/main/claude/hook-settings.ts failed tc:cli with TS6307. src/main/git-bash.ts pulls in only node:fs, node:path and a shared constant, so it adds nothing heavy to the CLI project. * fix(hooks): address review of the direct Windows Claude hook launcher - Make the Windows hook suites host-independent. A box with a cmd.exe AutoRun (HKCU\...\Command Processor\AutoRun) failed them at HEAD too: the tests redirect USERPROFILE, the AutoRun target vanishes, and MSYS spawns a .cmd without /d so AutoRun runs and lands on the hook's stderr. Seed an empty target, including under the deliberately-absent profile. - Note in managed-hook-stdin-lifecycle why the "missing managed script" case no longer exercises the fallback for the direct shape (it carries an absolute path, so a redirected profile changes nothing); that path is covered live in windows-direct-cmd-hook-command.test.ts. - Keep the direct shape off UNC profiles: WINDOWS_CMD_SAFE_PATH admits them, but //server/share/... is not a command cmd.exe reliably starts. - Correct the comments: `|| echo {}` also fires when cmd.exe itself exits non-zero (failing AutoRun), printing {} twice. The encoded launcher exited 1 on that same box, so neither shape is clean there. - Test the contract that replaced runtime %USERPROFILE% resolution (STA-3348): a stale absolute path reports not_installed and is rewritten on install. - Record the standing unmeasured assumption in windows-edr-posture.md: `||` does not parse in Windows PowerShell 5.1, so a compat consumer that hosts hook strings there would fail closed. Measure before widening to another agent. - Trim the launcher comments per AGENTS.md; the numbers live in the doc. * test(win32): register the new Windows-gated hook test in the CI lane win32-test-lane-registration guards against exactly this: a Windows-gated file that self-skips on ubuntu and reports success, so it runs on no machine. The new windows-direct-cmd-hook-command.test.ts needs both entries — WINDOWS_PACKAGE_TESTS decides whether package_windows runs for a diff, and the workflow argv decides whether the file runs once that job started. * test(win32): remove the hook temp tree through the retrying helper windows-lane-tree-removal-boundary scans exactly the specs in the Windows CI lane, so registering windows-direct-cmd-hook-command.test.ts subjected it to the rule: cmd.exe and bash have just exited in that tree, and a raw recursive rm throws EPERM on Windows while their handles drain, turning a green spec into a lane failure. Use removeTreeSync, which carries the repo's maxRetries policy. --------- Co-authored-by: Orca Worker <orca-worker@localhost>
147 lines
7.1 KiB
JSON
147 lines
7.1 KiB
JSON
{
|
|
"extends": "@electron-toolkit/tsconfig/tsconfig.node.json",
|
|
"include": [
|
|
"../src/cli/**/*",
|
|
"../src/shared/**/*",
|
|
"../src/main/agent-state-file-reader.ts",
|
|
"../src/main/agent-hooks/hook-stdin-contract.ts",
|
|
"../src/main/agent-hooks/hook-post-command.ts",
|
|
"../src/main/agent-hooks/hook-config-write-path.ts",
|
|
"../src/main/agent-hooks/hooks-json-read.ts",
|
|
"../src/main/agent-hooks/installer-utils.ts",
|
|
"../src/main/agent-hooks/installer-utils-remote.ts",
|
|
"../src/main/agent-hooks/local-agent-cli-presence.ts",
|
|
"../src/main/agent-hooks/managed-agent-hook-controls.ts",
|
|
"../src/main/agent-hooks/managed-agent-hook-registry.ts",
|
|
"../src/main/agent-hooks/managed-hook-script-refresh.ts",
|
|
"../src/main/agent-hooks/posix-hook-command.ts",
|
|
"../src/main/agent-hooks/runtime-home-hook-command.ts",
|
|
"../src/main/agent-hooks/windows-direct-cmd-hook-command.ts",
|
|
"../src/main/agent-hooks/windows-powershell-hook-launcher.ts",
|
|
"../src/main/amp/agent-status-plugin-source.ts",
|
|
"../src/main/amp/hook-service.ts",
|
|
"../src/main/amp/managed-plugin-install-status.ts",
|
|
"../src/main/antigravity/hook-events.ts",
|
|
"../src/main/antigravity/hook-script.ts",
|
|
"../src/main/antigravity/hook-service.ts",
|
|
"../src/main/antigravity/hooks-json-bundle.ts",
|
|
"../src/main/claude/hook-settings.ts",
|
|
"../src/main/claude/hook-service.ts",
|
|
"../src/main/claude/statusline-script.ts",
|
|
"../src/main/claude-accounts/keychain.ts",
|
|
"../src/main/codex/codex-app-server-capability-cache.ts",
|
|
"../src/main/codex/codex-app-server-capability-signal.ts",
|
|
"../src/main/codex/codex-app-server-client.ts",
|
|
"../src/main/codex/codex-app-server-session.ts",
|
|
"../src/main/codex/codex-config-mirror.ts",
|
|
"../src/main/codex/codex-config-path-reference-rewrite.ts",
|
|
"../src/main/codex/codex-config-settings-preservation.ts",
|
|
"../src/main/codex/codex-config-settings-removal.ts",
|
|
"../src/main/codex/codex-config-settings-upsert.ts",
|
|
"../src/main/codex/codex-home-paths.ts",
|
|
"../src/main/codex/codex-hook-definition.ts",
|
|
"../src/main/codex/codex-managed-home-resource-copy-marker.ts",
|
|
"../src/main/codex/codex-managed-trust-grant-plan.ts",
|
|
"../src/main/codex/codex-path-observation.ts",
|
|
"../src/main/codex/codex-hook-identity.ts",
|
|
"../src/main/codex/codex-hook-legacy-cleanup.ts",
|
|
"../src/main/codex/codex-hook-local-install.ts",
|
|
"../src/main/codex/codex-hook-local-maintenance.ts",
|
|
"../src/main/codex/codex-hook-remote-install.ts",
|
|
"../src/main/codex/codex-hook-script.ts",
|
|
"../src/main/codex/codex-hook-service-implementation.ts",
|
|
"../src/main/codex/codex-hook-status.ts",
|
|
"../src/main/codex/codex-hook-system-trust.ts",
|
|
"../src/main/codex/codex-hook-trust-cleanup.ts",
|
|
"../src/main/codex/codex-hook-trust-grant.ts",
|
|
"../src/main/codex/codex-hook-trust-queue.ts",
|
|
"../src/main/codex/codex-hook-user-mirroring.ts",
|
|
"../src/main/codex/codex-hook-wsl-runtime.ts",
|
|
"../src/main/codex/codex-managed-trust-reconciliation.ts",
|
|
"../src/main/codex/codex-process-exit-deadline.ts",
|
|
"../src/main/codex/codex-state-db.ts",
|
|
"../src/main/codex/codex-trust-identity.ts",
|
|
"../src/main/codex/codex-trust-config-rollback.ts",
|
|
"../src/main/codex/codex-trust-config-mutation-queue.ts",
|
|
"../src/main/codex/codex-trust-grant-telemetry.ts",
|
|
"../src/main/codex/codex-trust-grant-host.ts",
|
|
"../src/main/codex/codex-trust-grant-ledger.ts",
|
|
"../src/main/codex/codex-user-hook-trust-rebase-client.ts",
|
|
"../src/main/codex/codex-user-hook-trust-rebase.ts",
|
|
"../src/main/codex/codex-wsl-hook-install-plan.ts",
|
|
"../src/main/codex/config-settings-baseline.ts",
|
|
"../src/main/codex/config-settings-conflict-resolution.ts",
|
|
"../src/main/codex/config-settings-promotion.ts",
|
|
"../src/main/codex/config-settings-promotion-write-target.ts",
|
|
"../src/main/codex/config-sync-stall.ts",
|
|
"../src/main/codex/config-toml-atomic-write.ts",
|
|
"../src/main/codex/config-toml-deprecated-hook-flag.ts",
|
|
"../src/main/codex/config-toml-hook-trust-blocks.ts",
|
|
"../src/main/codex/config-toml-hook-trust-edit.ts",
|
|
"../src/main/codex/config-toml-hook-trust-read.ts",
|
|
"../src/main/codex/config-toml-key-path.ts",
|
|
"../src/main/codex/config-toml-line-scan.ts",
|
|
"../src/main/codex/config-toml-project-trust.ts",
|
|
"../src/main/codex/config-toml-runtime-owned-sections.ts",
|
|
"../src/main/codex/config-toml-syntax.ts",
|
|
"../src/main/codex/config-toml-trust.ts",
|
|
"../src/main/codex/hook-service.ts",
|
|
"../src/main/codex/hook-trust-promotion.ts",
|
|
"../src/main/codex/managed-home-shell-preflight.ts",
|
|
"../src/main/codex-accounts/fs-utils.ts",
|
|
"../src/main/codex-accounts/wsl-codex-command.ts",
|
|
"../src/main/codex-cli/command.ts",
|
|
"../src/main/command-code/command-code-managed-script.ts",
|
|
"../src/main/command-code/hook-service.ts",
|
|
"../src/main/copilot/copilot-managed-hook-definitions.ts",
|
|
"../src/main/copilot/copilot-managed-script.ts",
|
|
"../src/main/copilot/copilot-remote-hook-install.ts",
|
|
"../src/main/copilot/hook-service.ts",
|
|
"../src/main/cursor/hook-events.ts",
|
|
"../src/main/cursor/hook-script.ts",
|
|
"../src/main/cursor/hook-service.ts",
|
|
"../src/main/droid/hook-service.ts",
|
|
"../src/main/gemini/hook-service.ts",
|
|
"../src/main/grok/grok-hook-config.ts",
|
|
"../src/main/grok/grok-hook-config-cleanup.ts",
|
|
"../src/main/grok/grok-hook-config-file.ts",
|
|
"../src/main/grok/grok-hook-owners.ts",
|
|
"../src/main/grok/grok-hook-remote-install.ts",
|
|
"../src/main/grok/grok-hook-script.ts",
|
|
"../src/main/grok/grok-hook-symlink-cleanup-marker.ts",
|
|
"../src/main/grok/hook-service.ts",
|
|
"../src/main/grok/windows-grok-hook-script.ts",
|
|
"../src/main/devin/hook-settings.ts",
|
|
"../src/main/devin/hook-service.ts",
|
|
"../src/main/devin/hook-config-json.ts",
|
|
"../src/main/hermes/hermes-config-yaml.ts",
|
|
"../src/main/hermes/hermes-home-filesystem.ts",
|
|
"../src/main/hermes/hermes-managed-plugin-source.ts",
|
|
"../src/main/hermes/hook-service.ts",
|
|
"../src/main/git-bash.ts",
|
|
"../src/main/in-flight-run-dedupe.ts",
|
|
"../src/main/kimi/hook-service.ts",
|
|
"../src/main/kimi/kimi-hook-config-toml.ts",
|
|
"../src/main/openclaude/hook-service.ts",
|
|
"../src/main/rolling-file-backup.ts",
|
|
"../src/main/startup/hydrate-shell-path.ts",
|
|
"../src/main/startup/windows-shell-path-ownership.ts",
|
|
// Why: serve-electron-flag-parity.test.ts checks the Electron-side serve argv rewrite against this
|
|
// project's serve spec; the module has no imports, so listing it pulls in nothing else.
|
|
"../src/main/startup/serve-mode-argv.ts",
|
|
// The parity test keeps this import-free list aligned with COMMAND_SPECS.
|
|
"../src/main/startup/cli-command-names.ts",
|
|
"../src/main/runtime/runtime-metadata.ts",
|
|
"../src/main/sqlite/sync-database.ts",
|
|
"../src/main/win32-utils.ts"
|
|
],
|
|
"compilerOptions": {
|
|
"composite": true,
|
|
// TypeScript 7 removed node10 resolution; Node16 preserves CommonJS emit for this package.
|
|
"module": "Node16",
|
|
"moduleResolution": "Node16",
|
|
"rootDir": "../src",
|
|
"outDir": "../out"
|
|
}
|
|
}
|