Repository navigation
fix(cli): agent hooks status reports the running app and its SQLite file - #41445
Conversation
Status always said appliedBy offline and named orca-data.json, even when the app was connected and the setting lived only in profile-state.db.
When the runtime answers, status takes agentStatusHooksEnabled from settings.get instead of the disk, so appliedBy: runtime is true. The settings path rule lives next to the reader, and on/off report the SQLite file when the runtime applied the change.
|
No actionable comments were generated in the recent review. Walkthrough
Severity of issue fixed: Low Merge Risk:
|
Carries over #40411 by @innocarpe.
ELI5
orca agent hooks statussaid hooks were being reported "offline" and pointed at a settings file that doesn't exist, even while Orca was open and the hooks were working. Now, when Orca is running, it asks Orca for the setting and points at the file the setting actually lives in.What Changed
Before, with the app running and settings in SQLite:
After:
agent hooks statusreadsagentStatusHooksEnabledfrom the running app (settings.get) and reportsappliedBy: runtime. When nothing answers, it reads the disk and reportsoffline, as before.profile-state.db) now lives next to the offline settings reader, asresolveAgentHookSettingsPath.statususes it, and so doagent hooks on/offwhen the running app applied the change. Before this,on/offprinted the JSON path too.Why
The status handler hardcoded
appliedBy: 'offline', and the CLI'sgetDataPath()always returnedorca-data.json, even after the profile moved to SQLite. #40411 by @innocarpe fixed the path and the label. This carry-over keeps that commit, rebased onto main: the classification module had moved, and the test file conflicted. My commit on top does three things:runtime, the value now comes from the runtime. Otherwise status would claim the running app's answer while still printing the disk value.on/offget the same path fix, which fix(cli): report connected agent hook status from the sqlite file #40411 listed under its limits.settings.gethas returnedagentStatusHooksEnabledsince the hook opt-out controls (#2778), so it works against any runtime this CLI can talk to.Linked Issue
Fixes #40401
Linear: STA-14557
Visual Proof
CLI output only, no UI. Run against the same connected app (Orca 1.4.257, runtime ready and reachable). Before, with the installed CLI:
After, with this branch's CLI (
bun src/cli/index.ts agent hooks status):Testing
Reproduced on the installed 1.4.257 build with the runtime connected (
orca status: ready, reachable), then ran this branch's CLI against the same app (output above).src/cli/handlers/agent-hooks.test.tsgets one table test with two rows, against a real SQLite-only profile:falsewhile the disk still saystrue.enabled,appliedByandsettingsPath, and both fail with main's handler.Also ran
profile-state-offline-settings.test.ts,profile-state-cutover-soak.test.tsandcheck:code-quality:changed.macOS only. The change adds no platform-specific code, and it uses the same runtime transport as
on/off, which is a Unix socket or a Windows named pipe.I manually tested these changes locally
Automated tests added/updated, or explained why not below
Every added test fails without this change and avoids the test anti-patterns
Risk
The riskiest part: if the runtime answers
status.getbutsettings.getthen fails (for example the runtime is still starting, or the terminal belongs to a different Orca instance),agent hooks statusnow exits with an error instead of printing the disk value.on/offalready behave this way, and printing a possibly stale disk value as the app's answer is what this fixes. No saved data or wire format changes. Agent hooks commands are local only, since remote flags are rejected. A plain revert backs it out.Level: Low
AI Disclosure
Review
review-loop: one round with Codex and Claude. Codex found nothing. Claude raised two P3s, and I left both:
settings.geterrors: matcheson/off(see Risk).perf-scan: no findings. This is a one-shot CLI command: when the app is connected it adds one local RPC and skips one SQLite open.
Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
settings.getover the CLI's own local runtime token.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)