Repository navigation
Conversation
|
Caution Review failedAn error occurred during the review process. Please try again later. 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 |
📝 WalkthroughWalkthroughRuntime mobile session preparation now reconciles dead serve-owned terminal tabs using refreshed PTY liveness and protected-state checks. Pruned snapshots update metadata and are published, while activation and closing distinguish reconciled closures from unknown tabs. Host and worktree summaries now use refreshed live terminal data, and closed-tab agent status entries are removed. Tests cover pruning, lifecycle behavior, liveness, pinning, mixed snapshots, status filtering, and notifier calls. 🚥 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.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/main/runtime/orca-runtime.test.ts (1)
18158-18215: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winExercise multiple leaves under the stale parent.
This case has only one stale leaf, so it does not prove parent-level pruning. Add another dead terminal with
parentTabId: 'stale-tab'; the existing expected result should verify that every child is removed.Based on PR objectives, all tabs belonging to a dead serve-owned terminal parent must be pruned.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: e0c7faf7-c14c-4111-a0ef-4683b6ce7b6a
📒 Files selected for processing (2)
src/main/runtime/orca-runtime.test.tssrc/main/runtime/orca-runtime.ts
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: be5cb55d-d7c0-4934-9af9-c0a20edcf68e
📒 Files selected for processing (3)
src/main/index.tssrc/main/runtime/orca-runtime.test.tssrc/main/runtime/orca-runtime.ts
| private dropAgentStatusEntriesForClosedTab(tabId: string): void { | ||
| for (const paneKey of this.latestAgentStatusByPaneKey.keys()) { | ||
| if (parsePaneKey(paneKey)?.tabId === tabId) { | ||
| this.latestAgentStatusByPaneKey.delete(paneKey) | ||
| } | ||
| } | ||
| const generation = this.nextPtyLifecycleGeneration++ | ||
| this.ptyLifecycleGenerationById.set(ptyId, generation) | ||
| return generation | ||
| this.dropAgentStatusEntriesByTabPrefixFn?.(tabId) | ||
| } | ||
|
|
There was a problem hiding this comment.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
Ensure legacy pane keys are reliably matched for cleanup.
If parsePaneKey returns null/undefined for legacy pane keys (e.g., tabId:paneRuntimeId), those entries will be skipped and leak in memory. Checking if the paneKey starts with ${tabId}: provides a safe fallback that correctly captures both standard (tabId::leafId) and legacy formats for cleanup.
🛠️ Proposed fix to cover legacy pane keys
private dropAgentStatusEntriesForClosedTab(tabId: string): void {
for (const paneKey of this.latestAgentStatusByPaneKey.keys()) {
- if (parsePaneKey(paneKey)?.tabId === tabId) {
+ if (parsePaneKey(paneKey)?.tabId === tabId || paneKey.startsWith(`${tabId}:`)) {
this.latestAgentStatusByPaneKey.delete(paneKey)
}
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| private dropAgentStatusEntriesForClosedTab(tabId: string): void { | |
| for (const paneKey of this.latestAgentStatusByPaneKey.keys()) { | |
| if (parsePaneKey(paneKey)?.tabId === tabId) { | |
| this.latestAgentStatusByPaneKey.delete(paneKey) | |
| } | |
| } | |
| const generation = this.nextPtyLifecycleGeneration++ | |
| this.ptyLifecycleGenerationById.set(ptyId, generation) | |
| return generation | |
| this.dropAgentStatusEntriesByTabPrefixFn?.(tabId) | |
| } | |
| private dropAgentStatusEntriesForClosedTab(tabId: string): void { | |
| for (const paneKey of this.latestAgentStatusByPaneKey.keys()) { | |
| if (parsePaneKey(paneKey)?.tabId === tabId || paneKey.startsWith(`${tabId}:`)) { | |
| this.latestAgentStatusByPaneKey.delete(paneKey) | |
| } | |
| } | |
| this.dropAgentStatusEntriesByTabPrefixFn?.(tabId) | |
| } |
|
Related to #9952 (sessions vanishing over remote Orca link). |
|
Closing as superseded — every bug this PR describes is real, but all four were fixed on The decisive check
Clean This PR's head ( The pinned tab survives a genuine host PTY exit on this branch, because the "never auto-prune pinned tabs" rule outranks a real exit signal. Main's runtime can't even be imported into this tree any more ( Each claim, against current
|
Summary
Fix stale headless terminal and agent state in
worktree.psafter terminals are closed.Problem
orca terminal list --jsoncould return no terminals whileorca worktree ps --jsonstill reported a positiveliveTerminalCount.Changes
Tests added
Validation
pnpm typecheckpnpm check:max-lines-ratchetpnpm buildreached packaging but failed becauselipocould not find the generated architecture binaries in the local build environmentScreenshots
No visual changes.
Security
No security-sensitive behavior or permissions changed.