Skip to content

Add agent hook opt-out controls - #2714

Merged
nwparker merged 1 commit into
mainfrom
nwparker/hook
May 24, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/hook

Conversation

@nwparker

@nwparker nwparker commented May 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Add a persisted agentStatusHooksEnabled switch plus Settings > Agents UI to remove or reinstall managed status hooks.
  • Clarify the Settings > Agents status-hooks copy so users can see that Claude and Codex use scoped settings/profiles and normal terminal config is preserved.
  • Launch Orca-created Claude sessions with Claude Code --settings pointing at an Orca-owned ~/.orca/agent-hooks settings file, and sweep legacy Orca entries from global ~/.claude/settings.json so outside-Orca Claude stays clean.
  • Keep the scoped Claude settings file hook-only; regression coverage preserves user Bedrock/AWS/apiKeyHelper settings while removing only legacy Orca hook entries.
  • Launch Orca-created Codex sessions through profile-v2 orca-agent-status and store Codex hooks/trust in the profile config so external Codex sessions stay clean.
  • Keep the Codex profile hook-only; regression coverage preserves user model_provider/model_providers/env_key config while adding Orca hooks in profile-v2.
  • Add orca agent hooks status/on/off CLI commands and wire startup, runtime RPC, SSH, runtime-environment, and PTY env behavior to the persisted switch.
  • Restore or strip inherited OpenCode/Pi/Claude hook env when the switch is off so nested terminals do not keep Orca overlays.

Claude Code finding

  • The old Claude Code source and current claude --help both confirm --settings .
  • The old source loads --settings early as flagSettings; flagSettings participates in the normal merged settings chain, and hook snapshots read from that merged settings object.
  • This avoids CLAUDE_CONFIG_DIR, so Orca does not fork Claude auth, keychain, session, history, or plugin state.

Codex finding

  • The Codex source loads --profile-v2 as a second user config layer above the base $CODEX_HOME/config.toml, so the profile only needs hook overrides.
  • Config merging recursively preserves base user tables such as model_providers, auth-store settings, and other provider config unless the profile explicitly overrides those keys.
  • Hook discovery scans enabled config layers directly, lowest precedence first, so base user hooks and Orca's profile hooks can both be discovered for Orca-launched Codex sessions.

Verification

  • claude --help | rg -- '--settings|--setting-sources'
  • pnpm test: 929 files passed, 9744 tests passed, 9 skipped
  • pnpm run typecheck
  • pnpm run lint
  • pnpm run build:cli
  • git diff --check
  • pnpm vitest run src/main/claude/hook-service.test.ts --config config/vitest.config.ts
  • pnpm vitest run src/main/codex/hook-service.test.ts --config config/vitest.config.ts
  • pnpm vitest run src/renderer/src/components/settings/AgentsPane.test.tsx --config config/vitest.config.ts
  • pnpm vitest run src/shared/tui-agent-startup.test.ts src/main/claude/hook-service.test.ts src/main/ipc/pty.test.ts src/main/agent-hooks/remote-hook-service-installers.test.ts
  • pnpm vitest run src/main/runtime/orca-runtime.test.ts src/renderer/src/lib/launch-agent-background-session.test.ts src/main/providers/provider-dispatch.test.ts --config config/vitest.config.ts
  • pnpm vitest run src/renderer/src/lib/launch-agent-background-session.test.ts --config config/vitest.config.ts
  • node out/cli/index.js agent hooks status --json
  • Electron visual check on this worktree: Settings > Agents status-hooks row at 1920x1200 and 1100x800
  • Live UI check in dev Electron: Settings > Agents row, hooks search, checked and unchecked visual states

@nwparker
nwparker force-pushed the nwparker/hook branch 3 times, most recently from 1d65eb6 to b127d87 Compare May 24, 2026 03:36
@nwparker
nwparker merged commit 4f81953 into main May 24, 2026
6 checks passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 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.

1 participant