orca/docs
Brennan Benson f238952be2
Agent status over WSL: guest-resident hook relay + WSL-side hook installers (STA-1515) (#7903)
* docs: full design + context for agent status over WSL (STA-1515)

Why hooks don't work on Windows+WSL (loopback transport gap + WSL-side
installation gap), per-client transport map, the OMP-only fixes that
shipped (7642/7641) and why they don't generalize, the recommended
guest-resident relay over wsl.exe stdio mirroring the SSH relay plus
WSL-side hook installers, alternatives considered, validation facts and
gotchas from the 2026-07-08 Windows rig run, and acceptance criteria.

Co-authored-by: Orca <help@stably.ai>

* feat(agent-hooks): agent status over WSL — guest relay + WSL-side hook installers (STA-1515)

Agent hooks have never worked from inside WSL: under default NAT
networking, WSL's 127.0.0.1 is its own loopback, so every hook POST to
the Windows listener dies silently, and hook configs were only ever
written to the Windows home where WSL agents never see them.

Transport: a hooks-only guest relay (src/relay/wsl-agent-hook-relay.ts)
runs inside the distro, binds WSL loopback on the very port the clients
were already given (host-issued token; EADDRINUSE falls back to :0 with
endpoint-file re-coordination, which also covers mirrored networking),
and forwards parsed envelopes over its own wsl.exe stdio into
agentHookServer.ingestRemote — the same shape as the SSH relay. It exits
when stdin closes so a freed Windows port can never be forwarded into a
dead guest listener.

Installation: the unchanged SSH remote hook installers run against an
SFTP-shaped adapter whose primitives are home-scoped fs RPCs served by
the relay, so all 14 managed agents' hooks land in the WSL home over the
already-open channel with zero per-file wsl.exe spawns.

Lifecycle: per-distro manager ensured from buildPtyHostEnv on every WSL
PTY spawn (covers post-restart daemon reattach re-spawns), stale-bundle
reinstall via exit 42, no-node-43 cooldown, bounded retry for wsl.exe
'Catastrophic failure (E_UNEXPECTED)', breadcrumbed failures.

Zero per-client transport changes; listener stays Windows-loopback-only.

Co-authored-by: Orca <help@stably.ai>

* fix(agent-hooks): WSL relay link-death recovery + Codex runtime-home hook install (STA-1515)

Follow-ups from the first Windows-rig validation of PR #7903:

Link death: a mux protocol error or keepalive timeout could kill the
host<->guest link while the guest relay stayed alive returning 204s —
the manager stayed 'running' and every later envelope blackholed
silently (the exact observed signature: Claude hooks POST 204, store
never populates). wsl-hook-relay-link.ts now guarantees exactly-once
death handling from either signal (mux dispose OR child exit); the
manager breadcrumbs it, kills the child, and self-restarts after a
short cooldown since a live agent session produces no new PTY spawns
to re-trigger ensure. ORCA_WSL_HOOK_RELAY_DEBUG=1 traces each received
envelope pre-ingest. A live integration test pins the full host chain:
the real esbuild bundle over real child stdio through the real manager
into a real AgentHookServer.ingestRemote, exact Claude POST shape.

Codex: Orca launches WSL Codex with CODEX_HOME redirected to the
managed runtime home (~/.local/share/orca/codex-runtime-home/home), so
hooks installed to ~/.codex were never read. installRemote now accepts
an explicit codex home (flat layout), threaded from the relay manager;
the config.toml trust write is deferred while the file doesn't exist
(the launch path seeds it only-if-absent — creating it first would
cancel the seed), and the manager re-runs the byte-equality-idempotent
installers on later ensures (30s throttle) to upsert trust once the
seed lands.

Also: WSL test suites now run on Windows dev hosts (fs-backed suites
skip with rig coverage noted; manager suite uses a fixed POSIX home).

Co-authored-by: Orca <help@stably.ai>

* fix(agent-hooks): renderer ownership gate treats wsl:* connection ids as local (STA-1515)

Round-2 rig finding: with the link fixed, WSL hook envelopes reached
ingestRemote and the durable cache, but useIpcEvents.applyAgentStatus
drops any status whose stamped connectionId differs from the owning
repo's — 'wsl:<distro>' !== null for a local repo, so every WSL-relayed
status died before setAgentStatus and notifications.

wsl:* ids are transport provenance, not ownership: the gate now
normalizes them to local via isWslHookRelayConnectionId (shared
contract, also used by the relay link when stamping), while still
rejecting WSL-stamped events against SSH-owned repos. Provenance stays
stamped — it is what made this drop diagnosable.

Co-authored-by: Orca <help@stably.ai>

* fix(agent-hooks): adversarial-review hardening for the WSL hook relay (STA-1515)

Four independent review lenses over the branch; all confirmed findings
fixed before the next rig round:

Endpoint identity (4/4 reviewers): the guest endpoint dir was keyed by
the EPHEMERAL Windows hook port, so a daemon-surviving agent kept
sourcing the dead port-P1 file after an Orca restart — breaking the
restart-resume acceptance criterion and regressing shipped OMP
recovery. Now keyed by a restart-stable instance key (hash of the
Windows endpoint file path, crossed via ORCA_WSL_HOOK_INSTANCE): the
restarted instance's relay rewrites the SAME file, which is exactly
what re-coordinates survivors.

Restart policy: every failure arms the restart timer (one failed
relaunch no longer ends self-recovery), and the timer probes
wsl --list --running first — wsl -d BOOTS a stopped distro, so
recovery must never resurrect a VM the user shut down; stopped-distro
state is dropped instead. Failure counters reset only after 2min of
stable uptime, so connect-then-die loops escalate to the 10-min cap
instead of cycling every 10s. Timer policy extracted to
wsl-hook-relay-recovery.ts with direct tests.

Also: version-namespaced guest install dir (dev+prod instances no
longer reinstall over each other; PID-suffixed tmp files), 30s install
timeout (a wedged wsl.exe could pin the state machine at 'starting'
forever), per-candidate node version probing (apt node 12 on PATH no
longer masks nvm node 20 into a false no-node cooldown), WSL_UTF8=1 +
NUL-stripped stderr (catastrophic-failure matcher survives UTF-16LE),
ordered post-sentinel chunk handoff, port-fallback breadcrumb via the
home handshake, bad home reply now fails the connect, missing-bundle
warn-once, case-normalized distro keys, disposeAll wired to will-quit,
one-shot 60s reinstall timer for single-spawn Codex trust catch-up,
escaped + contract-derived spawn command.

Co-authored-by: Orca <help@stably.ai>

* docs: record round-3 rig validation status for agent status over WSL (STA-1515)

Co-authored-by: Orca <help@stably.ai>

* fix(agent-hooks): round-4 adversarial-review fixes for the WSL hook relay (STA-1515)

- dropState identity race: recovery re-checks state identity after the
  distro-running probe await, and the manager's dropState only deletes the
  exact state it was armed for — an ensure() landing mid-probe can no longer
  have its fresh relay orphaned outside the map.
- Distro-running probe fails CLOSED: a probe error no longer reports
  'running', so recovery can never wsl-d-boot a distro the user shut down.
- Relay spawns use --exec: bypasses the distro's default login shell
  (fish/nushell chsh) and passes argv verbatim, dropping the $-escape shim;
  same form as the Codex WSL login spawn.
- Post-sentinel chunk handoff rides a microtask so an envelope in the
  trailing bytes can no longer dispatch before the link's notification
  handler is registered.
- Guest relay mirrors the SSH relay's uncaughtException/unhandledRejection
  posture.
- Replay cache capped at 256 panes with recency eviction (the WSL relay has
  no per-pane teardown signal); meta map kept in lockstep.
- Launch script derives the stale-exit code from the shared contract
  constant; one-shot reinstall timer refuses to arm after dispose.
- New oracles: sentinel unit suite, fs-bridge scoping suite, fixed-token
  403/204, EADDRINUSE endpoint-file rewrite, cache-cap eviction, and the
  recovery/manager race regressions (verified to fail with fixes reverted).
- Doc: round-4 review section + revised curl.exe stance (kept as the
  no-node fallback — Codex is a native binary; fresh distros ship no node).

* docs: record round-4 pinned rig validation for agent status over WSL (STA-1515)

---------

Co-authored-by: Orca <help@stably.ai>
Co-authored-by: Brennan Benson <brennanbenson@Brennans-MacBook-Pro.local>
2026-07-10 00:19:45 -07:00
..
assets Update README downloads badge 2026-07-10 00:58:53 +00:00
readme Update mobile 0.0.25 Android download links (#7917) 2026-07-09 02:44:52 -07:00
reference perf(ssh): bound relay bulk-stream backlog so PTY echo is not head-of-line blocked (#7601) 2026-07-06 17:10:04 -07:00
STYLEGUIDE.md 1.4.131 rc2 release prep (#8020) 2026-07-09 21:54:22 -07:00
agent-status-over-wsl.md Agent status over WSL: guest-resident hook relay + WSL-side hook installers (STA-1515) (#7903) 2026-07-10 00:19:45 -07:00
android-emulation-streaming.md feat(emulator): Android emulation via scrcpy (cross-platform, iOS parity) (#6434) 2026-06-28 21:01:09 -07:00
android-emulation.md feat(emulator): Android emulation via scrcpy (cross-platform, iOS parity) (#6434) 2026-06-28 21:01:09 -07:00
automations-navigation-stack.md
browser-normal-download-behavior.md Improve built-in browser downloads (#5940) 2026-06-20 16:33:20 -07:00
claude-fable-weekly-usage-meter.md Support Claude weekly Fable usage meter (#7079) 2026-07-02 01:34:44 -07:00
claude-usage-tracking-codexbar-parity.md Improve Claude usage refresh fallback behavior (#5995) 2026-06-21 13:10:25 -07:00
cmd-j-tab-session-search.md Add Cmd-J tab session search (#5775) 2026-06-19 00:27:05 -07:00
compact-worktree-card-setting-graduation.md Graduate compact worktree card setting (#4924) 2026-06-08 17:37:11 -07:00
configurable-open-in-menu.md
delete-workspace-windows-unregistered.md Fix Windows workspace deletion runtime resolution (#5888) 2026-06-20 03:16:29 -07:00
double-tap-modifier-keybindings-design.md feat(shortcuts): double-tap modifier keybindings (#5516) 2026-06-17 18:25:27 -07:00
droid-orchestration-group.md Add Droid orchestration routing (#4624) 2026-06-04 10:00:11 -07:00
failed-automation-rerun-action.md
floating-terminal-panel-position-persistence.md fix: persist floating terminal panel bounds (#3828) 2026-05-30 11:59:19 -07:00
github-tasks-close-reason-parity.md Add GitHub task close reason parity (#6141) 2026-06-23 15:18:46 -07:00
image-viewer-pinch-zoom.md Add image viewer pinch zoom (#3531) 2026-05-31 14:07:15 -07:00
issue-7649-vscode-wsl-launch.md fix(windows): open WSL workspaces in VS Code remote (#7982) 2026-07-09 22:37:40 -04:00
kill-all-sessions-also-kills-empty-terminals.md fix: close terminal tabs when killing all sessions (#8027) 2026-07-09 22:44:12 -07:00
linear-issues-load-more.md Add Linear issue load more (#4437) 2026-06-01 23:35:47 -07:00
linear-scope-selector.md Improve Linear scope selection (#3850) 2026-05-30 12:55:13 -07:00
native-chat-codex-tui-parity.md Polish desktop native chat view (#6641) 2026-06-28 15:43:07 -07:00
orchestration-reset-scope-validation.md
persist-tree-view-source-control.md
refresh-github-issues-after-create.md Refresh GitHub issues after creation (#3018) 2026-05-28 21:14:58 -04:00
remote-web-paste-activity-fixes.md Fix remote paste and workspace activity (#3521) 2026-05-30 03:35:56 -04:00
renderer-memory-profile-2026-06-01.md Handle ANSI redraw controls in terminal previews (#4418) 2026-06-01 16:21:11 -07:00
show-full-tab-title-tooltip.md
source-control-push-failure-ai-recovery.md feat(source-control): add push failure AI recovery (#7826) 2026-07-08 18:59:28 -07:00
ssh-config-target-compatibility.md Improve SSH config target handling (#3899) 2026-05-30 13:10:39 -07:00
ssh-handler-reregistration-port-forwards.md
terminal-close-confirmation.md Refine terminal close confirmation (#5541) 2026-06-16 17:42:48 -07:00
terminal-main-owned-state.md
terminal-scroll-intent-architecture.md Fix terminal scroll intent across workspace switches (#6319) 2026-06-24 20:16:14 -07:00
windows-secure-file-acl-hardening.md fix(windows): stop main-thread PowerShell ACL storm on env-store reads (#5011) 2026-06-09 01:47:29 -07:00
worktree-delete-preflight.md
worktree-sidebar-drag-autoscroll.md Add workspace sidebar drag autoscroll (#3027) 2026-05-28 21:52:08 -07:00