Repository navigation
Conversation
|
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthrough
Priority: ➖ Normal Merge Risk: 🟡 Moderate · up to A terminal moved to another pane could reappear in its old pane, producing duplicate terminal entries. Exclude PTYs already published by the accepted snapshot from runtime-owned retention before merging. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The change preserves existing terminals while requiring matching workspace, tab, and pane identity. Conflicting ownership, confirmed process exit, and explicit replacement or movement prevent the new preservation behavior. No introduced security bypass was established, but runtime validation remains pending. 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)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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
- Host preserves a runtime-owned PTY across an empty pane projection —
syncWindowGraphnow keepsexisting.ptyIdwhen the incoming graph publishesnullfor the exact same workspace/tab/pane, the PTY isruntimeSessionOwned, no incoming leaf claims that PTY, and its liveness verdict is notexited. Replacement, move, removed pane, and confirmed exit still take precedence. - Regression coverage — a new
runtime-owned terminal projection gapssuite pins unverifiable retention; exited / different-workspace / replacement precedence; exact handle-and-surface equality across the gap; orphan-on-removal; and no duplicate binding on an explicit pane move.
Locally, the new suite passes (15/15) and 2 of its cases fail with the prod change reverted (so the tests have teeth); related runtime suites (47 tests across graph-sync, mobile-close preservation, pending registration, queued exit, headless placeholder surface, recorded-surface topology, recovery liveness) also pass.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
Caution
The new collectRendererPublishedEmptyTerminalPanes helper throws on non-UUID pane leaf IDs, which aborts the entire syncWindowGraph and fails 19 existing tests across graph-sync-mobile-snapshot-gating and graph-sync-deletion-fence. The two commits since the last Pullfrog review introduced it; details inline.
Reviewed changes
- Added
renderer-published-empty-terminal-panes.ts— collects the renderer's accepted empty (ptyId: null) panes and the PTYs its accepted publication still binds, so a mounting renderer's projection is not read as an orphan. - Wired host-side retention into
syncWindowGraph— preserves a runtime-owned PTY when the incoming leaf publishesnullfor the exact same workspace/tab/pane, and retains an unmounted old leaf whose exact surface the renderer still publishes but omits from the transport graph. - Extended the regression suite — the
removed/replaced/movedcases now assert a retained pane is released (and reported orphaned) only on explicit removal, with the persisted pane kept in place to prove stale renderer state cannot revive it.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
Caution
The newest commit does not compile and the retention feature it adds is inert. shouldPreservePublishedRuntimePane references an undeclared tabId (pnpm tc:node → TS2304), and the call site reads published.emptyPaneWorktrees with a key it was never stored under, so the unmounted-pane path always returns false. Three of the new suite's own tests fail as a result.
Reviewed changes
- Extracted the retention helpers into
runtime-owned-terminal-projection.ts— replaces the deletedrenderer-published-empty-terminal-panes.tsand addsindexRuntimeOwnedPanePtys,resolveRetainedRuntimePtyId,createRuntimeOwnedPtyResolver,chooseProjectedPtyId, andshouldPreservePublishedRuntimePane. - Guarded the collector against non-UUID leaves —
collectRendererPublishedEmptyTerminalPanesnow only callsmakePaneKeywhenisTerminalLeafId(tab.leafId), so the earlierstableLeafId must be a UUIDthrow no longer abortssyncWindowGraph. - Rewired
syncWindowGraphonto the resolver — the leaf loop useschooseProjectedPtyId; the old-leaf loop usesshouldPreservePublishedRuntimePane. - Added two
it.eachcases — adopting a host binding before a bound graph leaf exists, and refusing to choose between two live host owners of one pane.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Fixed the undeclared
tabId—shouldPreservePublishedRuntimePanenow declarestabIdbetweenworktreeIdandptyId, sopnpm tc:nodepasses. - Aligned the published-pane map key —
collectRendererPublishedEmptyTerminalPanesnow storesemptyPaneWorktreesunder${parentTabId}::${leafId}, the samegetLeafKeyform the old-leaf lookup uses, so the retention branch actually fires; the now-unusedmakePaneKeyimport is gone. - Test and comment touch-ups — the persisted-pane test re-marks the PTY runtime-owned after the first sync, and a Codex verdict module gains a one-line comment.
Verified locally at 16f0387: pnpm tc:node passes and terminal-list-surface-lost-orphan.test.ts passes 21/21, including the removed / replaced / moved cases that failed at 748af1c.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
max-lines is configured with skipComments, so the deleted rationale cost no budget: restores the #18191 headless-placeholder paragraph, the reload- preservation and host-certified-exit notes, and repairs two comments that were truncated mid-sentence. Replaces the three adjacent string params with a RuntimePaneIdentity object so neither call site needs oxfmt-ignore and pane/worktree/tab cannot be transposed. chooseProjectedPtyId now short-circuits before resolving, so an already-bound leaf no longer computes a retention candidate it discards.
f962d37 to
2309519
Compare
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Delta since the prior Pullfrog review (16f0387): the branch was rebased onto main and the retention helpers were refactored to bundle pane identity; no behavioral change.
- Bundled pane identity into
RuntimePaneIdentity—chooseProjectedPtyIdandshouldPreservePublishedRuntimePanenow take one{ paneKey, worktreeId, tabId }object built bymakeRuntimePaneIdentity, so the three adjacent string arguments can no longer be transposed. - Folded the retired resolver helper —
resolveRetainedRuntimePtyIdis inlined intocreateRuntimeOwnedPtyResolver, andindexRuntimeOwnedPanePtysis now module-private; no external callers import either. - Dropped the unrelated Codex verdict commit — the rebase removed the
codex-structured-journal-provider-verdicts.tstouch that #23682 had deleted, eliminating the merge conflict andTS2307. - Restored the invariant comments — the
graphSequencestamp-ordering and re-emit rationale comments return to their fuller form.
Equivalence holds: chooseProjectedPtyId returns incomingPtyId first, then resolver(pane, null); the old code passed incomingPtyId as currentPtyId but discarded the result whenever incoming was non-null, so the branch is identical. Both call sites build the identity from the same makeRuntimePaneKey, matching the collector's ${parentTabId}::${leafId} lookup key, so the prior key-mismatch bug stays fixed.
Verified locally at 2309519: pnpm tc:node passes and terminal-list-surface-lost-orphan.test.ts passes 21/21. All prior Pullfrog threads are resolved.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: b32eaabc-22ed-4c8d-a7b8-a28fcd1547d3
📒 Files selected for processing (2)
src/main/runtime/orca-runtime-sync-window-graph.tssrc/main/runtime/runtime-owned-terminal-projection.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
| const retainedRuntimePtyId = createRuntimeOwnedPtyResolver( | ||
| this.ptysById.values(), | ||
| (ptyId) => this.getPtyLivenessVerdict(ptyId)?.status === 'exited', | ||
| incomingPtyIds | ||
| ) |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
# Locate snapshot acceptance and renderer graph production.
# Inspect whether publication updates host PTY ownership or excludes this combination.
rg -n -C 10 --type ts -g '!**/*.test.ts' \
'^\s*(public\s+|protected\s+|private\s+)?syncMobileSessionTabs\s*\(' .
rg -n -C 6 --type ts -g '!**/*.test.ts' \
'\bRuntimeRendererSyncWindowGraph\b|\bmobileSessionTabs\s*:' .Repository: stablyai/orca
Length of output: 41633
🏁 Script executed:
#!/bin/bash
set -eu
printf '%s\n' '--- sync window graph ---'
sed -n '1,240p' src/main/runtime/orca-runtime-sync-window-graph.ts
printf '%s\n' '--- mobile session tab sync ---'
sed -n '1,240p' src/main/runtime/orca-runtime-sync-mobile-session-tabs.ts
printf '%s\n' '--- graph publication definitions ---'
rg -n -C 12 --type ts --glob '!**/*.spec.ts' --glob '!**/__fixtures__/**' \
'changedWorktrees|unchangedWorktreeIds|publication\.changed|publication\.unchangedWorktrees|syncMobileSessionTabs\(' src/main src/shared
printf '%s\n' '--- resolver and projection definitions ---'
rg -n -C 14 --type ts --glob '!**/*.spec.ts' --glob '!**/__fixtures__/**' \
'createRuntimeOwnedPtyResolver|chooseProjectedPtyId|published\.boundPtyIds|boundPtyIds|lifecycleLeaves' src/main/runtimeRepository: stablyai/orca
Length of output: 42009
🏁 Script executed:
#!/bin/bash
set -eu
printf '%s\n' '--- sync mobile session tabs continuation ---'
sed -n '120,300p' src/main/runtime/orca-runtime-sync-mobile-session-tabs.ts
printf '%s\n' '--- ownership release and PTY recording definitions ---'
rg -n -C 18 --type ts --glob '!**/*.spec.ts' --glob '!**/__fixtures__/**' \
'releaseRuntimeSessionOwnershipForRendererRetiredTabs|recordPtyWorktree|runtimeSessionOwned|paneKey' src/main/runtime
printf '%s\n' '--- renderer publication construction ---'
rg -n -C 18 --type ts --glob '!**/*.spec.ts' --glob '!**/__fixtures__/**' \
'function .*publication|publication =|changedWorktrees|unchangedWorktrees|mobileSessionTabs:' src/renderer src/main src/sharedRepository: stablyai/orca
Length of output: 45658
🏁 Script executed:
#!/bin/bash
set -eu
printf '%s\n' '--- ownership release helper ---'
rg -n -C 35 --type ts --glob '!**/*.spec.ts' --glob '!**/__fixtures__/**' 'releaseRuntimeSessionOwnershipForRendererRetiredTabs' src/main/runtime
printf '%s\n' '--- ownership assignment and cleanup ---'
rg -n -C 12 --type ts --glob '!**/*.spec.ts' --glob '!**/__fixtures__/**' 'runtimeSessionOwned[[:space:]]*[:=]|runtimeSessionOwned|paneKey[[:space:]]*[:=]' src/main/runtime/orca-runtime\* src/main/runtime/runtime-owned-terminal-projection.ts
printf '%s\n' '--- renderer publication fields ---'
rg -n -C 20 --type ts --glob '!**/*.spec.ts' --glob '!**/__fixtures__/**' 'unchangedMobileSessionWorktrees|rendererTabIdentityKeys|publication\.changed|changedWorktrees' src/renderer src/main --glob '*.ts' --glob '*.tsx'Repository: stablyai/orca
Length of output: 22259
🏁 Script executed:
#!/bin/bash
set -eu
sed -n '100,190p' src/main/runtime/orca-runtime-merge-preserved-headless-mobile-session-tabs.ts
printf '%s\n' '--- cleanup method definitions ---'
rg -n -C 20 --type ts --glob '!**/*.spec.ts' --glob '!**/__fixtures__/**' \
'clearRuntimeSessionOwnershipForMobileTab|hasLiveRuntimeSessionOwnedPtyBinding' src/main/runtimeRepository: stablyai/orca
Length of output: 32284
🏁 Script executed:
#!/bin/bash
set -eu
printf '%s\n' '--- shared graph contract ---'
rg -n -C 18 --type ts \
'export (type|interface) Runtime(RendererSyncWindowGraph|SyncWindowGraph)|RuntimeRendererSyncWindowGraph|RuntimeSyncWindowGraph' src/shared
printf '%s\n' '--- renderer graph publication ---'
rg -n -C 20 --type ts --type tsx \
'mobileSessionTabs|unchangedMobileSessionWorktrees|rendererGeneration|syncWindowGraph' src/rendererRepository: stablyai/orca
Length of output: 6782
🏁 Script executed:
#!/bin/bash
set -eu
fd -i 'graph-publication\.ts$' .Repository: stablyai/orca
Length of output: 218
🏁 Script executed:
#!/bin/bash
set -eu
wc -l src/renderer/src/runtime/sync-runtime-graph/graph-publication.ts
cat -n src/renderer/src/runtime/sync-runtime-graph/graph-publication.tsRepository: stablyai/orca
Length of output: 11737
Exclude published PTYs from runtime-owned retention.
When an accepted mobile snapshot binds PTY P to a different pane, the renderer can still publish the old leaf with ptyId: null. The ownership record can still name the old pane. Since the resolver excludes only incoming leaf PTYs, chooseProjectedPtyId can bind P back to the old leaf. This creates a duplicate binding and defeats move precedence.
Suggested fix
- const incomingPtyIds = new Set(lifecycleLeaves.map((leaf) => leaf.ptyId))
const published = collectRendererPublishedEmptyTerminalPanes(
graph,
this.mobileSessionTabsByWorktree,
this.acceptedRendererMobileSnapshotByWorktree
)
+ const incomingPtyIds = new Set([
+ ...lifecycleLeaves
+ .map((leaf) => leaf.ptyId)
+ .filter((ptyId): ptyId is string => ptyId !== null),
+ ...published.boundPtyIds
+ ])#23933 added a --help capability probe that runs on every Codex launch and is deliberately uncached. This spec puts a fake codex on PATH that records every invocation, so the probe landed in the spawn ledger and the first-mount assertion saw two launches where one was expected. Verified on plain main: 8/8 repetitions fail at spec line 617 with [{args:['--help']}, {args:['--dangerously-bypass-approvals-and-sandbox',...]}], so the breakage is independent of the retention change this branch makes.
There was a problem hiding this comment.
Important
The new filter clears the spawn-ledger count, but the same probe is still recorded in signalLedgerPath, so the Linux gate fails at the signal assertion instead. Details inline.
Reviewed changes
Delta since the prior Pullfrog review (2309519): a single test-only commit, prod files unchanged.
- Filtered the Codex
--no-daemonprobe out of the spawn ledger —readSpawnLedger()now drops the probe's exact['--help']invocation so the first-mount assertion counts one agent launch instead of two.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
| .split(/\r?\n/) | ||
| .filter(Boolean) | ||
| .map((line) => JSON.parse(line) as SpawnEvent) | ||
| .filter(({ args }) => args.length !== 1 || args[0] !== '--help') |
There was a problem hiding this comment.
The probe this filter drops is also recorded on a second ledger, so the gate still fails. When the 5s runProcess timeout fires for ['--help'], the fake CLI's own SIGTERM handler appends {kind:'agent'} to signalLedgerPath; expect(readJsonLines(signalLedgerPath)).toHaveLength(0) at lines 712 and 841 therefore sees a probe entry. The spawn-ledger count is now clean, but the signal check is not.
Technical details
# Probe SIGTERM is written to the signal ledger
## Affected sites
- `tests/e2e/live-background-terminal-mount-authority.spec.ts:105` — new filter strips the probe from `readSpawnLedger()` only; the `signalLedgerPath` reads stay unfiltered.
- `tests/e2e/live-background-terminal-mount-authority.spec.ts:60` — the fake CLI registers `SIGINT`/`SIGHUP`/`SIGTERM` handlers that append `{kind:'agent', ...}` to `ORCA_E2E_SIGNAL_LEDGER`.
- `tests/e2e/live-background-terminal-mount-authority.spec.ts:712` and `:841` — `expect(readJsonLines(signalLedgerPath)).toHaveLength(0)`.
- `src/main/pty/codex-no-daemon-launch-command.ts:88-94` — the probe runs `program --help` with `timeoutMs: 5000`; the fake CLI never exits, so the timeout path kills it.
- `src/shared/child-process/run-process.ts:245` + `:310-316` — non-barrier timeout calls `terminate(child)` → `child.kill()` → `SIGTERM`, which the fake handler observes.
- `src/main/ipc/pty/runtime/spawn-options.ts:106-114` — the spawn awaits the probe before the agent PTY is created, so the ledger write lands before the spec reads it.
## Required outcome
- The probe must not contribute to `signalLedgerPath`. The exact-`['--help']` spawn filter is insufficient on its own.
## Suggested approach (optional)
- Filter the signal reads to the real agent/setup/canary pids (the probe pid is recorded in the spawn entry you already drop), or make the fake CLI skip signal-handler registration on the `--help` probe path.
## Evidence
- Simulated the spec's fake codex under a 5s kill: spawn ledger `{"args":["--help"]}` and signal ledger `{"kind":"agent","signal":"SIGTERM"}` are both written, because the process survives `SIGTERM` (handler installed) until the `SIGKILL` grace.
Linux validation: the retention fix works; a separate pre-existing defect still blocks the specRan 8x repetitions on four branch variants to separate the failures. Line order matters: 617 < 663 < 673 < 712, and the spec stops at the first failure, so an early failure masks the later ones.
1. Spec was broken on
|

Linux flake validation is running; do not merge until it reports. The initial candidate failed 2/8 Linux repetitions. The follow-up also handles unmounted panes omitted from the transport graph while still explicitly present in the renderer session. Rebased onto main (was 64 commits behind); the stray commit that resurrected
codex-structured-journal-provider-verdicts.tsafter #23682 deleted it is dropped, so the merge conflict and the TS2307 typecheck failure it caused are gone.ELI5
Opening a workspace could create duplicate agent and Setup tabs even though their terminals were already running. Keep those terminals attached to their original panes while the screen catches up.
What Changed
The host preserves its existing terminal binding when the renderer publishes the same pane with an empty binding. It also retains an unmounted pane omitted from the transport graph when the renderer’s accepted current session still explicitly publishes that exact empty pane. Host-preserved session rows are excluded from that evidence. Preservation requires runtime ownership and an exact workspace, tab, and pane match. An explicit replacement, move to another pane, removed pane, or confirmed process exit still takes precedence.
Why
Linux binding traces showed activation creating extra tabs after an empty renderer projection made the host incorrectly report live terminals as orphaned. Fixing the host's ownership decision keeps all inventory readers consistent; delaying activation or weakening the identity assertions would leave the race intact.
Linked Issue
CI failure in
live-background-terminal-mount-authority.spec.ts; baseline diagnostic run: https://github.com/stablyai/orca/actions/runs/36502710956 (five failures in eight runs).Visual Proof
Before: Linux failure has five tabs after activation. After: macOS validation retains the three original tabs through input and remount checks. The unchanged E2E verifies exact tab, leaf, PTY, handle and process identity. Screenshots use different platform window sizes.
Testing
nwparker/ci-null-projection-repeat-v2(https://github.com/stablyai/orca/actions/runs/36657752034). This is the gate — a single green repetition does not clear a 2/8 flake.Terminal contract: host ownership survives a temporary renderer projection gap; no duplicate spawn or reminted identity. The oracle is full terminal inventory equality plus unchanged E2E identity/input/output assertions. Existing
agent-session.provider-ownershipfirst-mount coverage is the gate. Windows and live SSH validation remain gaps; runtime tests cover incarnation fencing andunverifiablehost contact.Review
No wire fields or opcodes change. Older clients receive the same existing terminal identity instead of a false orphan. No local-only paths, Git assumptions, or new polling; folder workspaces use the same exact workspace comparison. Each sync builds transient linear-time indexes of explicit incoming bindings and accepted empty session panes. An explicit session removal, replacement, or move supersedes retention; unchanged snapshot publications retain the same exact handle. Pane identity travels as one
RuntimePaneIdentityobject rather than three adjacent string arguments, so no call site can transpose pane, worktree and tab.Agent skill upstream boundary
Checklist