Skip to content

fix(agent-status): stop nested reviews from collapsing Claude children - #29264

Merged
nwparker merged 3 commits into
mainfrom
nwparker/Claude-Status-Hop-rabbit
Oct 16, 2026
Merged

nwparker merged 3 commits into
mainfrom
nwparker/Claude-Status-Hop-rabbit

Conversation

@nwparker

@nwparker nwparker commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

Claude's sidebar kept expanding and collapsing because Codex reviews launched inside Claude inherited its terminal identity. Each review could replace Claude's status, including its list of 32 children. This keeps the owning Claude status intact while those reviews run.

What Changed

  • Reject another provider's inherited updates while the pane's current owner is active, before normalization changes prompt, tool, or child caches.
  • Apply the same ownership rule at main-process ingestion and existing renderer defenses, scoped to the execution host and workspace using the existing WSL-aware terminal-owner check. Rejected updates neither publish a replacement nor refresh the parent's timestamp.
  • Preserve legitimate child updates and provider changes after the previous owner finishes or becomes stale. Legacy relays isolate each provider's prompt/tool/previous-status caches so they can forward a new provider after desktop-only completion, without cross-provider cache corruption; reconnect and spool replay retain the latest producer row.
  • Use the same monotonic connection clock for ownership and publication after clock rollback. Cover local HTTP hooks, relay forwarding, older relay snapshots, and folder workspace routing.

Why

The existing guard preserved the parent's agent name and model but still accepted the nested provider's working payload. That payload had no Claude children, so the next Claude update restored the list and moved everything below it again. Enforcing ownership in the host's status store fixes every reader; a sidebar debounce would only conceal the corrupted status.

Regression history: #8211 (31cff75a7ba0, “show Claude subagent child rows and gate premature done”) introduced the child rows involved in the visible collapse/reappear symptom. The underlying incomplete ownership rule came from #3990 (2e1ffe0ad96b): it suppressed inherited done events but admitted inherited working events with the parent's name. These are source-history findings; an end-to-end historical bisect was not run.

Linked Issue

User-reported incident in nwparker/SSH, terminal term_a8f6fd07-eeb3-480f-9626-9a5ba11a8320.

Related: #10105 and #22767. These remain open: active-parent corruption is fixed, but completed-parent background hooks still reproduce the broader ownership problem.

Visual Proof

Before — the user's two reported alternating states:

Children present Children disappear
Reported expanded state Reported collapsed state

After — hidden macOS Electron reproduction: actual WorktreeCardAgents, store and hook IPC in a temporary harness. Sent a synthetic Claude 32-child roster through the real authenticated hook endpoint, then 60 nested Codex lifecycle/tool/approval/completion hooks. All 32 children remained; the observed rows had zero DOM mutations and constant scroll height. This is synthetic hook reproduction, not a new model-backed SSH run. Screenshot cropped to the rendered status list.

All 32 children remain after 60 nested hooks

Testing

  • Manually validated the rendered behavior in an isolated hidden macOS Electron app through Playwright CDP; production terminal was not interrupted.
  • Automated tests added/updated: final combined run passed 132 tests across 13 files; the reviewer also ran 58 relay/roster/OpenCode/interrupt tests and 54 Pi/OpenCode normalization tests.
  • ORCA_BACKGROUND_LAUNCH=1 pnpm tc.
  • pnpm run check:code-quality:changed, changed-file oxlint, reliability manifest validation (147 gates), and git diff --check.

Final focused command:

ORCA_BACKGROUND_LAUNCH=1 pnpm exec vitest run --config config/vitest.config.ts src/main/agent-hooks/server-nested-agent-roster.test.ts src/main/agent-hooks/server-nested-agent-boundaries.test.ts src/main/agent-hooks/server-nested-agent-consumers.test.ts src/main/agent-hooks/server-nested-agent-model.test.ts src/main/agent-hooks/server-ingest-remote.test.ts src/main/agent-hooks/server-hook-http-ingest.test.ts src/main/agent-hooks/server-turn-started-at.test.ts src/main/agent-hooks/server-status-listener-fanout.test.ts src/main/agent-hooks/terminal-handle-row-identity.test.ts src/renderer/src/store/slices/agent-status-tool-assistant-fields.test.ts src/renderer/src/store/slices/agent-status-provider-session.test.ts src/renderer/src/store/slices/agent-status-nested-resume.test.ts src/wsl-guest/agent-hook-provider-normalization.test.ts --maxWorkers=2

Live SSH/WSL, Linux, Windows and physical mobile validation remain for follow-up. Relay contracts ran over loopback. The full PR workflow passed on da2fefd6bc2cb569804073abc4578d3b7086c43c, including all five test shards, relay integration, static analysis/typecheck, managed hooks, both package builds and the PR checks passed aggregate. SSH Windows hosts, Headless Node server, Mobile Checks and test-size workflows also passed. CI run.

Review

Final sub-agent review found no remaining blockers after corrections. Sub-agent review identified a relay handoff risk; corrected it with provider-specific normalization caches and HTTP/spool/replay/teardown regression tests. Also corrected monotonic clock ordering and added explicit Pi identity-only replacement controls. CI exposed a cross-host pane-key collision regression; the guard now uses the existing host/workspace owner check, with local HTTP, SSH, WSL transport and legacy unstamped-renderer controls. Reviewed ownership before cache mutation, unchanged parent freshness, legitimate replacement, child completion, and mixed-version relay ingestion. The new experimental gate agent-status.nested-provider-roster records the invariant, evidence, budget, and coverage gaps.

Agent skill upstream boundary

  • Not applicable; no upstream skill-installer material copied or translated.

Related report verification

Completed-parent follow-up: Temporary negative checks on this PR commit confirmed that Claude UserPromptSubmit → Claude Stop (no live children) → nested Codex UserPromptSubmit still selects the Codex session in the mobile builder. The equivalent renderer sequence captures a sleeping resume record with agent: codex and the child session. This follows the pre-existing rule permitting provider replacement after done; distinguishing a foreground idle process from its nested child needs process/session ownership beyond this PR. The negative checks are diagnostic, not part of the passing regression suite. #10105 and #22767 are therefore left open.

Notes

No wire format changes, polling, timers or subprocesses added. Reuses the existing constant-time identity decision. Relay caches are bounded by the existing pane limit per finite provider and cleared on teardown/stop. A nested CLI observed before its owner can still establish initial identity; same-provider nesting retains existing session/process rules.

Checklist

  • This PR is small and focused
  • Explained the user-facing change, mechanism, history, and approach
  • Before/after visual evidence attached
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, folder workspace and compatibility impact considered
  • Full lint, build and test suite pass in CI; focused local checks above passed

@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

📝 Walkthrough

The changes suppress incoming statuses identified as inherited from the active pane when a prior status exists. The server status path checks identity before clearing the prompt-boundary timestamp and can preserve the previous row. Tests cover nested-provider behavior over local and relay transports, stale-status replacement, and renderer events. A reliability gate records the scenario, evidence, and remaining coverage gaps.

Priority: ➖ Normal

Merge Risk: 🟡 Moderate · up to c91b0

Nested-provider updates can still be lost after a desktop-only completion, leaving the pane on an outdated status. Resolve that handoff risk before merging; the Pi resume and clock-rollback paths also need correction.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 9 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed 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 and concisely identifies the primary fix: preventing nested reviews from collapsing Claude child entries.
Description check Passed The description covers the required sections, explains the user impact and mechanism, documents testing and visual proof, and records known validation gaps. It provides related issues, although it doe…
Full details: Docstring Coverage

Explanation

Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 9 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 30757c82-f9a8-4e81-82dc-60f1b767f83c
📥 Commits

Reviewing files that changed from the base of the PR and between e2f2277 and c91b04a.

📒 Files selected for processing: 10
  • config/reliability-gates.jsonc
  • src/main/agent-hooks/server-ingest-remote.test.ts
  • src/main/agent-hooks/server-nested-agent-model.test.ts
  • src/main/agent-hooks/server-nested-agent-roster.test.ts
  • src/main/agent-hooks/server/server-status-update.ts
  • src/renderer/src/hooks/ipc-events/agent-status-event-applicator.ts
  • src/renderer/src/store/slices/agent-status-live-entry-builder.ts
  • src/renderer/src/store/slices/agent-status-tool-assistant-fields.test.ts
  • src/shared/agent-hook-listener.ts
  • src/shared/agent-status-identity.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.

Comment thread src/shared/agent-hook-listener.ts Resolved
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