Skip to content

fix(agent-status): preserve restored child provenance - #15082

Merged
brennanb2025 merged 3 commits into
mainfrom
brennanb2025/claude-status-restored-provenance
Aug 17, 2026
Merged

brennanb2025 merged 3 commits into
mainfrom
brennanb2025/claude-status-restored-provenance

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​685 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​685
Prod 8 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​196 $\color{#cf222e}{\Huge{\mathbf{−}}}$​30 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​166

ELI5

After Orca restarts, it can restore Claude child-agent state before a live hook confirms that the child still exists. This follow-up keeps that restored provenance intact across local, SSH, relay, and mobile projection paths so stale restored state cannot trigger automation or hide a later live confirmation.

What Changed

  • Preserve restored-unconfirmed provenance through runtime and relay status projections.
  • Persist and reconcile Claude lead boundaries that are held working only by child agents.
  • Clear child-owned permission prompts when the owning subagent or teammate ends.
  • Include restore provenance in the bounded session-tabs invalidation memo.
  • Add focused lifecycle, hydration, mobile projection, SSH, and relay regression coverage.

Why

PR #14375 fixed the primary STA-4144 restart regression. Review of the remaining restore lifecycle found narrow provenance gaps: restored rows could be treated as live for side effects, and an unchanged payload could suppress publication when it transitioned from restored-unconfirmed to live-confirmed. This closes those gaps without adding polling, timers, subprocesses, or a new required wire field.

Linked Issue

Visual Proof

Exact-head Electron/CDP proof is attached in this PR comment. The before/after frames show restored-unconfirmed child state rendering idle without a phantom spinner, followed by the live Done state. Evidence is attached, not committed.

Testing

  • Final SHA: 1,336 focused tests passed across 15 suites; 1 skipped.

  • Full node, CLI, and web typecheck passed.

  • Full lint, reliability, localization, formatting, diff, and max-lines gates passed.

  • Relay bundles passed for Linux x64/arm64, macOS x64/arm64, Windows x64/arm64, and WSL.

  • Exact-head Electron/CDP proof passed at 5b76f0a in an isolated profile; screenshots are attached to the PR.

  • Same-model review loop returned clean in round 4 after three meaningful lifecycle fixes.

  • CI passed all 44 checks, including Node 24/26 shards and Linux/Windows packaging.

  • I manually tested these changes locally

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

Review

Same-model senior review loop completed clean in round 4. Rounds 1-3 found and fixed only proven P1 lifecycle issues: restored side effects/memoization, restored completion context, and OSC preservation across repeated restart; round 4 found no remaining P0/P1/P2 issue.

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

The relay addition is optional and additive for mixed-version compatibility. The diff adds no dependencies, polling, timers, subprocess churn, unbounded structures, or platform-specific paths/commands.

Checklist

  • This PR is small and focused
  • I explained what changed and why (including ELI5)
  • 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)

Author

  • X / Twitter: @BrennanKB5

@coderabbitai

coderabbitai Bot commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 909b35b7-dd77-4452-88cd-375d16c5a0be

📥 Commits

Reviewing files that changed from the base of the PR and between be07b43 and 762fbeb.

📒 Files selected for processing (14)
  • src/main/agent-hooks/hook-status-session-tabs-invalidation.test.ts
  • src/main/agent-hooks/hook-status-session-tabs-invalidation.ts
  • src/main/agent-hooks/server-claude-child-permission-lifecycle.test.ts
  • src/main/agent-hooks/server-last-status-lead-boundary.test.ts
  • src/main/agent-hooks/server.ts
  • src/main/index.ts
  • src/main/runtime/orca-runtime.test.ts
  • src/main/runtime/orca-runtime.ts
  • src/main/ssh/ssh-relay-session-agent-hooks.integration.test.ts
  • src/main/ssh/ssh-relay-session.ts
  • src/relay/agent-hook-envelope-build.ts
  • src/relay/agent-hook-integration.test.ts
  • src/shared/agent-hook-listener.ts
  • src/shared/agent-hook-relay.ts

Included review availability: Your plan includes up to 10 reviews per rolling hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The change persists Claude child-only lead boundaries across restarts and restores lead-turn state from those boundaries. Claude teammate names now pass through local and remote hook relay envelopes. Matching SubagentStop and TeammateIdle events clear child-owned permissions. Restored-unconfirmed statuses now invalidate on confirmation, remain absent from runtime projections, and do not trigger branch renaming or plugin events. Tests cover lifecycle, persistence, relay, permission cleanup, and projection behavior.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 42.86% which is insufficient. The required threshold is 80.00%. 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 identifies the primary change: preserving restored child provenance in agent status handling.
Description check ✅ Passed The description includes the required sections, explains the change and rationale, links the issue, documents proof and testing, and completes the checklist.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • 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.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Exact-head Electron visual proof (5b76f0aa45)

Isolated Orca dev instance from this worktree (sta-4144-phantom-working @ brennanb2025/claude-status-restored-provenance), attached only via Playwright CDP. Worktree was clean at 5b76f0aa45efc97a371a5dbf9a94944ea60e6d60.

Tested flow

  1. Launch this branch in an isolated Electron profile (CDP 9334, renderer 5176).
  2. Confirm app identity matches this worktree/branch.
  3. Add a temporary folder workspace and use the real mounted terminal leaf.
  4. Ingest a restored Claude child row (state: working, restoredUnconfirmed: true, Bash child pnpm run typecheck) through the renderer hook-ingestion path (setAgentStatus / same path as agentStatus:set).
  5. Then ingest a live done update that clears restored provenance.

Visible result

Before — restored child is not live working

01-before-restored-child-idle.png

Workspace card: green idle/active, Fix issues - Claude + child pnpm run typecheck - Bash. Accessibility: both rows Idle. Store: working + restoredUnconfirmed: true. No yellow working spinner.

After — clears to done, no phantom working

02-after-cleared-to-done.png

Workspace + tab show Done (green check on Terminal 1). Row: Fix issues - Typecheck finish…. Child stays Idle. Store: state: done, restoredUnconfirmed cleared.

Limitation

This is not a live Claude session that survived an app-process kill. The isolated profile started empty, and Claude usage refresh returned 429, so a real Claude turn + daemon-surviving restart was not used. Evidence is the user-visible workspace-card/tab contract on the real hook-ingestion path. SSH/relay/mobile projection were not visually exercised.

@brennanb2025
brennanb2025 merged commit 60805f5 into main Aug 17, 2026
45 checks passed
paidaxingyo666 pushed a commit to paidaxingyo666/Manta that referenced this pull request Aug 21, 2026
* fix(agent-status): preserve restored child provenance

* fix(agent-status): preserve restored completion context

* fix(agent-status): retain child boundary across OSC
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
* fix(agent-status): preserve restored child provenance

* fix(agent-status): preserve restored completion context

* fix(agent-status): retain child boundary across OSC
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