Skip to content

Agent status C5: tie status reports to the launched agent - #21058

Closed
brennanb2025 wants to merge 8 commits into
mainfrom
brennanb2025/agent-status-c5-run-identity
Closed

brennanb2025 wants to merge 8 commits into
mainfrom
brennanb2025/agent-status-c5-run-identity

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 19 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​477 $\color{#cf222e}{\Huge{\mathbf{−}}}$​42 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​435
Prod 54 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​769 $\color{#cf222e}{\Huge{\mathbf{−}}}$​175 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​594

This draft gives an Orca-launched terminal agent a stable identity tied to the actual process Orca committed or adopted. That identity now travels with status reports across local terminals, WSL, SSH, the daemon, and the relay, and the receiving host checks it against the live execution owner before using it. This is foundation work: it does not change the visible sidebar or tab behavior on its own.

Before / After

Before: a status report mainly identified a pane and workspace. A delayed report, a reused pane, or an inherited environment could be mistaken for the current agent, and later code had to guess from a title, working directory, or pane location.

After: each committed or adopted execution gets one run ID and one exact execution ID from the existing terminal-owner transaction. Managed status integrations carry those IDs, and the host accepts them as identity only when they match the current live owner. Replacement executions get new IDs; adoption keeps the existing IDs; older integrations that omit the IDs can continue updating a row without claiming a new identity.

There is no standalone UI change in this PR. The later combined C5/C10 draft, #21054, builds on this identity to publish that an agent has started before its first status event. Reader migration and the remaining visible fixes still require follow-up work.

Issues

No issue is fully resolved by this foundation.

Partially addressed:

  • STA-4977 / #15639: this PR creates and validates stable internal run/execution identity, but the public agent.status.changed plugin event still does not expose the requested session identifier. The ticket remains open.

Still open and not fixed by this PR:

  • STA-5012 / #15728: false permission status inferred from a working-directory path.
  • STA-5035 / #15776: the workspace indicator depends on title wording.
  • STA-5954 / #17296: the Codex tab icon falls back to Claude while idle.
  • STA-2815 / #11075: Cursor title flicker still needs its own reproduction and presentation fix.
  • STA-2396 / #10039: tmux active-window discovery is not implemented.
  • STA-3192 / #12039: Telegram and cron emitter attribution is not implemented.
  • STA-7392 / #20466: Grok/mobile identity and mobile responsiveness remain unverified and unfixed here.
  • STA-6557: terminal rendering is outside this PR. The original roster contains no linked GitHub issue for this record.

Why this approach

Orca already has one transaction that decides whether a terminal execution was newly created or adopted. Extending that transaction keeps identity tied to the process that actually owns the work and preserves the same decision across native, daemon, WSL, SSH, and relay paths.

The alternatives considered were:

  • adding an ID only to status messages, which would still trust stale or inherited data without proving which process sent it;
  • creating a separate status-owned launch registry, which could disagree with the terminal owner during retries or adoption; and
  • continuing to infer identity from titles, paths, or pane location, which is the source of the multi-agent mix-ups this work is meant to remove.

The chosen mechanism reuses the existing atomic owner decision and treats message IDs as claims to verify, not as proof by themselves. It does not yet prove nested-process ancestry, accumulate provider-reset aliases, discover manually launched/tmux agents, or move every reader away from title/path guesses.

Scope, dependencies, and readiness

  • This is the earlier C5 foundation. #21054 contains overlapping C5 work plus C10 launch membership; do not merge both independently.
  • C10 consumes this execution identity for committed-launch membership. Later host-store and reader work must use it before title/path inference can be removed safely.
  • Mixed-version peers remain supported: missing identity fields do not invent a replacement identity, and the merge with current main preserves its single legacy-status admission boundary and structured-session store.
  • Nested emitter proof, provider reset/alias history, manual and tmux discovery, public plugin identity, consumer cutover, and the listed user-visible bugs remain open.

Draft / not merge-ready. This PR was opened before final review and QA at the user's request. Earlier implementation and review reports are revision-specific; the combined C5/C10 reviewer was interrupted, and conflict resolution is not a substitute for independent review. No fresh Electron or mobile UI QA was run because this PR has no standalone UI behavior to exercise.

Checks on 38ad6da2d6

  • Merged origin/main at 383c543e0f6651a6c2d99ecca5ab43fbedd1bee8; resolved conflicts in the hook-server listener, state, and status-update layers.
  • ORCA_BACKGROUND_LAUNCH=1 pnpm test for the execution-binding, terminal-ingest, structured-status, canonical-store, and legacy-adapter suites: 5 files, 46 tests passed.
  • Legacy-ingress ratchet: 1 file, 14 tests passed.
  • ORCA_BACKGROUND_LAUNCH=1 pnpm tc:node: passed.
  • Direct lint of all TypeScript/JavaScript files changed from current main: passed. The repository changed-code wrapper was also run, but its old ffc331212c38 comparison baseline scanned 1,521 intervening upstream files and reported 17 unrelated findings; none were in this PR's diff.
  • git diff --check and conflict-marker checks: passed.

Remaining validation gap: final independent architecture review and exact-head Electron/host-path QA have not been completed. Native, daemon, WSL, direct SSH, relay, owner-promotion races, nested agents, and stale replay after pane reuse still need final end-to-end coverage before this draft can be marked ready.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Review and validation handoff — 2026-09-16

Draft / not merge-ready. Published at the user's request before review/QA completion. Published head: 14c05c38d724ee8ad8400f9cd0033546f0dd7047.

What has been done

Independent review-and-fix added binding propagation, claim validation and regression coverage; focused suites, node typecheck and changed-code quality were reported passing. That report explicitly left ancestry, reset/alias and production admission work incomplete.

These are recorded worker/reviewer results from the stated revisions, not a fresh coordinator rerun, CI result, or blanket approval of today's PR head. Recovery/review workers used GPT-5.6 Sol xhigh; provider interruptions prevented some follow-up stages from finishing.

What still needs to be done

This is the earlier C5 foundation, not the latest full identity solution. Later recovery is included in the C10 combined C5/C10 PR: do not merge overlapping implementations independently. Nested emitter proof, verified manual/discovered subjects, alias/reset lifecycle and consumer integration require review against that combined candidate. Fresh exact-head Electron QA is outstanding.

Before marking ready: address proven findings, reconcile current main and cross-batch overlap, complete independent review of the final diff, rerun relevant tests/typechecks/quality, and perform fresh manual Electron QA against that exact head. Use background/hidden CDP validation; unavailable auth/platform scenarios remain explicitly unverified. No successful final-head review or QA should be inferred from old report filenames or task completion labels.

Later combined candidate: #21054. This PR preserves the earlier foundation for review; do not merge both independently.

Related batch PRs

C1: #21053 · C10: #21054 · C2: #21056 · C3: #21055 · C4: #21057 · C5: #21058 · C6: #21059 · C7: #21060

The remaining full-batch work stays open; opening this draft does not mark those requirements complete.

…atus-c5-run-identity

# Conflicts:
#	src/main/agent-hooks/server/server-listeners.ts
#	src/main/agent-hooks/server/server-state.ts
#	src/main/agent-hooks/server/server-status-update.ts
@brennanb2025 brennanb2025 changed the title Agent status C5: run identity and emitter attribution foundation Agent status C5: tie status reports to the launched agent Sep 16, 2026
@brennanb2025

Copy link
Copy Markdown
Contributor Author

Conflict-resolution update

  • New head: 38ad6da2d6cb81defae4a607c4d361a917c305ec
  • Integrated upstream: origin/main at 383c543e0f6651a6c2d99ecca5ab43fbedd1bee8
  • Conflicts: server-listeners.ts, server-state.ts, and server-status-update.ts. The resolution keeps main's structured-session store, combined replay/fanout, and single legacy-status admission boundary; it also keeps C5's live-owner binding resolver. Incoming identity is resolved and verified before the row is written, while replacement cleanup now goes through main's legacy-store adapter instead of mutating its read-only view.
  • Rerun: 5 focused files / 46 tests passed; legacy-ingress ratchet 14 tests passed; node typecheck passed; direct lint of the PR's changed TypeScript/JavaScript files passed; diff/check-marker checks passed.
  • Quality-wrapper note: check:code-quality:changed still compares with the older ffc331212c38 baseline, so after the main merge it scanned 1,521 upstream-changed files and reported 17 findings outside this PR diff.

Remaining blockers are unchanged: this is a draft foundation with no standalone visible fix, it overlaps #21054 and should not be merged independently from it, and it still needs independent final review plus exact-head host-path QA. Nested emitter proof, provider alias/reset history, manual/tmux discovery, public plugin identity, reader cutover, and the linked user-visible tickets remain open.

Splits the execution-binding contract out of `agent-status-run.ts` into
`agent-status-execution-binding.ts`. The ownership layer only needs run and
attachment identity; the provider-alias half of a run record needs the hook wire
envelope, which imports `node:crypto`. Binding `statusBinding` onto
`AgentSessionOwnerBinding` therefore pulled that dependency into the renderer
graph and broke the renderer node-builtin boundary. The two modules also had a
type-level import cycle, which the split removes.

Renames the new hook-server claim resolver to `resolveReportedExecutionBinding`.
`resolveAgentStatusBinding` already names the single pane-key-to-terminal-identity
lookup that the snapshot pull and fleet paths share, and the agent-status producer
census pins that name; a second export under the same name both collided with that
invariant and tripped the census.

Drops the two batch report files from the repo root, which the root-directory
guard rejects, and re-pins the OpenCode plugin byte digests for the two identity
fields now added to the plugin's POST body.
The claimed execution owner binding crosses the daemon, SSH and relay boundaries,
and the two protocol constants that gate it live in `agent-session-host-authority`
and `daemon-protocol-version`. Neither path was in the cross-version lane's prefix
list, so a change that adds a required field to the owner binding and raises both
protocol versions classified as `cross-version-wire=false` and skipped the lane
entirely.

Verified with the classifier directly: this branch's changed paths now report
`cross-version-wire=true`, an unrelated renderer file still reports `false`.

The lane's existing journeys cover structured agent sessions rather than the PTY
owner binding, so this restores the trigger, not coverage of the owner binding
itself.
…ion gate

An owner from a host that predates run identity is still a valid owner. Requiring
`statusBinding` on `AgentSessionOwnerBinding` made `isAgentSessionOwnerBinding`
reject those owners, and `validatedAgentSessionOwners` throws on any owner that
fails it. That call is unconditional in `listProcesses`/`listSessions`, and the
daemon router fails closed across every adapter including preserved legacy ones,
so a single surviving older daemon holding one claimed owner would have rejected
the whole process inventory for every terminal on the machine — the inventory
destructive teardown consults.

The field is now optional and absence reads as "identity unknown", which is the
second-class tier this design always required for agents Orca did not launch and
agents behind a multiplexer. A fresh create keeps this host's binding, because this
host minted it and stamped it into the spawn env before the lower host ran; an
adopted owner reports whatever the lower host actually holds, including nothing.
That removes the reason for the version gate, so the daemon protocol and execution
owner protocol constants go back to 36 and 2.

Also in this commit, from review:

- An unresolvable emitter claim now costs the claim, not the status transition. The
  owner registry is empty for every pane this process did not launch — after a
  restart, once the PTY exits, and for every spooled event replayed from a window
  when Orca was down — so suppressing the report latched the row on whatever it last
  said, with nothing re-deriving it. Identity fails closed; the state machine does not.
- Run identity is no longer persisted or hydrated. It is issued by the owner registry,
  so a hydrated copy read as host-verified with nothing left to verify it against.
  This matches the same writer's existing treatment of terminal handles.
- The owner authority gate now tests what the lower host returned. It compared the
  locally built owner against the request, which compares a literal with itself, so it
  could not throw and left the daemon create path unchecked. Promotion moves to its
  own module so the reservation bookkeeping and the authority decision read separately.
- The claim resolver no longer requires the POST route to agree. The route is the
  weakest evidence on the event and is exactly what a replayed vendor hook forges;
  conditioning on it rejected the correct owner precisely when the route lied.
- The SSH ingest allowlist now forwards the emitter's claim, parsed at that trust
  boundary. It was dropped there, so every SSH-hosted agent published rows with no
  identity while the relay was already putting the claim on the wire.
- `continuityOf` is re-read after the awaited liveness probe so a concurrent
  replacement continues the lineage instead of forking it.
…one list

Three boundary defects found in review.

`ingestRemote` took `reportedExecutionBinding` straight off the envelope while
re-validating every sibling field, and the WSL relay reaches that function with a
raw wire cast. A malformed value could not mint identity, but it was truthy and
non-matching, which is enough to affect how the report is treated. It is parsed
now, at the boundary that already exists for this purpose.

The daemon kept its own copy of the pane-identity scrub list and did not gain the
two new variables, so a pane that did not request them could inherit them from the
daemon's environment while the local provider correctly scrubbed them. Both spawn
paths now read one shared list, which is what stops the next key from being added
to one and not the other.

Also merges a duplicate import in the new promotion module that the focused
code-quality gate rejects.
@brennanb2025

Copy link
Copy Markdown
Contributor Author

Closing this draft from the September 14 agent-status plan. That plan was re-examined against current main and replaced.

This branch conflicts with main, and its central work duplicated contracts that had already merged (the canonical status store and the child-work contract landed on 15–16 September). The replacement work is being done as smaller root-cause PRs, each planned, challenged and reviewed first.

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