Skip to content

D1b-10: a WSL host never removes the agent hook entries the WSL bridge shares (R42) - #32001

Closed
nwparker wants to merge 2 commits into
nwparker/wsl-mover-d1b-10-telemetryfrom
nwparker/wsl-mover-d1b-10-hooks
Closed

nwparker wants to merge 2 commits into
nwparker/wsl-mover-d1b-10-telemetryfrom
nwparker/wsl-mover-d1b-10-hooks

Conversation

@nwparker

@nwparker nwparker commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​164 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​164
Prod 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​19 $\color{#cf222e}{\Huge{\mathbf{−}}}$​8 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​11

ELI5

During the switch to WSL hosts, two parts of Orca can manage agent hooks in the same Linux home: the old WSL bridge on Windows, and the new Orca server inside the distro. We checked that they don't break each other's hooks. They don't, with one exception. Turning hooks off on the server deleted the hooks the bridge's terminals still use. Now the server leaves them in place, which is what Orca already does at startup.

What Changed

  • Verified: installing from both sides converges. The bridge and the server write the same entry: the same script, ~/.orca/agent-hooks/<agent>-hook.sh, and the same command string. Both recognize it with the same matcher, so each reconcile replaces the other's entry with identical bytes. claude-hook-bridge-host-coexistence.test.ts checks both orders:
    • exactly one Orca entry per event;
    • the user's own hook kept;
    • re-running either side changes nothing.
    • Codex doesn't overlap at all: the bridge writes only into account homes, and the server writes ~/.codex.
  • Fixed, the one clobber:
    • Before: a paired client turning status hooks off on a WSL host (or disabling one agent) made orcad remove the shared entries. The bridge's terminals in that distro then stopped reporting status until the bridge's relay reinstalled, which is rate-limited.
    • Now: applyAgentStatusHooksEnabled takes keepSharedEntries, and the runtime sets it when it runs as a WSL host's orcad (isWslHostOrcadProcess()). Off then means "skip", never "remove".
    • The host's own terminals still stop reporting: its hook server is switched off, and new panes get no hook endpoint.
    • The same rule now covers launching Codex on a managed account home with hooks off, which used to strip the entry from a home the bridge shares.
    • The guard is marked COMPAT(wsl-bridge), to be dropped with the bridge at D4. Until then, a WSL host can't remove these entries; the desktop still removes its own.

Why

  • Startup already never removes hooks, for this exact reason (STA-5679): hook files are shared by every Orca on the machine, but a settings decision reads only one profile.
  • I rejected two alternatives:
    • Giving the bridge and the server separate entries would fire every event twice. Both scripts post to whatever endpoint the pane's environment names.
    • Changing the shared remover list would also change the desktop's own behaviour.
  • The change is limited to orcad inside WSL: SSH hosts and the desktop keep removing as before.

Linked Issue

N/A (internal stack: D1b-10 of the WSL mover; risk row R42)

Visual Proof

N/A: no UI change.

Testing

  • claude-hook-bridge-host-coexistence.test.ts: both orders, idempotent, user hook kept.

  • managed-agent-hook-controls.test.ts: with keepSharedEntries, off and per-agent disable remove nothing.

  • runtime-client-settings-wsl-host-hooks.test.ts: the flag is set only on a WSL host's orcad, both for off and for a per-agent disable.

  • orcad-codex-account-homes.test.ts: on a WSL host with hooks off, the account home is left alone.

  • pnpm tc:node and check:code-quality:changed are clean.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

Review

Before opening, an adversarial reviewer went over this. It found no HIGH issues. Both MEDIUM findings are fixed in bf14b4f15f2f:

  • the Codex account-home remover is now covered too;
  • the guard has an end condition (COMPAT(wsl-bridge), drop at D4).

Left as LOWs:

  • a skipped "off" reports installed statuses (no UI reads them today);
  • the offline CLI orca agent hooks disable run inside a distro can still remove the entries;
  • the coexistence test covers Claude at the hook-builder level only.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • Still open from the R42 row: the real-host check that a Claude session from a bridge tab and one from a host terminal each report exactly once, to the right store. That needs awin (the d1b-10-host agent).
  • Low, follow-up: Cursor's Linux form wraps its command in /bin/sh -c and the bridge's doesn't. Both match, so each side rewrites hooks.json to its own form. There is always one working entry, but the file churns.
  • Low, follow-up: if the Windows desktop and orcad builds differ, Claude's version-dependent event plan can flip between them until both run the same build.

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)

@nwparker
nwparker force-pushed the nwparker/wsl-mover-d1b-10-telemetry branch from 6709a97 to 110a0b5 Compare October 22, 2026 12:26
@nwparker
nwparker force-pushed the nwparker/wsl-mover-d1b-10-hooks branch from bf14b4f to 65a500f Compare October 22, 2026 12:26
@nwparker
nwparker marked this pull request as ready for review October 22, 2026 12:27
@nwparker
nwparker force-pushed the nwparker/wsl-mover-d1b-10-telemetry branch from 110a0b5 to 5770de8 Compare October 22, 2026 12:33
nwparker and others added 2 commits October 22, 2026 05:33
…ff skips too; mark the R42 guard to drop with the bridge

Co-Authored-By: Claude <[email protected]>
@nwparker

Copy link
Copy Markdown
Contributor Author

Contained in the dark landing PR #34059 (its head commit is an ancestor of the landing branch). Closing in favour of it; branch kept.

@nwparker nwparker closed this Oct 26, 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