Repository navigation
Keep Claude hooks scoped to selected config dirs - #6956
brennanb2025 wants to merge 3 commits into
Conversation
Co-authored-by: Orca <help@stably.ai>
|
Ready to review this PR? Stage has broken it down into 7 individual chapters for you: Chapters generated by Stage for commit 295b420 on Jun 30, 2026 11:14pm UTC. |
📝 WalkthroughWalkthroughThis PR updates Claude managed-hook installation, status, removal, and target discovery to support host and WSL config paths. It adds POSIX endpoint-file support in the agent hook server and shell-aware endpoint-file writing. WSL environment propagation changes in daemon and local PTY flows now remove stale Claude config imports, add agent-hook keys, and select POSIX endpoint paths when available. PTY launch handling now installs Claude hooks during prepared launches and passes runtime settings into hook-enable updates. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
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: 8
🧹 Nitpick comments (1)
src/main/ipc/pty.test.ts (1)
689-720: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAssert call order in the “before spawn” tests.
These cases prove hook repair ran, but not that it ran before
spawn(). A refactor that moves installation after the launch would still pass.Suggested assertion
expect(claudeHookInstallMock).toHaveBeenCalledWith( expect.objectContaining({ configDir: '/tmp/claude-personal', runtime: 'host' }), { verifyStatus: false } ) + expect(claudeHookInstallMock.mock.invocationCallOrder[0]).toBeLessThan( + spawnMock.mock.invocationCallOrder[0] + ) expect(spawnMock).toHaveBeenCalled()Also applies to: 860-899
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 7a1d5e50-bc4e-4044-9630-0036dbdde65b
📒 Files selected for processing (20)
src/main/agent-hooks/installer-utils.test.tssrc/main/agent-hooks/installer-utils.tssrc/main/agent-hooks/managed-agent-hook-controls.test.tssrc/main/agent-hooks/managed-agent-hook-controls.tssrc/main/agent-hooks/server.test.tssrc/main/agent-hooks/server.tssrc/main/claude/hook-service.test.tssrc/main/claude/hook-service.tssrc/main/claude/hook-settings.tssrc/main/daemon/pty-subprocess.test.tssrc/main/daemon/pty-subprocess.tssrc/main/index.tssrc/main/ipc/pty.test.tssrc/main/ipc/pty.tssrc/main/ipc/settings.tssrc/main/providers/local-pty-provider.test.tssrc/main/providers/local-pty-provider.tssrc/main/runtime/orca-runtime.tssrc/main/wsl-env.tssrc/shared/agent-hook-listener.ts
Co-authored-by: Orca <help@stably.ai>
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 97949ffa-b887-4603-969a-f381f2713cdd
📒 Files selected for processing (9)
src/main/agent-hooks/installer-utils.tssrc/main/agent-hooks/managed-agent-hook-controls.test.tssrc/main/agent-hooks/managed-agent-hook-controls.tssrc/main/daemon/pty-subprocess.test.tssrc/main/daemon/pty-subprocess.tssrc/main/ipc/pty.test.tssrc/main/ipc/pty.tssrc/main/providers/local-pty-provider.test.tssrc/main/providers/local-pty-provider.ts
🚧 Files skipped from review as they are similar to previous changes (8)
- src/main/providers/local-pty-provider.test.ts
- src/main/providers/local-pty-provider.ts
- src/main/daemon/pty-subprocess.test.ts
- src/main/daemon/pty-subprocess.ts
- src/main/ipc/pty.test.ts
- src/main/agent-hooks/managed-agent-hook-controls.test.ts
- src/main/agent-hooks/managed-agent-hook-controls.ts
- src/main/ipc/pty.ts
Co-authored-by: Orca <help@stably.ai>
Summary
Keeps Orca-managed Claude hooks in the same Claude config namespace that launch prep selects for the active runtime/account. When Orca launches Claude with a resolved
CLAUDE_CONFIG_DIRor WSL config dir, hook settings and scripts are repaired in that same namespace instead of defaulting to~/.claude.Boundaries: this does not add a multi-account UI, does not use Claude enterprise managed settings, and does not crawl arbitrary old config dirs. Disable cleanup removes default, ambient, saved-account, recorded WSL system-default, and known persisted WSL default targets only.
Design Approach
WSLENV.Review And Verification
land; Electron launched from this worktree with identity verified, no renderer console errors observed.Tests
pnpm run typecheckpnpm run tc:nodepnpm run typecheck:clipnpm run lintpnpm exec oxlint src/shared/agent-hook-listener.ts src/main/agent-hooks/server.ts src/main/agent-hooks/server.test.ts src/main/agent-hooks/installer-utils.ts src/main/agent-hooks/installer-utils.test.ts src/main/agent-hooks/managed-agent-hook-controls.ts src/main/agent-hooks/managed-agent-hook-controls.test.ts src/main/claude/hook-settings.ts src/main/claude/hook-service.ts src/main/claude/hook-service.test.ts src/main/ipc/pty.ts src/main/ipc/pty.test.ts src/main/providers/local-pty-provider.ts src/main/providers/local-pty-provider.test.ts src/main/daemon/pty-subprocess.ts src/main/daemon/pty-subprocess.test.ts src/main/wsl-env.ts src/main/index.ts src/main/ipc/settings.ts src/main/runtime/orca-runtime.tspnpm vitest run src/main/agent-hooks/server.test.ts src/main/agent-hooks/installer-utils.test.ts src/main/agent-hooks/managed-agent-hook-controls.test.ts src/main/claude/hook-service.test.ts src/main/ipc/pty.test.ts src/main/providers/local-pty-provider.test.ts src/main/daemon/pty-subprocess.test.ts src/cli/handlers/agent-hooks.test.ts --config config/vitest.config.tsgit diff --checkRemaining Gaps
CLAUDE_CONFIG_DIRmay still degrade; current Claude Code supports this config-dir state model.Post-PR Stabilization
Completed. CI
verifypassed on the latest commit. CodeRabbit posted 8 actionable comments on the first pass and 1 actionable follow-up on the second pass; both sets were fixed and the latest CodeRabbit review reports no actionable comments. CodeRabbit still shows a non-blocking repo-wide docstring-coverage warning in its pre-merge summary, but GitHub checks are passing and that warning is unrelated to this PR.Made with Orca 🐋