Skip to content

feat(agent-status): run-identity types for keying rows by agent instead of pane - #20531

Merged
brennanb2025 merged 3 commits into
mainfrom
brennanb2025/pr1-agent-status-types
Sep 14, 2026
Merged

brennanb2025 merged 3 commits into
mainfrom
brennanb2025/pr1-agent-status-types

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​535 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​535
Prod 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​770 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​770

ELI5

Agent status rows are currently identified by the pane they sit in. Panes get reused — kill an agent,
start another in the same tab, and the new one can inherit the old one's row. This adds the types for
identifying a row by the agent instead: an Orca-minted run id, with the provider's own session id
kept alongside as a label.

Types only. Nothing uses them yet; no behavior changes.

Why a run id, and not Claude's/Codex's own id

Measured, with raw transcripts retained:

  • Typing /clear makes Claude discard its session id and mint a new one — same process, new name.
  • Two concurrent claude --resume <same id> executions both report that id, in one transcript,
    on divergent branches. So a provider id does not even reliably name one live agent.
  • Codex is the opposite: a concurrent duplicate resume is refused outright
    (thread-store conflict: already has an active writer).

The two providers disagree about what their own ids mean, and neither guarantee is contractual. So the
identity is ours; the provider id is a correlation used for resume.

What changed — 9 new files, additive only

  • Scoped subjects: pty-run (canonical), pty (fallback for rows with no run identity), and
    structured-session (unchanged semantics).
  • Run id, execution attachment, and provider alias types.
  • The alias index is Map<AliasKey, Set<RunId>> — a set, not a single value. This cardinality is
    forced by the concurrent-resume measurement above: one provider tuple can have several live runs. A
    single-valued alias would be silently wrong on exactly that case, so please don't simplify it. It is
    pinned by a test named for the behavior.
  • Capability codecs. agent-status-ipc-payload.ts gains optional runId / executionId /
    providerAlias fields.

Explicitly out of scope

  • No store migration, no producer change, no reader change.
  • The unified subagent/child row type is deliberately absent. It is still under design review;
    existing AgentSubagentSnapshot / subagentObservation shapes are untouched.

Verification

  • pnpm tc — clean (run independently by the coordinator).

  • 57 tests across the four new suites, including the collision matrix, deterministic serialization
    regardless of insertion order, refusal to serialize an empty alias set, and the duplicate-tuple case.

  • pnpm run check:code-quality:changed — passed. oxfmt --check — clean.

  • pnpm-lock.yaml unchanged across the branch (merge-base range form).

  • Ablation at the final head: with the five production files reverted, all four suites fail; restored,
    57 pass; all-files-reverted arm passes 55.

    Honest caveat on that ablation: these are brand-new modules, so reverting them makes the suites
    fail to import. That proves the tests exercise the new code, but it is the weakest form of
    ablation — there is no prior behavior to ablate against in a types-only change. The real test of
    these types is the PR that consumes them.

What a reviewer should look at first

agent-status-ipc-payload.ts. It is the file that actually crosses the client/host boundary, and
mixed client/host versions are the normal state. The new fields are optional and old peers ignore
unknown JSON — but "optional field" is only safe while readers genuinely fall back, so that is the
claim worth checking rather than taking.

Second: whether the subject/alias key shapes are the ones you want frozen, since later PRs build on
them.

@coderabbitai

coderabbitai Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: e9bdd9d7-e475-4031-b773-5efbdf068d71

📥 Commits

Reviewing files that changed from the base of the PR and between 6fdb587 and 50c30e2.

📒 Files selected for processing (9)
  • src/shared/agent-status-ipc-payload.ts
  • src/shared/agent-status-run-alias-index.test.ts
  • src/shared/agent-status-run-alias-index.ts
  • src/shared/agent-status-run-capability.test.ts
  • src/shared/agent-status-run-capability.ts
  • src/shared/agent-status-run.test.ts
  • src/shared/agent-status-run.ts
  • src/shared/agent-status-subject.test.ts
  • src/shared/agent-status-subject.ts
💤 Files with no reviewable changes (1)
  • src/shared/agent-status-ipc-payload.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 1 remains after this review.


📝 Walkthrough

Walkthrough

The change adds shared agent-status contracts for execution scopes, PTY runs, provider aliases, capabilities, and subject identities. It adds strict parsers, constructors, canonical serializers, deserializers, equality checks, and bounded validation. It adds a deterministic run-alias index codec with duplicate and size checks. It extends IPC payloads with optional run-aware fields. New tests cover valid round trips and malformed inputs.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 50c30

The new shared identity contracts include validation, serialization, and malformed-input coverage without an established compatibility or runtime failure. The change is ready to merge.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the purpose, design, scope, and verification results. However, it omits several required template sections and checklist items, including the mandatory Linked Issue, explicit … Add all required template sections. Provide a valid issue reference under Linked Issue, write N/A with a reason under Visual Proof if no UI or interaction changes exist, complete the Testing checklist, address AI Disclosure as applicable,…
Docstring Coverage ⚠️ Warning Docstring coverage is 9.30% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 43 functions across 9 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: adding agent-status run-identity types so rows can use agent identity instead of pane identity.
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.
Full details: Description check

Explanation

The description explains the purpose, design, scope, and verification results. However, it omits several required template sections and checklist items, including the mandatory Linked Issue, explicit Visual Proof response, Testing checklist, Review, Agent skill upstream boundary, Notes, and final Checklist.

Resolution

Add all required template sections. Provide a valid issue reference under Linked Issue, write N/A with a reason under Visual Proof if no UI or interaction changes exist, complete the Testing checklist, address AI Disclosure as applicable, complete Review, Agent skill upstream boundary, Notes, and Checklist items.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch

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: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: d67c025b-9d1c-4ec1-a5b3-1c376e392d5c

📥 Commits

Reviewing files that changed from the base of the PR and between 5e70014 and 6fdb587.

📒 Files selected for processing (9)
  • src/shared/agent-status-ipc-payload.ts
  • src/shared/agent-status-run-alias-index.test.ts
  • src/shared/agent-status-run-alias-index.ts
  • src/shared/agent-status-run-capability.test.ts
  • src/shared/agent-status-run-capability.ts
  • src/shared/agent-status-run.test.ts
  • src/shared/agent-status-run.ts
  • src/shared/agent-status-subject.test.ts
  • src/shared/agent-status-subject.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 4 remain after this review.

@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.

ℹ️ Minor suggestions only.

Reviewed changes

  • Run identity codecs (agent-status-run.ts) — AgentStatusRunId / AgentStatusExecutionId, a provider alias, and an ordered provider-session chain with a resetBoundary marker, all behind strict hasExactKeys parse/serialize.
  • Scoped subject keys (agent-status-subject.ts) — versioned agent-status-subject-v1: keys for the canonical pty-run, the pty pane fallback, and structured-session, over AgentSessionExecutionLocation.
  • Provider alias index (agent-status-run-alias-index.ts) — Map<AliasKey, Set<RunId>> with bounded, deterministic serialization that refuses an empty run-id set.
  • Capability codec (agent-status-run-capability.ts) — encode/decode for agent-status.runs.v1, deliberately not advertised in RUNTIME_CAPABILITIES.
  • IPC payload fields (agent-status-ipc-payload.ts) — optional runId / executionId / providerAlias / revision added for later producers; no reader reads them yet.
  • Tests — four new suites (57 tests) pin round-trips, the rejection matrices, collision isolation across scope/provider/session-key-kind, and insertion-order-independent serialization.

I independently confirmed the mixed-version claim you asked reviewers to check: nothing in the tree decodes AgentStatusIpcPayload with exact keys or a strict schema — consumers either read named fields (normalizeAgentStatusObject) or spread (enrichAgentStatusIpcPayload, toAgentStatusIpcPayload), and the payload never crosses the mobile/relay wire (that carries AgentStatusEntry). The new fields are inert and safe to drop.

ℹ️ Run-scoped provider chain vs. the existing durable session chain

The new AgentStatusProviderSession[] is an ordered, provider-keyed history with reset-boundary evidence. agent-session-provider-handle.ts already owns an ordered, provider-keyed history (AgentSessionProviderHandleChain, with origin: created | adopted | resumed | forked and forkedFromKey). They plausibly serve different lifetimes — run evidence versus the durable session record — but both are being frozen now and a later PR that projects run evidence onto a durable session will have to reconcile them.

Technical details
# Run-scoped provider chain vs. durable session chain

## Affected sites
- `src/shared/agent-status-run.ts:26` — `AgentStatusProviderSession` (`resetBoundary`)
- `src/shared/agent-session-provider-handle.ts:25` — `AgentSessionProviderHandleLink` (`origin`, `forkedFromKey`)

## Open questions for the human
- Are these intentionally two representations, or should one be expressed in terms of the other?
- If a run's provider session is attached to a durable session record, which chain is authoritative for resume identity?

ℹ️ Nitpicks

  • agent-status-subject.test.ts:60 names a case "keeps the existing structured-session encoding byte-for-byte stable", but no prior encoder for this key exists in the tree — it pins a brand-new format. Reword if the intent is just forward-stability.
  • serializeAgentStatusProviderAliasKey / the alias index re-parse every key on write. Correct, but if these ever run on the hot status path, keep the parse-once assumption in mind.

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

Comment thread src/shared/agent-status-ipc-payload.ts Resolved
Comment thread src/shared/agent-status-subject.ts Resolved
@brennanb2025

Copy link
Copy Markdown
Contributor Author

Electron smoke evidence (PR #20531)

Isolated ORCA_BACKGROUND_LAUNCH=1 Playwright CDP smoke of worktree HEAD 0a475fe31a7ad440f01e67c37188f610e74d9ca9 (brennanb2025/pr1-agent-status-types). This PR is types/codecs/tests-only; no UI behavior change was expected.

Identity (window.api.app.getIdentity()):

{"name":"Orca: brennanb2025/pr1-agent-status-types","isDev":true,"devLabel":"pr1-agent-status-types","devBranch":"brennanb2025/pr1-agent-status-types","devWorktreeName":"pr1-agent-status-types","devRepoRoot":"/Users/brennanbenson/orca/workspaces/orca/pr1-agent-status-types","dockBadgeLabel":null}

Rendered state: full window launched and painted. Isolated empty profile shows the healthy first-run home: sidebar, "No workspaces found", "Add a project to get started.", right explorer "Select a workspace to browse files", status bar. Console: 0 errors, 3 pre-existing dev warnings (Radix tooltip controlled/uncontrolled, React Grab outdated). Daemon log: startup/ready, no crash. Main traces: renderer_bootstrap_rendered success.

orca-pr20531-full-window.png

@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 new issues found.

Reviewed changes

Reviewed the delta since the prior pullfrog review (6fdb587 → 0a475fe), a hardening pass on the run-identity codecs. Both prior review threads are addressed: the ambiguous top-level revision field was removed, and the subject module now shares isAgentStatusRunId / AgentStatusRunId with the run module.

  • Canonical alias-key decoding — deserializeAgentStatusProviderAliasKey now round-trips the parsed alias back through the serializer and rejects any spelling that is not byte-canonical, which also closes the "split semantic duplicate" gap in the alias index.
  • Alias-index resource bounds — an aggregate run-reference cap (16_384), a serialized-byte cap (4 MiB), and JSON structure limits (64K tokens / depth 3) are enforced on both serialize and deserialize, with the byte and structure checks running before JSON.parse.
  • Execution-scope canonicalization — parseExecutionScope requires the encoded host id to equal its canonical toSshExecutionHostId / toRuntimeExecutionHostId form, and rejects a non-null wslDistro on a non-local host.
  • Provider-chain consistency — a run's providerSessions chain must now be single-provider.
  • Capability limit — MAX_CAPABILITIES raised 64 → 256, with a test that the run capability is found in an inventory containing it.

Verified locally: the four suites pass (73 tests, up from 57) and pnpm tc is clean. Nothing in production imports the new modules yet (only a type-only import in agent-status-ipc-payload.ts), so there is still no runtime behavior change.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@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 new issues found.

Reviewed changes

The only commit since the prior pullfrog review is a merge of origin/main into the branch. The PR's own diff is byte-identical to the reviewed 0a475fe content — all nine per-file diff hashes are unchanged — so no new run-identity code was introduced. Re-ran the four suites (73 tests) and pnpm tc at the merge head; both are clean, so the merge did not disturb these modules.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Final-head Electron smoke (PR #20531) — 50c30e2d83

Isolated ORCA_BACKGROUND_LAUNCH=1 Playwright CDP smoke of final worktree HEAD 50c30e2d830e96a4a4712271e8583e6819663c22 (brennanb2025/pr1-agent-status-types, merge of origin/main). This PR remains types/codecs/tests-only; no UI behavior change was expected.

Identity (window.api.app.getIdentity()), proving this exact worktree instance:

{"name":"Orca: brennanb2025/pr1-agent-status-types","isDev":true,"devLabel":"pr1-agent-status-types","devBranch":"brennanb2025/pr1-agent-status-types","devWorktreeName":"pr1-agent-status-types","devRepoRoot":"/Users/brennanbenson/orca/workspaces/orca/pr1-agent-status-types","dockBadgeLabel":null}

Launch: CDP 127.0.0.1:9334, renderer 127.0.0.1:5174, isolated profile. Wrapper logged [orca-dev] Instance: pr1-agent-status-types and Background launch: window stays off screen.

Rendered state: uncropped full-window screenshot (1728×994). Isolated empty profile shows the healthy first-run home: sidebar, "No workspaces found", ORCA logo, "Add a project to get started.", Add project / Create workspace, right explorer "Select a workspace to browse files", status bar. Store: activeWorktreeId=null, repoCount=0.

Console / logs: renderer console 0 errors, 3 pre-existing dev warnings (Radix tooltip controlled/uncontrolled, React Grab outdated). Daemon log: startup → ready, no crash. Main traces: renderer_bootstrap_rendered Success. Expected non-fatal: MaxListenersExceededWarning on BrowserWindow closed; ws-transport EADDRINUSE on 6769 (other local instance) with OS-assigned fallback.

orca-pr20531-final-head-50c30e2d83-full-window.png

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Final review status

Verdict: the PR-owned code is clean and ready within its declared types/codecs scope. The branch is at 50c30e2d830e96a4a4712271e8583e6819663c22, is pushed, and the worktree is clean.

Review and fixes

Iterative adversarial review plus opening/final readiness audits found and fixed the meaningful issues:

  • canonical alias keys and execution-host IDs are enforced;
  • PTY-run subjects use the shared validated run-ID type;
  • provider-session chains cannot cross providers;
  • alias-index decoding is bounded by structure, references, and UTF-8 bytes;
  • the unsafe epochless top-level revision was removed;
  • WSL/SSH/runtime/folder/worktree scopes remain explicit and fail closed;
  • the capability envelope now accommodates the current runtime inventory.

The final review and final readiness audit report no P0, P1, or P2 findings. No unrelated product scope was added.

Validation

  • 73 focused tests passed on the final merged head.
  • Typecheck passed locally and in CI.
  • Changed-code quality and diff checks passed.
  • All 8 CI test shards passed.
  • Linux package and Windows package jobs passed.
  • Final-head Electron smoke passed using an isolated background instance and Playwright CDP: exact worktree identity matched, the full app rendered, console errors were 0, daemon/main traces were healthy, and owned processes were cleaned up.
  • Final-head Electron evidence and screenshot

Performance/resource review is clean: no polling, timers, listeners, subprocesses, render paths, or caches were added, and decode work is bounded before allocation. Compatibility review is also clean: IPC additions are optional and not yet advertised or emitted; there is no mobile-facing, persisted-state, handshake, or runtime behavior change, and the shared logic is platform/provider neutral.

Current CI status

The PR Checks run is red only because static analysis sees three vitest(no-conditional-tests) warnings introduced on current main in unrelated mobile RPC recording tests:

  • mobile/src/test-support/rpc-recording/family-recordings.test.ts:126
  • mobile/src/test-support/rpc-recording/pilot-recordings.test.ts:107
  • mobile/src/test-support/rpc-recording/pilot-recordings.test.ts:121

Those files are not part of this PR delta. The dependent verify job is red solely because that static-analysis job is red. I left them untouched to avoid expanding this PR into unrelated mobile test cleanup.

Merge action: no PR-owned code changes remain. The external main lint regression must be fixed (or incorporated through a later base update) before the required CI gate can become green.

Residual scope note: this PR intentionally defines the run-identity contracts only; pane-reuse behavior itself will change when the separate producer/store/reader migration consumes them.

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