Repository navigation
fix(runtime): stop a project's terminals before the host forgets the project - #28024
Merged
Merged
Conversation
nwparker
force-pushed
the
nwparker/fix-runtime-project-remove-terminals
branch
from
October 13, 2026 00:57
06a5d34 to
97785e9
Compare
…project Removing a project on a runtime host (an SSH-managed or paired server) sent repo.rm first; the host resolves terminal.stop through the project's workspace rows, which repo.rm deletes, so the stop failed and the shells kept running on the host. Terminals stop first now. The removal toast also drops the IPC wrapper from its message.
…project removal Probe with repo.show (same resolver as repo.rm) so a removal the host rejects, such as an ambiguous project id, no longer kills the shells first. Also poll through terminal_not_writable in the paired-client e2e.
nwparker
force-pushed
the
nwparker/fix-runtime-project-remove-terminals
branch
from
October 13, 2026 01:15
a497fd3 to
c65da6b
Compare
nwparker
marked this pull request as ready for review
October 13, 2026 01:37
4 tasks
8 of 9 tasks
karlorz
added a commit
to karlorz/orca
that referenced
this pull request
Oct 13, 2026
* Update README downloads badge * fix(i18n): drop chat-mode keys removed from en.json in stablyai#28113 (stablyai#28131) * Speed up Mobile Checks by overlapping typechecks and tests (stablyai#28127) Overlap mobile typechecks with tests and avoid repeated filesystem probes and unused device substitutes in recording replays. Keep state isolated between loaders, give exhaustive snapshot cases an explicit execution deadline, and retire obsolete locale keys that blocked repository validation. * fix(orcad): identify instances by kernel start ticks, not drifting wall-clock start time (stablyai#28125) * fix(orcad): identify instances by kernel start ticks, not drifting wall-clock start time On Linux the start time is derived from /proc/stat btime, which drifts (WSL2, NTP), so a live orcad was read as a reused PID and its managed stop reported exited without ever writing the request. The lock and stop request now carry optional linuxStartTicks + bootId; readers prefer them, and a wall-clock mismatch on Linux for records without them is unverifiable, never proof of exit. Co-Authored-By: Claude <[email protected]> * fix(orcad): match stop receipts without the incarnation an older client drops A request recovered by an older client loses linuxStartTicks/bootId, which made the newer host reject its own receipts and decision records as mismatched. Also exercise the incarnation reader against a real Linux /proc. --------- Co-authored-by: Claude <[email protected]> * docs(readme): point the Android APK links at 0.0.55 (stablyai#28134) Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * perf(runtime): stop re-sending the worktree list to mobile pollers on every terminal chunk (stablyai#28062) * perf(runtime): let worktree.ps pollers opt out of per-chunk activity churn worktree.ps carries `preview` and an exact `lastOutputAt` on every row, both of which move on each PTY chunk, so the content-addressed snapshot id changed on every poll while any agent printed and the whole catalog was resent. Add an optional `coarseActivity: true` param. When set, the host drops `preview` and floors `lastOutputAt` to 30 s before hashing, so the id holds while only chunk-level activity moves. Callers without the param get the byte-identical response they get today; older hosts strip the unknown key. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * perf(mobile): stop re-sending the worktree list on every terminal chunk The host-screen snapshot poll now asks worktree.ps for `coarseActivity`, so the catalog's snapshot id survives terminal output and the 3 s poll gets a tiny `unchanged` reply instead of the whole catalog. `preview` is optional on mobile rows because a coarse host leaves it out; old hosts ignore the param and keep sending it. Re-records the three worktree.catalog-snapshot goldens; the only semantic change is the new request param. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * perf(runtime): coarsen worktree.ps activity for every snapshot poller Drop the `coarseActivity` param: the only caller that sends `afterSnapshotId` is the mobile snapshot poll, which never renders `preview` and uses `lastOutputAt` only to rank rows. Snapshot polls now always get a blank `preview` and a 30 s-floored `lastOutputAt`, so already-shipped apps stop re-downloading the catalog on every terminal chunk with only a desktop update. Callers without `afterSnapshotId` still get the byte-identical response. Reverts the mobile param, its scenario steps and the three re-recorded goldens, and removes the unread `preview` field from mobile row types. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * fix(runtime): rank coarsened worktree.ps rows so in-bucket swaps keep the snapshot id Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test: drop preview from row fixtures and keep the runtime cast on one line Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * fix(mobile): load markdown tabs from any desktop split group; center load-error Retry (stablyai#28132) * fix(mobile): load markdown tabs from any desktop split group and center load-error Retry The desktop answered markdown.readTab only for tabs in its focused split group, so a phone opening a markdown tab from another group got tab_not_found and showed "Couldn't load markdown". Resolve the tab across all of the worktree's groups. Load-error states now share one component that centers the message and its Retry button; the markdown reader's button was pinned to the left. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(renderer): mobile markdown read picks the requested tab across groups Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * refactor(renderer): resolve mobile markdown tab to one file id Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * fix(wsl): run WSL git with Windows Git line-ending settings on checkouts Windows Git wrote (stablyai#27778) * fix(wsl): run WSL git with Windows Git settings on Windows-authored drive checkouts * fix(wsl): detect Windows Git checkouts from host autocrlf plus a whole-tree sample * fix(wsl): keep WSL-created worktrees on Linux Git defaults and never commit CRLF on an unproven checkout - worktree add / clone write a new checkout whose .git points at /mnt/..., which Windows Git cannot open; injecting autocrlf=true there produced CRLF files later read unflagged. - Writes on a host-autocrlf=true checkout whose sample is unproven run with autocrlf=input, so staging normalizes CRLF without ever writing CRLF to disk. - Writes wait for a stale host answer and re-check checkout identity after joining a sample. * fix(wsl): compare a joined sample with the checkout identity read after it settles * fix(runtime): stop a project's terminals before the host forgets the project (stablyai#28024) * fix(runtime): stop a project's terminals before the host forgets the project Removing a project on a runtime host (an SSH-managed or paired server) sent repo.rm first; the host resolves terminal.stop through the project's workspace rows, which repo.rm deletes, so the stop failed and the shells kept running on the host. Terminals stop first now. The removal toast also drops the IPC wrapper from its message. * fix(runtime): only stop host terminals when the host will accept the project removal Probe with repo.show (same resolver as repo.rm) so a removal the host rejects, such as an ambiguous project id, no longer kills the shells first. Also poll through terminal_not_writable in the paired-client e2e. * test(e2e): read the host shell pid through sh so non-POSIX login shells work * fix: preserve relay pane claims across managed tab mirrors * fix(mobile): cancel bridge-post retries when a terminal document stops Mobile Checks verify failed on an unhandled ReferenceError: window is not defined inside postToReactNativeWebView's scheduled send() retry while viewport-frame.test.ts ran. Retries lived outside the document lifecycle, so a stop left timers that later read a torn-down window. Bind the default postToHost per scope, clear its timers on stop, no-op posts after stop, and guard window before reading ReactNativeWebView. Preserve bounded retry and deliver-when-bridge-appears behavior. * fix(mobile): use supported own-property check for host overrides * fix(mobile): align bridge retry teardown with document lifecycle contract * style(mobile): format bridge retry lifecycle regression test --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Neil <[email protected]> Co-authored-by: Claude <[email protected]> Co-authored-by: Jinwoo Hong <[email protected]>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
When you remove a project that lives on another machine (an SSH-managed server or a paired Orca server), Orca says "N open terminals in this project will be closed". They weren't: the shells kept running on that machine. Now they are closed.
What Changed
Before: the client asked the server to forget the project (
repo.rm) and only then asked it to stop the project's terminals (terminal.stop). The server finds "the terminals of workspace X" by looking the workspace up in its project records, andrepo.rmhad just deleted those records and dropped its resolved-workspace cache. So everyterminal.stopfailed withselector_not_found, the failure was swallowed (Promise.allSettled), and the shells stayed alive on the host. Nothing ever cleans them up later: the server's missing-workspace terminal sweep walks each registered project, and this one is no longer registered.After: the client stops the project's terminals first, then sends
repo.rm. The stop is still best-effort (allSettled), so a workspace whose terminals cannot be stopped never blocks the removal. It is skipped when a recipe VM was already destroyed (its server is gone).Also: the "Failed to remove project" toast now passes the error through the existing
readIpcErrorMessagehelper, so it shows the real reason instead ofError invoking remote method 'repos:removeForHost': Error: ….Why
repo.rmstop the project's terminals itself — the more robust long-term home, but it would only help once every server updates, and it changes what an existing RPC does; (b) stopping by individual terminal handle — the client doesn't hold a reliable handle for every host terminal (e.g. ones another client opened), while the per-workspace stop covers all of them as long as it runs while the workspace still resolves. Either can follow separately; this is the minimal fix.Linked Issue
None
Visual Proof
N/A — the dialog and sidebar look the same; the change is whether host-side shell processes exit, which the e2e below asserts by PID.
Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
src/renderer/src/store/slices/project-removal-runtime-terminal-order.test.ts(new): a fake runtime host that stops resolving workspace selectors afterrepo.rm. Assertsterminal.stopprecedesrepo.rmand the host's terminals were actually stopped; that an unstoppable workspace doesn't block removal; and that the toast description is unwrapped. The ordering and toast tests fail onmain.tests/e2e/paired-client-project-removal-stops-host-terminals.spec.ts(new, POSIX): launches a host + paired Electron client, adds the seeded repo through the host runtime, opens a terminal from the client, has the shell write its PID (echo $$), removes the project from the client, and polls until that PID is gone. Fails onmain("The host shell kept running after its project was removed") and passes with this change (macOS).pnpm tc, affected renderer suites, oxlint,check:code-quality:changed,check:focus-read-ratchet,check:max-lines-ratchet,check:zustand-selector-fanout,check:reliability-gates, oxfmt.AI Disclosure
Review
Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platoform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
SSH: SSH-managed servers take the same
environmentpath as paired servers, so they get the same fix. Backwards compatibility: no RPC or param changes; works against older servers.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)