Repository navigation
fix(runtime): scope mirrored-editor close intent to its runtime environment - #9836
Conversation
…onment #9804 added a leading `environmentId` parameter to recordWebSessionCloseIntent (and isWebSessionCloseIntentPending) and updated the web-runtime-session.ts callers, but missed the second caller in close-mirrored-editor-tab.ts, which still passed 3 args. This broke the web typecheck on main and, had it compiled, would have recorded the close intent under the wrong scope key (closeIntentScopeKey(environmentId, worktreeId)) — so the host snapshot could flash the just-closed mirrored tab back. Pass the already-validated runtimeEnvironmentId (the same value handed to closeWebRuntimeSessionTab immediately below) so the intent is scoped correctly. Update the test's isWebSessionCloseIntentPending assertion to the 4-arg form. Co-authored-by: Orca <help@stably.ai>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughUpdated mirrored editor tab closure to record the web session close intent with the runtime environment ID and worktree ID in the revised argument order. Updated the corresponding test assertion to verify pending close intent using the runtime environment ID. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 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 |
brennanb2025
left a comment
There was a problem hiding this comment.
Reviewed against current main — this is the correct and complete fix for the typecheck breakage that's failing verify on every open PR.
Verified:
- #9804 widened
recordWebSessionCloseIntent/isWebSessionCloseIntentPendingwith a leadingenvironmentIdand updated theweb-runtime-session.tscallers, but merged past #5975's then-new caller inclose-mirrored-editor-tab.ts— a semantic merge conflict (both PRs were green individually). Current main fails web typecheck on exactly the two lines this PR touches. - Swept main for all call sites of the close-intent functions (
record/isPending/reconcile/clear*): everything else is already 4-arg, so this PR closes the only gap — no other stale caller left behind. - Passing
runtimeEnvironmentIdis semantically right, not just type-appeasing: it's the same validated value handed tocloseWebRuntimeSessionTabbelow, and matches theenvironmentIdthe snapshot reconcile inweb-session-tabs-sync.tsuses when checkingisWebSessionCloseIntentPending— so the intent lands in the scope the reconcile actually reads. - Test update matches the mock (
getRuntimeEnvironmentIdForWorktree→'env-1'). verifypassed on the merge commit after #9804 landed, so the merged tree is proven green.
LGTM — landing this unbreaks typecheck for every open PR.
…onment (stablyai#9836) stablyai#9804 added a leading `environmentId` parameter to recordWebSessionCloseIntent (and isWebSessionCloseIntentPending) and updated the web-runtime-session.ts callers, but missed the second caller in close-mirrored-editor-tab.ts, which still passed 3 args. This broke the web typecheck on main and, had it compiled, would have recorded the close intent under the wrong scope key (closeIntentScopeKey(environmentId, worktreeId)) — so the host snapshot could flash the just-closed mirrored tab back. Pass the already-validated runtimeEnvironmentId (the same value handed to closeWebRuntimeSessionTab immediately below) so the intent is scoped correctly. Update the test's isWebSessionCloseIntentPending assertion to the 4-arg form. Co-authored-by: Orca <help@stably.ai>
What
recordWebSessionCloseIntentandisWebSessionCloseIntentPendinggained a leadingenvironmentIdparameter in #9804, and theweb-runtime-session.tscallers were updated to the 4-arg form — but the second caller, inclose-mirrored-editor-tab.ts, was missed and still passed 3 args. This breaks the web typecheck onmain:Fix: pass the already-validated
runtimeEnvironmentId(the exact same value handed tocloseWebRuntimeSessionTab({ environmentId })immediately below) so the close intent is recorded under the correctcloseIntentScopeKey(environmentId, worktreeId). Update the test'sisWebSessionCloseIntentPendingassertion to the 4-arg form (env-1is what the test's mock resolves the worktree's runtime env to).ELI5
When you close a file that's mirrored from a remote host, Orca whispers to the host "I closed this, don't send it back." A recent change started filing those whispers in per-environment folders, but one code path forgot to say which environment — so the compiler refused to build, and even if it had built, the whisper would've gone in the wrong folder and the tab could pop back. This puts the environment label back on that one path.
Proof of zero regression
close-mirrored-editor-tab.test.ts: 4/4 pass (including the "records the host close intent SYNCHRONOUSLY" test that exercises the fixed call path withenv-1).pnpm typecheck:web: clean (was failing onmainbefore this).environmentIdalready used two lines down incloseWebRuntimeSessionTab, so the two now agree on scope — this is the behavior fix(terminal): prevent reconnect from killing live daemon sessions #9804 intended.Why this is a fix, not just a type patch
Had the code compiled with the missing arg, the intent would have been recorded under
closeIntentScopeKey(undefined, worktreeId)whilecloseWebRuntimeSessionTabre-records/reads undercloseIntentScopeKey(runtimeEnvironmentId, worktreeId)— a scope mismatch that reopens the "host snapshot flashes the just-closed mirrored tab back" race #9804 was hardening against.Made with Orca 🐋