Repository navigation
Conversation
When an agent pane runs a nested agent CLI such as codex exec, the child's hooks fire on the inherited pane key. The identity fence already relabels those events as the parent agent, but the child's model passed through and stayed on the parent row after the child exited. Keep the parent's previous model (or none) for events the fence marks as inherited from the active pane.
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. 🧰 Additional context used📚 Code guidelines (1)No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughWhen an agent inherits identity from an active pane, the status update path now omits the incoming model and retains the previous row’s model when available. Added tests cover nested and standalone agent model behavior, including events pushed to the renderer. Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to The change is mergeable after normal checks; no actionable risk to the parent model label remains identified. Security Architecture ReviewSecurity architecture risk: ⚪ Minimal · up to The change preserves the parent session’s display metadata without expanding access, permissions, or network exposure. No material security risk was found in the changed behavior. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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. Comment |
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The focused fix matches the existing identity fence and has comprehensive regression coverage.
Review effort: Balanced
Findings: None
What changed in this PR
Prevents nested agents from overwriting the parent pane’s displayed model.
Changes:
- Preserves the active parent’s model during identity fencing.
- Adds seven regression tests covering nested and legitimate model changes.
| File | Description |
|---|---|
server-status-update.ts |
Fences nested child models. |
server-nested-agent-model.test.ts |
Tests model-fencing behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Host-side model fence for nested children — In
applyNormalizedStatus, when the existing identity fence reportsinheritedFromActivePane, the child'smodelis now stripped and the parent row's prior model is carried forward instead, so a nestedcodex execcan no longer relabel its Claude parent. - Regression tests —
server-nested-agent-model.test.tsadds 7 cases covering model preservation/drop, genuine same-agent model switches, a Codex parent surviving a model-less child, an agent taking over afterdone, and an end-to-end HTTP test asserting no pushed renderer event carries the nested model.
I confirmed the tests actually pin the behavior: all 7 pass with the patch, and 4 of them fail when the source hunk is reverted to base. The fence sits at the same choke point as the existing identity fence, which every ingress path (local hooks, ingestRemote, inference, retries) converges on, so no separate lane needs the same guard.
The PR body already documents the intentional boundaries (same-agent nesting, the 30-minute freshness window, modelSwitchCommand, and the host-side mixed-version limit), so there is nothing left to flag.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
Preserve the parent's model when the existing identity fence retains an active parent for a nested CLI hook. Exercise native SessionStart and Stop bodies alongside model updates and legitimate pane takeovers. Adapted from PR #25687, with real native-hook and hidden renderer proof. Co-authored-by: Regis <[email protected]>
* fix(agent-status): keep nested models off the parent pane Preserve the parent's model when the existing identity fence retains an active parent for a nested CLI hook. Exercise native SessionStart and Stop bodies alongside model updates and legitimate pane takeovers. Adapted from PR #25687, with real native-hook and hidden renderer proof. Co-authored-by: Regis <[email protected]> * chore: record original authorship for Parent-pane model ownership Records the retained adapted contribution from #13602 in replacement PR #26846. Co-authored-by: Brennan Benson <[email protected]> * test: drop redundant single-agent model case --------- Co-authored-by: Regis <[email protected]> Co-authored-by: Brennan Benson <[email protected]> Co-authored-by: m4air <[email protected]>
|
Closing as superseded. #25686 was already closed by #26846; merged #29264 now rejects the entire inherited cross-provider update before it can overwrite the parent's model, prompt, session, children, or freshness. Its regression coverage includes The model tests passed in the final 197-test focused suite. This narrower model-only patch is no longer needed. |

ELI5
A Claude Code session can run another agent inside its own terminal, for example
codex execfor a review. That inner agent reports its own model to Orca on the same pane. Orca already knew to keep calling that pane "Claude", but it took the inner agent's model name anyway. The sidebar and the agent dashboard then labelled the Claude session with the Codex model, and the label stayed there after the inner agent finished. This change keeps the parent's model when the event comes from a nested child.What Changed
Before: a Claude Code pane running Opus showed
gpt-6-astra(the model in~/.codex/config.toml) in its sidebar card and dashboard row after it rancodex exec. It kept showing it until a new model arrived. For Claude that never happens: Orca's Claude hook normalizer emits no model, so later Claude statuses never replace it.After: the Claude row keeps its own model (or none, if it never reported one) while the nested child runs and after it exits. Unchanged: a pane whose own agent changes model, a Codex pane's own model, and a pane whose agent legitimately changes after the previous one is done or stale.
Mechanism: in
src/main/agent-hooks/server/server-status-update.ts,resolveAgentStatusIdentitycan reportinheritedFromActivePane, meaning the event comes from a child on the active parent's pane key. In that case the payload already had itsagentTyperewritten to the parent's. It now also drops the child'smodeland carries the parent row's previous model instead. Nothing else in the payload changes. The fence runs at the same point as the existing identity fence, before the cancel latch and the permission hold.Why
The identity fence was added so a nested CLI cannot take over its parent's row, but the model rode through it. The label is what an operator reads to know which model a session runs, so a wrong one is worse than none.
Alternatives considered:
agentType, and the fields that would identify a child event (source,hookEventName) are not forwarded to the renderer. So a renderer fence keyed on a type mismatch does not fix this path, and the test that exercised it injected a payload the host does not send.This supersedes #13602 by @brennanb2025, which fixed the same leak against the pre-split
src/main/agent-hooks/server.ts. The main-side idea is the same, adapted to the current file layout. Two parts of #13602 are intentionally left out: preserving the model on Claude completion events (a separate, pre-existing behaviour) and the renderer fence (see above).Mixed-version limit: the fix lives in the host. A newer desktop or web client paired with an older runtime host still shows the nested agent's model on the parent row until that host is updated. The older host has already relabelled the event as the parent agent, and it sends nothing the client could use to tell it apart. A desktop app's renderer ships with its own host, so a single install is not affected. Mobile and
orca worktree psread host rows directly and pick up the fix when the host updates.Out of scope, pre-existing: a nested child's
modelSwitchCommandstill passes through. Only the pi-family agents send one, and its consumer applies it to that agent only. Also, the fence applies only where the existing identity fence does: the incoming agent type differs from the parent's, and the parent row is confirmed, not done, and was refreshed within the last 30 minutes. Same-agent nesting (Claude inside Claude) and child events arriving after that window are not covered.Linked Issue
Fixes #25686
Visual Proof
Before, on 1.4.220: a Claude Code session on Opus whose card reads
gpt-6-astra, with Claude Code's own statusline in the same terminal reading Opus. Unrelated text is blurred.After: covered by a host test that posts real Claude and Codex hook bodies through the server and asserts that no status pushed to the renderer carries the nested model. No visual change beyond the label.
Testing
src/main/agent-hooks/server-nested-agent-model.test.ts(new, 7 tests): the parent keeps its model when a nested hook reports one; a parent that never reported a model shows none; a Codex parent keeps its model through a nested model-less hook; a genuine model switch by the pane's own agent still applies; a Codex pane's own model still shows; an agent change after done still takes over; and one test that posts real hook bodies and inspects every event pushed to the renderer. 4 of the 7 fail onmainand pass with this change.pnpm tc, oxlint and oxfmt on the touched files,pnpm run check:code-quality:changed, and the agent-hooks and agent-status test files (1925 passing) all pass.macOS only. Run under Node 26 (the repo pins 24, which I don't have on this machine). I did not run the full
pnpm test,pnpm buildor e2e.I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Assisted by Claude (Anthropic).
Review
Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)