Skip to content

fix(claude): write only the hook events and statusLine the user's Claude accepts - #23614

Merged
brennanb2025 merged 9 commits into
mainfrom
brennanb2025/claude-hook-events-by-version
Sep 28, 2026
Merged

brennanb2025 merged 9 commits into
mainfrom
brennanb2025/claude-hook-events-by-version

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

Orca adds its status hooks to Claude's settings file, ~/.claude/settings.json. Older Claude versions check every hook name in that file against a fixed list. If they find even one name they don't recognise, they throw away the whole file. That includes your environment variables, your permissions and your own hooks. On the versions we captured, an interactive Claude stops at a "Settings Error" screen whose default choice quits, and claude -p gives no warning at all. Orca was writing hook names that are newer than those Claude versions, and on some mid-2025 versions a statusLine setting they reject the same way. So on an older Claude, turning on Orca's status tracking switched off all of your Claude settings, and an interactive Claude could stop at that error screen on every start. Orca now writes only the hook names and settings that your Claude version understands.

What Changed

Before: on Claude 2.1.77 or older, Orca's install added hook names such as StopFailure (added in 2.1.78) and PostCompact (2.1.76). On Claude 1.0.49 to 1.0.63, which also reject any unknown top-level setting, the statusLine Orca writes for its usage display had the same effect; those versions learned statusLine in 1.0.64. Claude then ignored the whole settings file: API/Bedrock environment, allow and deny rules, and every hook the user had written.

  • Interactive Claude: on 2.1.32 and 2.1.77, the versions captured, every start opened a blocking "Settings Error" screen naming the unknown hook (see Visual Proof). The default choice, "1. Exit and fix manually", quits Claude. "2. Continue without these settings" runs Claude with none of the user's settings.
  • Print mode (claude -p): nothing is shown. 1.0.8x logs the error only under --debug, and 2.1.77 logs nothing; the run simply goes ahead without the user's settings.

After: Orca adds only the hook events that the Claude it found knows about, and writes its statusLine only if that Claude knows it. That Claude keeps reading the file, and all of the user's settings still apply. After the user upgrades Claude, the next install adds the newer events. Orca installs when it starts, when status hooks are turned on in Settings, and on each SSH or WSL connection.

How it works:

  • Orca writes only two top-level keys into this file: hooks and statusLine. In every Claude release checked, the hook entry and matcher objects accept Orca's fields or silently drop unknown ones (timeout is ignored before 1.0.41), so the event table and the statusLine first release are the only parts that depend on the version.
  • claude-hook-event-versions.ts holds a table with one entry per event Orca installs: the first Claude release whose list of known hook names includes it.
  • Each value was read from the hook-name list built into that npm release of @anthropic-ai/claude-code. Claude has checked user settings against that list since 1.0.23, so the table goes back that far. The six core events have real first releases too, such as SessionStart (1.0.62) and UserPromptSubmit (1.0.53).
  • Every event Orca installs must have a table entry. Typecheck fails otherwise, and a table entry with no matching list in the fixture fails its test.
  • statusLine has its own first release, CLAUDE_STATUS_LINE_FIRST_VERSION (1.0.64), read from each release's settings schema the same way.
  • The per-release lists are checked into __fixtures__/claude-hook-event-enums.json. That includes the release just before each event first appears. The same file records, for every packed release from 1.0.48 to 1.0.67, the settings schema's full list of top-level keys and whether it rejects any other key. A test pins every table value and the statusLine floor to those records, so each entry is exact, not just safe. Another test runs a real install, and a downgrade from a current Claude, for each strict release among them and checks that every top-level key and hook name in the written file is one that release accepts. A key Orca starts writing later fails that test without anyone having to add a new check for it.
  • getClaudeManagedHookPlan(version) in claude-managed-hook-events.ts turns the Claude version into a plan. The plan lists the events to install, the events whose Orca entry must be removed, and whether to write or remove Orca's statusLine. Install, status and the remote installer all use it; the remote installer never writes a statusLine, as before. The event list moved to that file so hook-settings.ts stays under its line limit.
  • The version comes from the probe Orca already runs: claude --version on the path it resolved for a local install, and the relay's own agent detection for SSH and WSL, where the remote Claude version is used. No new probe was added.
  • A Claude newer than any Orca has seen: the table stores only each event's first release, with no upper limit and no list of known versions. Any version Orca can read gets every event whose first release it has reached, so a Claude released after this Orca build, and one the user updates to before updating Orca, gets Orca's full set of hooks, exactly as before this PR. Hook names a newer Claude introduces are not used until an Orca release adds support for them, which is also unchanged. Claude 2.1.101 and newer also skip an unknown hook name instead of discarding the file, so a future Claude would not hit this bug even without the table. If a new release's claude --version can't be read, Orca falls back to the unknown-version set below: the six core events and the statusLine, which every Claude since 1.0.64 accepts.
  • Version unknown (the probe failed, timed out or printed nothing usable): Orca treats the Claude as 1.0.64. It adds only its six core lifecycle events (SessionStart, UserPromptSubmit, Stop, SubagentStop, PreToolUse and PostToolUse) and still writes its statusLine, as it did before. Every Claude since 1.0.64 (30 July 2025) accepts all of that. A Claude older than that is only protected when its version is known; then it gets exactly the events its own list has, and no statusLine if it predates 1.0.64. A known Claude older than 1.0.23 gets no events at all, because its hooks setting has a different shape.
  • Version unknown also removes nothing: every other Orca entry already in the file stays exactly as it is. Those entries were written by an install that did know the version.
  • Never removes what the user wrote: Orca removes its own entry for an event only when the Claude version is known and that Claude doesn't know the event. User entries under the event stay. If nothing else is left under the event, the key is removed. An empty or unreadable value the user wrote is left alone. The same holds for statusLine: a known Claude older than 1.0.64 loses Orca's statusLine but never one the user set, and Orca forgets that it had installed one, so an upgrade adds it back instead of reading the removal as the user opting out.
    • This means a known Claude downgrade also removes Orca's newer events. Leaving them would break the older Claude's settings file again.
  • SessionEnd: Claude has known it since 1.0.85. It stays behind its existing 2.1.261 install floor, which is the only version its delivery was measured on. Lowering that floor is a separate decision.
  • Status: the install status checks the same version-based set as the install. An old Claude with a complete install therefore reads "installed", not "partial".
    • A caller that doesn't know the version checks the six core events. The status shown in Settings and by the CLI is one of these: it does not probe the version, so there a modern Claude that is missing only newer events reads "installed", not "partial".
  • OpenClaude: no change. It reads its own ~/.openclaude/settings.json, and it accepts every event Orca writes. Orca still never writes a statusLine there.
  • Qoder: no change. It keeps its own fixed list of events in ~/.qoder/settings.json and is never gated on a Claude version. Orca never writes a statusLine there.
  • Code comment: the claim "older Claude builds ignore unregistered event names" was wrong, and it is removed.

Why

  • Why a checked-in table, not a live check:
    • A live check would need Orca to start a Claude against a trial settings file, which costs time on every install.
    • It also adds a new way for the install to fail.
    • Its answer would only cover that one binary at that moment.
    • The table costs nothing to use, is keyed on the version Orca already probes, and can be checked against the Claude releases themselves.
    • Adding a new event means adding one table line, backed by that release's hook-name list.
  • Why an unknown version adds only the core events and removes nothing: a probe that fails or times out tells Orca nothing about how old the Claude is.
    • Adding a newer name could break an old Claude's file, so Orca adds only the core events and the statusLine it always wrote, which every Claude from the last 14 months understands. Adding none would leave the sidebar with no status at all whenever the check fails.
    • Removing would be worse on a modern Claude. A version check that times out on a busy machine would strip StopFailure, PermissionRequest and the rest, and the user's status tracking would be degraded until the next successful check.
    • Leaving the existing entries alone changes nothing the user had before this install. Only a known version that lacks an event removes Orca's entry.
  • Why removal is limited to Orca's own entries: Orca can't judge what is safe in hooks it didn't write. Its own entries are the only ones it can be sure it may remove.

Known limitation

~/.claude/settings.json is one file shared by every Claude binary on the machine. Orca only knows the version of the one Claude it resolves. If the user also runs an older Claude from a different path, that Claude can still see events (or, before 1.0.64, a statusLine) it doesn't know, and on 2.1.100 or older it will ignore the settings file. The same applies on an SSH host or WSL distro that has more than one Claude installed. Claude 2.1.101 and newer ignore only the unknown hook name and keep the rest of the file.

An unknown version is treated as 1.0.64, so a Claude older than that whose version check fails still gets a file it rejects, as it did before this PR.

One more gap: if the user downgrades Claude and the version check then fails, the newer Orca entries from the earlier install stay in the file until a check succeeds. This is deliberate. A failed check is far more likely on a modern Claude that is merely slow to answer than on a downgraded one. The same holds for a downgrade while Orca is running: the file is corrected at the next install, not at the moment of the downgrade.

Linked Issue

N/A. This was found by checking Orca's installed hook names against the hook-name lists in Claude's npm releases, and confirmed against real Claude binaries from 1.0.81 to 2.1.283 on 2026-09-28. The releases before 1.0.81 were checked in their packaged code only, not run; that includes the settings schemas behind the statusLine floor. Whether the top level rejects unknown keys was checked in 65 packed releases from 1.0.0 to 2.1.100, not in every release.

Visual Proof

Orca's UI does not change. Both captures are Claude 2.1.77 starting interactively on Windows, rendered from the recorded terminal output, with paths replaced by placeholders. Before: the settings file Orca's install wrote before this PR.

────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  Settings Error
  <home>\.claude\settings.json
   └ hooks
     └ StopFailure: Invalid key in record
  Files with errors are skipped entirely, not just the invalid settings.
  ❯ 1. Exit and fix manually
    2. Continue without these settings
  Enter to confirm · Esc to cancel

After: the settings file this branch's install writes for 2.1.77, plus the user's own env value and hook. Claude starts, the user's hook fires with the user's env visible, and the turn runs.

│   <QA>\after-2.1.77\cwd   │
❯ say ok
● ok
❯ /exit
  ⎿  Goodbye!

Testing

  • Automated tests added/updated
  • I manually tested these changes locally. Live on a Windows machine, with pinned Claude releases installed in a scratch folder, a scratch home, a local stub API and no credentials:
    • settings files were written by this branch's real install code for 1.0.62, 2.1.32 and 2.1.77, each with a user env value and user hook added;
    • on all three, Claude started with no Settings Error, the user's hook fired, the user's env value reached it, and the turn completed;
    • the control, main's install for 2.1.77, showed the blocking Settings Error screen.
    • Not covered: macOS and Linux live runs (the validation is the same platform-independent code), and SSH hosts (covered by tests).

Added and updated tests:

  • claude-hook-event-versions.test.ts:
    • pins each table value to the first release in the fixture whose list has the event;
    • checks that the release just before it does not have the event;
    • checks that an unknown version is granted only the six core events;
    • pins the statusLine floor to the first release whose settings schema knows it, and checks that the release before it rejects unknown keys and lacks statusLine.
  • claude-hook-event-install.test.ts:
    • for every release in the fixture, the install writes no event name that release rejects;
    • for every release with a recorded settings schema, the plan writes statusLine exactly when that release knows it;
    • an old version leaves out the newer events;
    • an unknown version adds only the six core events;
    • a known Claude older than 1.0.64 gets only the events its own list has, and a downgrade to one removes Orca's other entries;
    • an unknown version on a file that already holds Orca's newer entries leaves those entries byte-identical and adds nothing, even when they were written by an older form of Orca's hook command;
    • an upgrade adds events;
    • a downgrade removes only Orca's entries;
    • the user's entries, env and permissions survive installs at every version and after a downgrade;
    • SessionEnd keeps its floor.
  • claude-status-line-install.test.ts:
    • a local install for Claude 1.0.63 writes the events but no statusLine;
    • a downgrade to 1.0.63 removes Orca's statusLine, and an upgrade to 1.0.64 adds it back;
    • a statusLine the user set survives an install for an old Claude;
    • a user who deleted Orca's statusLine stays opted out across a downgrade and an upgrade;
    • an unknown version still installs the statusLine.
  • claude-settings-schema-install.test.ts: for every strict release from 1.0.49 to 1.0.66, a real install, and a downgrade from a current Claude, write only top-level keys and hook names in that release's schema.
  • hook-service.test.ts:
    • a local install for an old Claude writes the reduced set and reports "installed";
    • a later install whose version check fails keeps the newer events and still reports "installed";
    • the SSH/WSL remote installer writes only what the remote Claude knows, then adds the newer events once that Claude is upgraded;
    • the existing OpenClaude tests still expect the full set.
  • Each new test was checked by breaking the matching part of the fix and confirming the test fails:
    • a wrong table value;
    • no version gate;
    • no upgrade path;
    • no removal on downgrade;
    • removal that also strips user entries;
    • deleting user values it couldn't read;
    • status that ignores the version;
    • a remote install that ignores the version;
    • OpenClaude caught by the gate;
    • SessionEnd's floor removed;
    • an unknown version that removes entries;
    • the six core events treated as known by every Claude, which writes SessionStart and UserPromptSubmit to Claude 1.0.23 to 1.0.61;
    • an unknown version granted only what 1.0.23 knows;
    • statusLine written for every version;
    • Orca's statusLine removed without forgetting that it had been installed;
    • removal that also strips the user's statusLine;
    • an unknown version treated as 1.0.62 again, which stops installing the statusLine there;
    • the statusLine floor set to 1.0.63;
    • forgetting that Orca had installed its statusLine even when it had not been there to remove, which re-adds it after a user deleted it;
    • the install writing an extra top-level key (enabledPlugins), which fails every strict release;
    • statusLine written for every version, which fails 1.0.49 to 1.0.63;
    • a downgrade that removes nothing, which fails every strict release's downgrade case.
  • Ran pnpm tc:node, pnpm tc:cli, oxlint on the changed files, pnpm run check:code-quality:changed, and vitest over the Claude hook and agent-hook installer, relay and SSH suites.

Review

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Author X: @BrennanKB5

  • Security: settings that users were losing now apply again, including deny rules. No new process is started.
  • Cross-platform: the logic is plain version comparison, the same on macOS, Linux and Windows.
  • SSH/WSL: the remote install uses the Claude version the relay detects on that host. The relay is shipped with the client, so there is no change to what the two sides send each other.
  • Backwards compatibility: an install on a new Claude whose version Orca reads writes the same events as before. If the version check fails, a fresh install now writes only the six core events, where it used to write all of them, and still writes the statusLine; entries an earlier install wrote stay. A known Claude older than 1.0.64 no longer gets a statusLine, and one Orca wrote earlier is removed.
  • Performance: no new work at runtime.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

…s it gates

Pure move of claude-session-end-hook-capability.ts and its tests; the next
commit turns its one-event SessionEnd floor into a per-event version table.
Claude 1.0.81 through 2.1.100 validate settings.json `hooks` against a
closed event enum and discard the whole file on one unknown name, so
Orca's install made Claude <= 2.1.77 silently ignore the user's env,
permissions and hooks. Each managed event now carries the first Claude
release that knows it (pinned to per-release enums read from the npm
packages), and install, status and the SSH/WSL relay installer write
only the events the resolved Claude accepts. An unresolved version gets
the set every tabled Claude knows; a downgrade removes only Orca's own
entry for an event the older Claude would reject.
…module

hook-settings.ts is at its line limit; the event list and its version gate
move out whole so the next change has room.
…ntries

A failed or timed-out version probe is no evidence of an old Claude, so it
must not strip StopFailure, PermissionRequest and the other newer events a
version-aware install wrote. With the version unknown, install adds only
the set every tabled Claude knows and leaves every other entry exactly as
it is; only a known version that lacks an event retires Orca's entry.
…ed them

Claude validates hooks against a closed event list from 1.0.23, not 1.0.81.
The table treated SessionStart, UserPromptSubmit, Stop, SubagentStop,
PreToolUse and PostToolUse as known by every resolved version, so a Claude
from 1.0.23 to 1.0.61 was still sent names it rejects, and it dropped the
whole settings file. Pin each to its first release from the packed enums and
keep the unresolved-version set as its own policy.
Claude 1.0.49 through 1.0.66 also reject any unknown top-level settings
key, and statusLine joined that schema only in 1.0.64. Orca wrote its
statusLine for every Claude, so 1.0.49 to 1.0.63 still dropped the whole
settings file even with the event gate. Gate statusLine on 1.0.64, pinned
by the packed schemas; a known older Claude has Orca's own statusLine
removed along with the opt-out marker, so an upgrade re-adds it. An
unresolved version is now assumed to be 1.0.64, which knows the same core
events and keeps the statusLine install it had before.
Retiring Orca's statusLine for a Claude older than 1.0.64 forgets the
install marker only when Orca's own statusLine was removed. Pin that, so
a user who deleted Orca's statusLine is not opted back in by an upgrade.
…ct schema

Claude 1.0.49 through 1.0.66 discard the whole settings file over any
top-level key their schema lacks. The fixture recorded only whether each
release knew statusLine, so a new top-level key Orca wrote would pass every
test. Record each release's top-level keys instead (statusLine is derived
from them), add the hook enums for every packed release in that window,
and check that a real install and a downgrade write only keys and events
each strict release accepts.
Qoder (#23581) reuses the Claude settings writer for its own settings file, so it gets a fixed plan from its own events instead of Claude's version table: every Qoder event installed, nothing retired, statusLine left alone.
@brennanb2025

Copy link
Copy Markdown
Contributor Author

Review status: ready for review

Head: c371d1ff889, with current main merged, including Qoder support (#23581). CI: 30 passing, 11 skipped by path, 0 failing.

Does it fix the problem? Yes. On Claude 2.1.77 and older, Orca's hook install made Claude throw away the user's whole ~/.claude/settings.json. That meant their env, their own hooks and their permissions. Interactive Claude stopped at a blocking "Settings Error" screen whose default choice quits. Two things triggered it:

  • hook event names newer than that Claude;
  • on 1.0.49–1.0.63, the statusLine key.

Orca now writes only what the resolved Claude accepts. A live Windows run with pinned Claude releases confirmed it:

  • The settings this branch writes for 1.0.62, 2.1.32 and 2.1.77 load with no error screen. The user's own hook fires, with the user's env visible.
  • The control, main's install for 2.1.77, still shows the blocking screen.

Architecture: one version table records the first Claude release that knows each hook event, plus a floor for statusLine.

  • The table is pinned by a fixture of real per-release enums and top-level key lists, extracted from the published packages.
  • The typecheck forces every event Orca installs through the table.
  • A whole-output test runs the real install against every strict release. Any future key Orca writes that some release rejects fails it.
  • User entries are never touched.
  • An unknown version adds only the always-safe set and removes nothing, so a version-check timeout never strips a modern Claude's hooks.
  • OpenClaude and Qoder keep their own fixed event lists.

Review loops: four, the last clean. Fixed along the way:

  • the six core events also have first releases (1.0.23–1.0.62);
  • statusLine wiped the file on 1.0.49–1.0.63, where the top level is strict;
  • an unknown version no longer removes Orca's existing entries;
  • a user's statusLine opt-out survives a downgrade and an upgrade;
  • the merge with Qoder keeps Qoder exactly as on main.

The architecture loop found that Orca writes only two top-level keys (hooks, statusLine), and that the nested hook objects never reject Orca's fields in any of 65 packed releases.

Validation:

  • tc:node, tc:cli, oxlint and the changed-code gate all pass.
  • 555 tests pass across 29 files. Every behaviour was ablated, and each ablation turned its tests red.
  • Live Windows QA as above.
  • Not covered: live runs on macOS and Linux (the validation is the same platform-independent code), and live SSH hosts (covered by tests).

@brennanb2025
brennanb2025 marked this pull request as ready for review September 28, 2026 11:40
@coderabbitai

coderabbitai Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

📝 Walkthrough

Walkthrough

The change adds Claude CLI version gates for hook events and the status line. ClaudeHookService uses version-derived plans for local and remote installation, status checks, and status-line handling. Hook settings apply planned event installations and retirements while retaining remaining user hooks. Qoder receives a plan that installs its configured events and leaves the status line unchanged.

Priority: ⬆️ High

Merge Risk: 🟡 Moderate · up to c371d

Remote downgrades can leave settings that older Claude rejects, potentially causing it to ignore the entire file. Fix remote status-line retirement before merging; the empty-plan status also needs correction.

Security Architecture Review

Security architecture risk: 🔵 Low · up to c371d

Version-aware installation reduces the chance that older Claude versions reject a user's entire settings file. One installation-status edge case remains: a version too old to support any managed hook can be reported as installed. Version detection and remote downgrade behavior also leave some compatibility uncertainty.

Retained concerns

  • Medium · reliability · inferred: A Claude version with no supported managed events can be reported as installed despite having no managed hooks. This can misstate whether hook-based status tracking is operating.
Security review details

Security Blast Radius

  • inferred — The relevant exposure is each installed user's local or remote Claude settings file. If its reader rejects an unsupported key, the documented outcome includes loss of that file's permission rules, environment settings, and user hooks for that Claude invocation; no cross-tenant reachability is established.

Security Findings and Attack Paths

  • inferred — An unresolved version is treated as 1.0.64 for writes, so a genuinely older installation can still receive unsupported settings. The base installer already wrote the full event set and local Claude status line without this version gate; the evidence does not show that this PR introduced or worsened that exposure.

Trust Boundaries and Controls

  • observed — The version probe accepts a parsed successful CLI response and otherwise returns unresolved; command ownership checks limit retirement to matching managed entries rather than user-authored hooks or status lines.

Resilience and Maintainability Implications

  • inferred — Remote installation writes the managed script before settings and reports write failures as errors, limiting the chance that a successful settings write points to a missing script. Its separate success response does not verify that the selected plan contains a hook.

Hardening Proposals

  • proposed — Represent an unsupported no-hook version explicitly rather than reporting hooks installed, and cover that state in both local and remote installation results.
  • proposed — Consider a policy for unresolved versions that does not treat failed detection as proof of key support, and separately consider retiring a pre-existing Orca-owned statusLine on a known remote downgrade without enabling remote status-line installation.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 13.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 15 functions across 16 files. (2 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely describes the main change: limiting Claude hook events and statusLine writes to features supported by the user's Claude version.
Description check ✅ Passed The description is detailed and covers the user impact, implementation, rationale, limitations, visual proof, testing, compatibility, and checklist items. It explicitly explains why no issue is linked…
Full details: Docstring Coverage

Explanation

Docstring coverage is 13.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 15 functions across 16 files. (2 skipped: 2 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: f090c7c3-3604-41f6-ad81-c173450b72b6

📥 Commits

Reviewing files that changed from the base of the PR and between 21f8e0f and c371d1f.

📒 Files selected for processing (21)
  • config/tsconfig.cli.json
  • src/main/agent-hooks/managed-agent-hook-controls.test.ts
  • src/main/agent-hooks/managed-agent-hook-controls.ts
  • src/main/agent-hooks/managed-hook-detection-commands.ts
  • src/main/claude/__fixtures__/claude-hook-event-enums.json
  • src/main/claude/claude-hook-event-install.test.ts
  • src/main/claude/claude-hook-event-versions.test.ts
  • src/main/claude/claude-hook-event-versions.ts
  • src/main/claude/claude-managed-hook-events.ts
  • src/main/claude/claude-session-end-hook-capability.test.ts
  • src/main/claude/claude-session-end-hook-capability.ts
  • src/main/claude/claude-session-end-install.test.ts
  • src/main/claude/claude-settings-schema-install.test.ts
  • src/main/claude/claude-status-line-install.test.ts
  • src/main/claude/compact-status-registration.test.ts
  • src/main/claude/hook-service.test.ts
  • src/main/claude/hook-service.ts
  • src/main/claude/hook-settings.ts
  • src/main/qoder/hook-service.test.ts
  • src/main/qoder/hook-service.ts
  • src/relay/managed-hook-installer.ts
💤 Files with no reviewable changes (3)
  • src/main/claude/claude-session-end-hook-capability.test.ts
  • src/main/claude/claude-session-end-install.test.ts
  • src/main/claude/claude-session-end-hook-capability.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.

const missing: string[] = []
let presentCount = 0
for (const event of this.options.events ?? CLAUDE_EVENTS) {
for (const event of this.managedHookPlan(options).install) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Do not report an empty hook plan as installed.

If the resolved version is 1.0.22, every managed event is below its release floor. The loop checks no events, so getStatus reports installed while managedHooksPresent is false. install returns that same misleading status even though it registered no hooks. Return an unsupported or not-installed state when the plan has no install events.

Comment on lines +251 to +255
const nextConfig = applyManagedHooks(
config,
hook,
remoteScriptFileName,
this.managedHookPlan(options)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Apply status-line retirement during remote downgrades.

If a remote settings file contains an Orca-owned statusLine from an earlier install, a downgrade to Claude 1.0.63 selects statusLine: 'retire'. installRemote applies the plan only to hooks and writes the existing statusLine unchanged. The fixture shows that 1.0.63 rejects this key under its strict schema, so it can discard the entire settings file. Apply remote retirement before writing settings. Keep remote status-line installation disabled.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues — one minor suggestion inline.

Reviewed changes

Reviewed the full branch-vs-main diff: the Claude hook install path now gates what Orca writes into ~/.claude/settings.json on the resolved Claude version, so an older Claude no longer discards the whole settings file over an unknown hook event (or, below 1.0.64, Orca's statusLine).

  • Version table — new claude-hook-event-versions.ts holds CLAUDE_HOOK_EVENT_FIRST_VERSIONS (first release whose packed enum contains each event), the 1.0.64 statusLine floor, UNRESOLVED_CLAUDE_VERSION, and the claude --version parse/probe moved verbatim from the deleted claude-session-end-hook-capability.ts.
  • Plan — new claude-managed-hook-events.ts holds the event list plus getClaudeManagedHookPlan(version) returning { install, retire, statusLine }, and fixed plans for OpenClaude and Qoder.
  • Install/status — applyManagedHooks now consumes a plan; install/getStatus/installRemote resolve it from the version, and a downgrade removes only Orca's own entries and its statusLine (with its opt-out marker).
  • Fixtures/tests — the per-release event enums and top-level settings schemas are checked in and pin every table value to the release just before and at the boundary, plus whole-file schema tests for the strict releases.

I independently re-fetched the @anthropic-ai/claude-code npm tarballs and extracted the packed event enum for every boundary pair: all 13 table values and the 1.0.64 statusLine floor are exactly correct (SessionStart 1.0.61→1.0.62, StopFailure 2.1.77→2.1.78, PostCompact 2.1.75→2.1.76, TeammateIdle 2.1.32→2.1.33, SessionEnd 1.0.84→1.0.85, SubagentStart 2.0.42→2.0.43, PermissionRequest 2.0.44→2.0.45, PostToolUseFailure 2.0.55→2.0.56, and the 1.0.x boundaries). statusLine is absent from the 1.0.63 schema and present in 1.0.64. The changed and adjacent suites pass, as do pnpm tc:node and pnpm tc:cli.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

const missing: string[] = []
let presentCount = 0
for (const event of this.options.events ?? CLAUDE_EVENTS) {
for (const event of this.managedHookPlan(options).install) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Settings/CLI read status via MANAGED_AGENT_HOOK_STATUS_READERS, which calls getStatus() with no version, so this loop falls back to the unresolved plan's six core events. That mislabels a complete install on a Claude older than 1.0.62 — e.g. 1.0.52 knows UserPromptSubmit only from 1.0.53 and SessionStart from 1.0.62, so its correct four-event install reads partial, and anything below 1.0.23 reads not_installed, even though install() itself (version-aware) returns installed. Worth confirming this asymmetry is the intended tradeoff versus threading the probed version into the status reader.

Technical details
# Version-less status reader disagrees with the version-aware install

## Affected sites
- `src/main/claude/hook-service.ts:101` — `getStatus()` checks `managedHookPlan(options).install`; with `options = {}` that is the 1.0.64 core set for every caller that cannot supply a version.
- `src/main/agent-hooks/managed-agent-hook-registry.ts:115` — `['claude', () => claudeHookService.getStatus()]`, the Settings/CLI reader, passes no version.

## Required outcome
- Either the status surface and the install agree on what "installed" means for a known-old Claude, or the divergence is documented as intended.

## Open questions for the human
- Is `partial` acceptable for a 1.0.52 user with a complete managed install? If not, the resolved version needs to reach the status reader (probe at status time, or persist the chosen plan/version alongside the marker).

@brennanb2025
brennanb2025 merged commit a84bd1c into main Sep 28, 2026
82 checks passed
brennanb2025 added a commit that referenced this pull request Sep 29, 2026
…3614) into #23059

Conflicts, resolved to keep main's mechanism and #23059's turn facts:
- Codex turn boundaries and translator: main's #23682 wins; the error-driven
  `fail` end and the oversized-notification settler are gone, and only
  `turn/completed` ends a turn, a command's turn included.
- Codex adapter: the compaction tracker stays deleted; #23618's settlement of
  sends in an ended turn is kept, and `codexDispatchRejection` is imported from
  its new home.
- Journal reducer: main's per-item creating fence (#23456) moves into the item
  and submission folds this branch split out of the reducer.
- Stale-turn verdict: main's proof-of-death revision; every turn revision states
  the thread scope.
- Failure words: main's retry-control rules (#23608) with this branch's any-command
  retry step; `commandRefused` drops its retry step beside a Retry, as hostFault does.
- Delivery: both the commit wake and main's death-evidence resettle and dispose.
- Fold row and transcript slots: both the turn-outcome flag and main's `agentId`.
- pr.yml and pnpm-lock.yaml taken from main.

Beyond the conflicts, the merged files needed:
- use-structured-agent-session: both sides added the same `submissions` key; one kept.
- structured-agent-session-projection: the root-item import main still used is unused here.
- The desktop message list and the mobile chat view each grew past the line limit
  from both sides' additions: the turn-membership memo moves into its own hook, and
  the mobile list footer (live status, then waiting rows) into its own helper.
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