fix: prevent orphaned opencode processes from duplicate requestStart#559
Closed
conradkoh wants to merge 1 commit into
Closed
fix: prevent orphaned opencode processes from duplicate requestStart#559conradkoh wants to merge 1 commit into
conradkoh wants to merge 1 commit into
Conversation
…tart events Dedupe agent.requestStart per chatroom+role in getCommandEvents and clean up tracked opencode-sdk sessions before respawn so duplicate starts do not leave orphaned serve processes. Co-authored-by: Cursor <cursoragent@cursor.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
5 tasks
Owner
Author
|
Closing as superseded by #584 (squash-merged to This PR implemented backend Merging both approaches would be contradictory. The current release branch no longer contains If further opencode-sdk-specific hardening is needed, it should be a fresh PR on top of |
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.
Summary
agent.requestStartevents leave orphaned opencode serve processesgetCommandEventsreturns every non-expiredagent.requestStartfor a machine (e.g. double-click / start-all). The daemon dedupes by event ID only, so each distinct event can trigger anotheropencode servespawn while older serves remain running.agent.requestStartto the latest event perchatroomId+roleingetCommandEvents, and stop/remove any tracked opencode-sdk session for that role before spawning.Assumptions
agent.requestStopevents are unchanged and still processed in timestamp order alongside the deduped starts (restart = stop then start still works).Risks
workingDir/model were issued within the deadline, only the latest is delivered. Unlikely in normal UI flows.Test plan
pnpm typecheckpnpm test(cli + backend)dedupeRequestStartEventsgetCommandEventsdedupes duplicate startsps aux | grep opencode)Made with Cursor