You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(agent-hooks): preserve Antigravity pane ownership across nested subagents - #37507
Capture ORCA_HOOK_AGENT_PID (PPID) and agentProcess in the POSIX antigravity-hook.sh script and admit antigravity in readHookAgentProcess so idle Antigravity process owners reject nested guest CLI hooks at the server/relay layer.
Include paneOwner ({ agent, session }) on AgentStatusEntry and mobile runtime status projections whenever a session-bound pane owner (agentPresence.session) is active.
Suppress nested guest CLI hooks (such as a background grok subagent spawned from agy) in isInheritedFromActivePane and buildAgentStatusLiveEntry when paneOwner or live foreground process evidence still belongs to the parent pane owner (even after the parent turn completes or exceeds the 5-minute active-turn window), unless foreground process evidence shows the pane returned to the shell or switched to another process-read agent.
Resolve effectiveAgentStatusOwnerType(entry) (entry.paneOwner?.agent ?? entry.agentType) across desktop tab-bar/pane selectors, session-resume records, AI vault title candidates, and mobile tab/native-chat eligibility so an Antigravity terminal tab never flips its icon to Grok or switches from Agy Terminal View into Grok Chat View.
Added unit tests in src/main/agent-hooks/server-idle-process-owner.test.ts verifying idle antigravity process owners reject nested grok hooks.
Added unit tests in src/renderer/src/store/slices/agent-status-pane-owner-reclaim.test.ts verifying nested grok hooks are suppressed when antigravity is the paneOwner after turn completion and allowed once foreground returns to shell.
Added unit tests in src/renderer/src/components/tab-bar/tab-agent-types-by-tab-id.test.ts, src/renderer/src/components/terminal-pane/terminal-tab-agent-type-index.test.ts, mobile/src/session/native-chat/mobile-native-chat-eligibility.test.ts, and mobile/src/session/mobile-terminal-tab-agent.test.ts.
…ubagents
- Capture ORCA_HOOK_AGENT_PID/PPID and agentProcess in POSIX antigravity-hook.sh and admit antigravity in readHookAgentProcess so idle Antigravity process owners block nested CLI hooks
- Propagate paneOwner ({ agent, session }) on AgentStatusEntry and mobile status projections when a session-bound root owner is active
- Suppress nested guest CLI hooks (e.g. background grok subagent) in renderer status routing and live entry builder while paneOwner or foreground process remains on the parent owner
- Resolve effectiveAgentStatusOwnerType (paneOwner.agent ?? agentType) in desktop/mobile tab selectors and native-chat eligibility so an Antigravity terminal never flips to Grok Chat View
Fixesstablyai#37505
No actionable comments were generated in the recent review.
Walkthrough
The changes add pane-owner agent and session identity to agent status and carry it through runtime projections and renderer state. Renderer and mobile consumers prefer the pane owner when resolving an agent. Nested guest provider sessions are excluded from Native Chat resolution in the covered cases, while resume and title-request paths can derive session metadata from the owner session. Antigravity hooks also capture and send process identity. Tests cover owner retention and consumer resolution.
Severity of issue fixed: Medium
Merge Risk: Minimal · up to fd96e
The reviewed ownership and session paths show no remaining actionable merge risk beyond normal checks.
Pre-merge checks: 3 · 2
Failed checks: 2 warnings
Check name
Status
Explanation
Resolution
Description check
The description explains the implementation and lists tests, but it does not follow the required template. It omits or replaces major sections including ELI5, What Changed, Why, Visual Proof, Risk, No…
Rewrite the description using the required headings. Add a plain-language ELI5 summary, separate What Changed and Why sections, complete Linked Issue and Visual Proof with N/A plus a reason if applicable, document Testing and platforms, sta…
Docstring Coverage
Docstring coverage is 35.48% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta…
Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed checks: 3 passed
Check name
Status
Explanation
Title check
The title clearly and concisely describes the primary change: preserving Antigravity pane ownership across nested subagents.
Linked Issues check
Issue [#37505] requires Antigravity pane ownership to survive nested CLI hooks until the pane returns to the shell or switches to another foreground agent. The changes capture ORCA_HOOK_AGENT_PID an…
Out of Scope Changes check
The changed files support issue [#37505]. They preserve pane-owner data, reject or accept nested hooks based on foreground evidence, retain resume identity, and prevent incorrect desktop or mobile age…
Full details: Linked Issues check
Explanation
Issue [#37505] requires Antigravity pane ownership to survive nested CLI hooks until the pane returns to the shell or switches to another foreground agent. The changes capture ORCA_HOOK_AGENT_PID and agentProcess, admit antigravity as a hook process, carry paneOwner through IPC, runtime, renderer, resume, and mobile projections, suppress conflicting nested status updates, and use effectiveAgentStatusOwnerType in desktop and mobile selectors. The tests cover idle process ownership, post-completion nested Grok hooks, foreground release, tab identity, terminal identity, and mobile Native Chat eligibility.
Full details: Out of Scope Changes check
Explanation
The changed files support issue [#37505]. They preserve pane-owner data, reject or accept nested hooks based on foreground evidence, retain resume identity, and prevent incorrect desktop or mobile agent projections. The added tests validate these behaviors. The runtime array-handling change is an implementation refactor with unchanged grouping and ordering. No unrelated change is demonstrated.
Full details: Description check
Explanation
The description explains the implementation and lists tests, but it does not follow the required template. It omits or replaces major sections including ELI5, What Changed, Why, Visual Proof, Risk, Notes, and the required checklist details.
Resolution
Rewrite the description using the required headings. Add a plain-language ELI5 summary, separate What Changed and Why sections, complete Linked Issue and Visual Proof with N/A plus a reason if applicable, document Testing and platforms, state the risk and rollback plan, complete AI Disclosure and repository checklist sections, and address cross-platform, SSH, mobile, compatibility, security, and performance considerations.
Full details: Docstring Coverage
Explanation
Docstring coverage is 35.48% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 31 functions across 30 files.
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Warning
Some tools did not complete. Review the errors below.
ast-grep (0.51.1)
ast-grep could not parse rule config: /ast-grep-rules/ast-grep-essentials/rules/scala/security/scala-jwt-hardcoded-secret-scala.yml
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.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Assert the effective owner in the replacement test.
The fixture passes a conflicting Antigravity paneOwner to the direct Grok setAgentStatus call. Because effectiveAgentStatusOwnerType gives paneOwner.agent precedence, the current assertions can pass while the effective owner remains Antigravity.
Drop a stale incoming paneOwner after foreground ownership moves.
When foregroundLeftExistingOwner is true, the incoming status is accepted, but resolvePaneOwner still returns an incoming owner before checking resolvedAgentType. A direct Grok status can retain the departed Antigravity owner.
…capture
- Capture ORCA_HOOK_AGENT_PID before launching the POSIX antigravity-hook.sh wrapper shell in getPosixManagedCommand
- Drop stale incoming paneOwner when foregroundLeftExistingOwner transitions to a new foreground agent
- Preserve paneOwner.session and matching remembered transcript metadata when a supported Native Chat owner has a nested guest status
zhangxaochen
added a commit
to zhangxaochen/orca
that referenced
this pull request
Nov 3, 2026
Thanks @zhangxaochen. We carried your work into #37955, which is now merged, and retained your contributor credit. Closing this PR as superseded by that merged fix.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ORCA_HOOK_AGENT_PID(PPID) andagentProcessin the POSIXantigravity-hook.shscript and admitantigravityinreadHookAgentProcessso idle Antigravity process owners reject nested guest CLI hooks at the server/relay layer.paneOwner({ agent, session }) onAgentStatusEntryand mobile runtime status projections whenever a session-bound pane owner (agentPresence.session) is active.groksubagent spawned fromagy) inisInheritedFromActivePaneandbuildAgentStatusLiveEntrywhenpaneOwneror live foreground process evidence still belongs to the parent pane owner (even after the parent turn completes or exceeds the 5-minute active-turn window), unless foreground process evidence shows the pane returned to the shell or switched to another process-read agent.effectiveAgentStatusOwnerType(entry)(entry.paneOwner?.agent ?? entry.agentType) across desktop tab-bar/pane selectors, session-resume records, AI vault title candidates, and mobile tab/native-chat eligibility so an Antigravity terminal tab never flips its icon to Grok or switches from Agy Terminal View into Grok Chat View.Fixes #37505
Test Plan
src/main/agent-hooks/server-idle-process-owner.test.tsverifying idleantigravityprocess owners reject nestedgrokhooks.src/renderer/src/store/slices/agent-status-pane-owner-reclaim.test.tsverifying nestedgrokhooks are suppressed whenantigravityis thepaneOwnerafter turn completion and allowed once foreground returns to shell.src/renderer/src/components/tab-bar/tab-agent-types-by-tab-id.test.ts,src/renderer/src/components/terminal-pane/terminal-tab-agent-type-index.test.ts,mobile/src/session/native-chat/mobile-native-chat-eligibility.test.ts, andmobile/src/session/mobile-terminal-tab-agent.test.ts.