Fix work.stopRuntime no-op and supervised PTY IPC write drops#434
Draft
cursor[bot] wants to merge 1 commit into
Draft
Fix work.stopRuntime no-op and supervised PTY IPC write drops#434cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
- work.stopRuntime: enrich session before dispose so iOS/sync stop reaches live PTYs when the DB row still has ptyId null (matches delete flow). - supervisedPtyHost: queue IPC writes on channel backpressure and flush on drain instead of dropping keystrokes/pastes silently. Co-authored-by: Arul Sharma <arul28@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
This was referenced May 30, 2026
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.
Bug 1: iOS/sync "Stop runtime" can leave the terminal running
Impact: User-facing breakage — iOS Work tab "Stop runtime" (and any
work.stopRuntimesync caller) could return{ ok: true }while the shell/agent kept running.Root cause:
work.stopRuntimeused rawsessionService.get()and only disposed whensession.ptyIdwas set in the DB.work.listSessionsalready usesptyService.enrichSessions()to attach live in-memory PTY ids; stop did not. When the DB row hadpty_id = nullbut a local PTY was attached (the same scenariodeleteTerminalSessionguards via enrich), disposal was skipped.Fix: Enrich the session before resolving
ptyId, matching the delete-terminal path.Trigger: Stop a running terminal from iOS after the session list showed it as running (enriched ptyId) but the persisted row had not yet been resynced.
Bug 2: Supervised PTY host silently drops input under IPC backpressure
Impact: Data loss — fast typing or large paste could lose keystrokes with no error.
Root cause:
SupervisedPtyHost.sendToChildcalledchild.send(); when Node returnsfalse(channel full), the code only logged at debug level. Node documents that unsent messages must wait fordrain.Fix: Queue requests per host child and flush on
drain.Trigger: Large paste or burst input while the PTY worker IPC channel is backpressured (introduced with supervised PTY host in d68fee7).
Validation
npx vitest run src/main/services/sync/syncRemoteCommandService.test.ts -t "work.stopRuntime"npx vitest run src/main/services/pty/supervisedPtyHost.test.ts -t "backpressured"Other findings (not fixed here — existing open PRs)