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
Keep remote agent status in sync after completion and approvals - #34729
A remote agent could keep showing Working after it finished, or keep showing an approval after it resumed. Reconcile the host's current status and saved pane titles while preserving newer activity from the terminal itself.
What Changed
Refresh mirrored pane titles during accepted host snapshots, including inactive workspaces. Remove only proven absent durable leaf identities; preserve unknown numeric slots and use mounted pane or PTY bindings before layout replay order, so closed or moved split panes keep the correct titles.
Allow expired client state to converge even when the host clock is behind. Keep host approval/question facts authoritative across clock skew, and release the client byte fence when the displayed row was adopted from the host. A new real terminal status can reacquire ownership afterward, including when its timestamp is below the previously mirrored host value.
Why
Saved spinner titles and cross-machine timestamp comparisons could outlive completed work. A separate ownership mismatch let a previously earned byte-writer claim fence the host's own adopted approval row, preventing its completion update from appearing.
Linked Issue
Supplied remote-terminal status report. Builds on #25205, preserving sparse and moved runtime pane identities and correcting approval handback. Original contribution is credited in the commit history.
Visual Proof
Stale completion, before:
Stale completion, after:
Approval continuation, before:
Approval continuation, after:
Testing
Red/green tests cover stale numeric titles, expired skewed client state, removed durable leaves, sparse and reordered panes, inactive workspace completion, and live byte ownership. Old production code failed 10 of 14 initial new cases.
Independent final review passed 50 checks: 41 focused repository cases, six actual connection-callback provenance controls, the behind-host clock-skew regression, and two mounted-pane identity controls. Old callback code fails exactly the two mirrored-row controls. Earlier review defects were corrected before publication.
Exact final commit: two hidden Electron specs passed through real paired transport. The completion case deliberately seeds controlled saved stale state, then uses actual Stop snapshots, repeated refreshes, and reopen. The approval case uses a persistent terminal fixture, genuine OSC status writes, and real authenticated PreToolUse → PermissionRequest → PostToolUse hook events; no fabricated store or clock state in that case.
A subsequent real OSC update reacquires the byte fence and stays Working against a lagging host Done snapshot.
Final-head CI: all 55 reported checks settled successfully, including Ubuntu, Debian, and Fedora WSL.
Required local ORCA_BACKGROUND_LAUNCH=1 pnpm check:changed --maxWorkers=2: all 27 selected checks passed at the final commit.
Review
No new polling, I/O, subprocesses, protocol fields, or resource owners. Accepted snapshot reconciliation preserves record identity when unchanged. Existing fresh-byte protections remain; host-only interactive state is not decided by cross-machine wall clocks. Folder workspace behavior was rendered; git workspace and mobile mirror consumers use the same path.
Agent skill upstream boundary
No upstream skill-installer source was copied.
Notes
Runtime proof used macOS loopback paired transport and an instrumented terminal fixture, rather than a full agent inference turn. Native Windows/Linux/WSL and physical mobile were not run locally. Targets main after #34721 was merged. The original parent commit includes that already-merged one-line test-import repair.
Checklist
Focused remote status fix with independent review and before/after evidence.
Compatibility, ownership, sparse/moved panes, cleanup, and performance reviewed.
Required local affected checks and final-head CI complete.
The changes refine host and client agent-status reconciliation, classify orphan runtime pane titles, and add host-derived runtime pane title updates to final patches outside local PTY mode. The patch resolves pane slots against layouts and host surfaces, preserves titles under fresh client status authority, and updates or removes saved titles. New tests cover status transitions, split-pane mapping, orphan titles, sparse pane slots, and remote completion after a hidden window is revealed.
Priority: Normal
Merge Risk: Moderate · previous review e73f1
Typecheck failures in the status-sync code and its tests will fail the type-checking CI step until they are fixed. The behavior change looks sound, but fix the predicate signature and the two test literals before merging.
Pre-merge checks: 3 · 2
Failed checks: 2 warnings
Check name
Status
Explanation
Resolution
Description check
The description is detailed and covers the change, rationale, visual proof, testing, review, compatibility, and checklist. The Linked Issue section does not provide a completed Fixes # reference or …
Add the actual issue reference in the Fixes # section. Keep or clarify the existing #25205 reference if it is the issue addressed by this pull request.
Docstring Coverage
Docstring coverage is 38.46% 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 identifies the main change: synchronizing remote agent status after completion and approval handoff.
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Description check
Explanation
The description is detailed and covers the change, rationale, visual proof, testing, review, compatibility, and checklist. The Linked Issue section does not provide a completed Fixes # reference or a clear issue link.
Resolution
Add the actual issue reference in the Fixes # section. Keep or clarify the existing #25205 reference if it is the issue addressed by this pull request.
Full details: Docstring Coverage
Explanation
Docstring coverage is 38.46% 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 13 functions across 14 files.
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
Finishing Touches: 💡 2
📝 Generate docstrings: 💡
Commit to this branch
Create a new PR
🛠️ Fix failing CI checks: 💡
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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; 3 remain after this review.
#!/bin/bashset -o pipefail
printf'%s\n''--- shared helper ---'
nl -ba src/shared/runtime-pane-title-leaf-id.ts
printf'%s\n''--- sync harness and manager registration ---'
rg -n -C10 -F -- 'registerMountedTerminalTab' src/renderer/src/runtime src/renderer/src/runtime/web-session-tabs-sync src/renderer/src/runtime/web-session-tabs-sync-test-harness.ts
printf'%s\n''--- layouts and pane bindings used by the stale-spinner tests ---'
rg -n -C8 -F -- 'ptyIdsByTabId' src/renderer/src/runtime/web-session-tabs-sync-test-harness.ts src/renderer/src/runtime/web-session-tabs-sync-stale-spinner.test.ts
Repository: stablyai/orca
Length of output: 14290
Limit title deletion to confirmed-absent durable IDs.
A numeric slot can resolve to a non-null leaf while its host surface is missing. hostTitle then remains undefined, and the current guard skips isRuntimePaneTitleOrphan before deleting the saved title. Apply the orphan check to every deletion path.
Suggested fix
--- "a/src/renderer/src/runtime/web-session-tabs-sync/runtime-pane-title-patch.ts"+++ "b/src/renderer/src/runtime/web-session-tabs-sync/runtime-pane-title-patch.ts"@@ -110,9 +110,12 @@
}
}
// Why: a slot the layout cannot place is not proof the pane was removed.
- if (leafId === null && !isRuntimePaneTitleOrphan(layout.root, runtimePaneId, leaves)) {+ if (+ hostTitle === undefined &&+ !isRuntimePaneTitleOrphan(layout.root, runtimePaneId, leaves)+ ) {
continue
}
if (nextPaneTitles === paneTitles) {
nextPaneTitles = { ...paneTitles }
}
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.
- Share the byte-write timing decision (resolveRendererOwnedAgentStatusTiming) between pty-connection and the flap test so reverting it fails a test.
- Only delete a saved pane title when its durable leaf is absent from both the host layout and local panes; unresolved or surface-less slots are kept.
- Share the client-fence predicate (clientAgentStatusFencesHost) between status and title reconciliation.
- Cover removed-leaf spinner fallback in worktree status and a client split absent from a pre-split host snapshot.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Major · Functional Correctness · Quick win
Fix the TS2353 typecheck error in the orphan-title test.
getWorktreeStatus types runtimePaneTitlesByTabId as Record<string, Record<number, string>>. The fresh object literal { [LEAF_C]: '⠋ Codex' } has a string key that is not numeric. TypeScript rejects it with TS2353. The CI log reports this exact error at Line 37, so typecheck:ci fails.
The CI log names an earlier commit (0d3eb96) than the reviewed revision. The line content is unchanged, so the error likely remains. Confirm with the typecheck.
Build the titles as a non-literal Record<string, string> and pass the variable. This assignment is valid because a string index signature satisfies the numeric index signature.
GitHub Actions: PR 34729 | source 0d3eb96 | workflow 0d3eb96 | unit full / 15_static analysis and typecheck.txt
[error] 37-37: TypeScript error in bun config/tsconfig.tc.web.json: Object literal specifies [LEAF_C], which is not a known property of Record<number, string> (TS2353).
GitHub Actions: PR 34729 | source 0d3eb96 | workflow 0d3eb96 | unit full / static analysis and typecheck
[error] 37-37: TypeScript error TS2353: Object literal property '[LEAF_C]' does not exist in type 'Record<number, string>'. The pnpm run typecheck:ci --bun-concurrency=2 --bun-threads=2 check failed.
#!/bin/bashset -e
printf'%s\n''--- TerminalSurface and state declarations ---'
rg -n -F --glob '*.ts' -e 'export type TerminalSurface' -e 'export interface TerminalSurface' -e 'type TerminalSurface' -e 'interface TerminalSurface' src/renderer/src/runtime/web-session-tabs-sync src/shared
printf'%s\n''--- state imports and surface declaration context ---'
rg -n -F -C4 --glob '*.ts''TerminalSurface' src/renderer/src/runtime/web-session-tabs-sync/state.ts src/renderer/src/runtime/web-session-tabs-sync
printf'%s\n''--- nullable runtime surface contracts ---'
nl -ba src/shared/runtime-mobile-session-tab-contracts.ts | sed -n '1,45p'
Repository: stablyai/orca
Length of output: 41987
Fix the clientAgentStatusFencesHost signature.
The type predicate is incorrect for the current caller. After existing &&, the false branch of the aliased predicate can narrow existing to never, making existing.updatedAt invalid in agent-status-patch.ts.
hostSurface.agentStatus also allows null, but the parameter excludes null. Return boolean and accept null.
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.
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.
ELI5
A remote agent could keep showing Working after it finished, or keep showing an approval after it resumed. Reconcile the host's current status and saved pane titles while preserving newer activity from the terminal itself.
What Changed
Refresh mirrored pane titles during accepted host snapshots, including inactive workspaces. Remove only proven absent durable leaf identities; preserve unknown numeric slots and use mounted pane or PTY bindings before layout replay order, so closed or moved split panes keep the correct titles.
Allow expired client state to converge even when the host clock is behind. Keep host approval/question facts authoritative across clock skew, and release the client byte fence when the displayed row was adopted from the host. A new real terminal status can reacquire ownership afterward, including when its timestamp is below the previously mirrored host value.
Why
Saved spinner titles and cross-machine timestamp comparisons could outlive completed work. A separate ownership mismatch let a previously earned byte-writer claim fence the host's own adopted approval row, preventing its completion update from appearing.
Linked Issue
Supplied remote-terminal status report. Builds on #25205, preserving sparse and moved runtime pane identities and correcting approval handback. Original contribution is credited in the commit history.
Visual Proof
Stale completion, before:
Stale completion, after:
Approval continuation, before:
Approval continuation, after:
Testing
ORCA_BACKGROUND_LAUNCH=1 pnpm check:changed --maxWorkers=2: all 27 selected checks passed at the final commit.Review
No new polling, I/O, subprocesses, protocol fields, or resource owners. Accepted snapshot reconciliation preserves record identity when unchanged. Existing fresh-byte protections remain; host-only interactive state is not decided by cross-machine wall clocks. Folder workspace behavior was rendered; git workspace and mobile mirror consumers use the same path.
Agent skill upstream boundary
Notes
Runtime proof used macOS loopback paired transport and an instrumented terminal fixture, rather than a full agent inference turn. Native Windows/Linux/WSL and physical mobile were not run locally. Targets
mainafter #34721 was merged. The original parent commit includes that already-merged one-line test-import repair.Checklist