Repository navigation
fix(pi): isolate status ownership in new terminals - #22717
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughThe change defines three Pi process-owner environment keys and removes them from daemon, local, IPC, runtime, and relay PTY environments. The IPC and runtime spawn options also add the keys to their environment deletion lists. Tests cover host and request environments, environment augmenters, daemon finalization, relay revival, and agent-status behavior. Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to The inspected terminal-creation paths prevent inherited Pi status ownership markers from reaching new terminals. No actionable merge risk was identified. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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.
✅ No new issues found.
Reviewed changes
- Strip Pi ownership at every spawn boundary — New
PI_PROCESS_OWNER_ENV_KEYS/stripPiProcessOwnerEnv(src/main/pty/pi-process-owner-env.ts) removesORCA_PI_STATUS_OWNED,ORCA_PRIME_AGENT_STATUS_OWNED, andORCA_PI_TITLE_MARKER_OWNEDfrom the daemon (createDaemonPtyEnvironment+finalizeDaemonPtyEnvironment), local provider (buildLocalPtySpawnEnvironment+enforceLocalPtySpawnEnvironmentOverrides), and relay (PtyHandler.buildSpawnEnv, shared by spawn and revive). - Cross-version deletion requests — The same three keys are merged into
envToDeleteon both IPC and headless runtime spawn routes, so a persistent older daemon or SSH relay applies the deletion from its own inherited environment through the pre-existingenvToDeletefield. - Tests — Four new suites cover host/request/late-augmenter sources across all three boundaries, plus a daemon extension-harness case that confirms the owner still registers, a child sharing its env stays suppressed, and reload keeps ownership.
provider-dispatch.test.tspins the exact SSHenvToDeleteset.
I traced the ownership semantics in agent-status-handler-source.ts:127 and titlebar-extension-source.ts:109: the marker is only inherited through ordinary process spawning from a running agent, which this change never touches — the strip only removes keys from the fresh terminal env object. All key lists are complete (no other ORCA_*OWNED env markers exist; OMP session ownership is in-process via globalThis), and every spawn path I enumerated (local, daemon create/finalize/rescrub, relay spawn/revive, headless runtime, SSH request) is covered. The finalize helpers do not re-introduce the keys, so strip ordering holds.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
|
Local validation is green: 318 tests across 17 suites, typecheck, full lint, changed-code quality, app build, and all six relay bundle targets. The follow-up commits only document the environment boundaries; executable code is unchanged. GitHub has the fork workflows waiting for maintainer approval (PR Checks, PR test LoC, and Computer-use e2e). Could a maintainer approve the pending runs? The current contributor account cannot approve upstream workflows. |
|
Maintainer review: traced local, daemon, headless IPC, SSH spawn/revive, and late environment overrides. The deletion request uses the existing envToDelete contract, including older persistent hosts; ordinary Pi subagent spawning still inherits ownership and stays suppressed. Cross-checked Pi's subagent launcher in local pi-mono. No remaining correctness findings or unresolved inline bot threads. The local verification covered 879 tests across 105 suites (including both Pi fixes), node typecheck, and changed-code quality; the new ownership/history regressions failed before the fixes. Approved the pending fork workflow runs and am waiting for CI before merge. Native Windows execution is covered by CI, not claimed from the local macOS run. |
|
The full changed-spec lane passed 19/20 tests; its sole failure was ssh-docker-reconnect-pane-restore timing out after reconnect while waiting for top's "load average" text (line 115). I ran that exact spec independently on both revisions:
This is an intermittent reconnect-test failure; no failing Pi ownership behavior was reproduced. All eight unit shards, static analysis, typecheck, packaging, shell contracts, relay integration, managed hooks, and native Linux/Windows/macOS smoke checks passed. The separate remaining Docker SSH suite is still running. |
|
Final maintainer disposition: the remaining Docker SSH suite passed (job 107904378087). All inline bot comments are addressed; no code findings remain. Merging the reviewed head 3b7ba4c with the original reconnect-test timeout documented above and a successful isolated rerun on that exact head and on base. No admin override requested. |

ELI5
Opening a new Pi terminal could leave Orca blind to its progress if another Pi had launched the terminal host. The new terminal inherited a flag saying the other Pi owned its status, so it never reported anything. New terminals now start without that flag; actual child agents inside the same terminal still stay quiet.
What Changed
envToDeletefield on desktop and headless spawn routes, so a persistent older daemon or SSH relay cannot restore them from its own environment.Why
The ownership flag describes one agent process, not every terminal the host creates. Resetting it at the independent-terminal boundary fixes the leak without weakening the child-agent guard or adding process-tree checks. Clearing only the app's environment would miss a persistent daemon's inherited copy.
The live investigation found two fresh Pi panes with correct identities and receiver credentials, but no host agent rows. Their foreign owner belonged to a still-running Pi in another workspace. The installed extension registered 0 hooks with the leaked marker and 17 without it. Twelve new boundary regression cases failed before the fix and pass after it; three additional tests cover deletion requests to persistent daemons.
Linked Issue
Fixes #22716.
Related, distinct causes: #16109/#16631 handles an exited owner; #17267 handles a reused-pane launch-token fence; #20135 handles stale remote predecessor identity.
Visual Proof
N/A — No visual change to layout or components. This repairs host-side status production used by the existing UI. Before/after hook-registration and nested-child behavior are covered by automated tests; no user's desktop windows or running agents were modified.
Testing
Validated on Linux with
ORCA_BACKGROUND_LAUNCH=1:pnpm tcpassed.pnpm lintpassed (two existing mobileprefer-array-flat-mapwarnings).pnpm run check:code-quality:changed -- upstream/mainpassed with zero new findings across 11 files.pnpm run build:relaypassed for Linux/macOS/Windows x64 and arm64, plus WSL relays.pnpm run build:electron-vitepassed for main, preload, and renderer.Native macOS/Windows execution, packaging, the full repository test suite, and end-to-end desktop checks remain CI coverage; cross-platform bundle builds are not claimed as native execution tests.
AI Disclosure
Implementation and review assisted by OpenAI GPT-6 Astra (max).
Review
envToDelete; no new RPC fields, capabilities, or status precedence rules. Genuine nested agents still inherit the parent's marker through ordinary process spawning.Agent skill upstream boundary
Notes
The paired execution host needs this fix to build clean new terminal environments. Existing running agents are not rewritten or restarted. An already-contaminated agent must be relaunched through the updated spawn path. No Git-provider behavior changes.
Checklist
N/Awith reason