Skip to content

feat(opencode)!: start and stop opencode serve in the handler - #198

Open
apucacao wants to merge 3 commits into
mainfrom
cursor/opencode-serve-ownership-63ab
Open

apucacao wants to merge 3 commits into
mainfrom
cursor/opencode-serve-ownership-63ab

Conversation

@apucacao

Copy link
Copy Markdown
Contributor

Each call starts opencode serve, speaks the OpenCode HTTP API, and stops the process when the stream finishes or the caller closes it.

create_opencode_handler takes the working directory, the OpenCode config file, and the child environment (cwd, config, env), plus the existing optional capture_content, model, and agent. command defaults to opencode; a test passes a fake executable there. There is no base_url, client, or transport. config().stream() is still chunk then done.

A fake opencode proves the handler started the process, sent /event, /session, and /message to it, and stopped it. Closing the stream aborts the session and stops the process. Removing that ownership fails the test.

Open in Web Open in Cursor 

Each call starts opencode serve from the working directory, config file,
and environment, speaks the OpenCode HTTP API itself, and stops the process
when the stream finishes or the caller closes it. Callers no longer pass
base_url. A test can pass a fake command instead of a URL. config().stream()
is unchanged.

Co-authored-by: alexis <alexis@launchdarkly.com>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit c5f4634. Configure here.

cursoragent and others added 2 commits October 21, 2026 23:19
async with handler starts the process and waits until it is healthy.
The process stops when that context exits, after config().stream()
returns, including when the caller times out or closes the stream.
A wall-clock budget stays around config().stream(), so boot is not
part of it.

Co-authored-by: alexis <alexis@launchdarkly.com>
--print-logs and --log-level are not serve options. A binary that
rejects them exits before it listens, and the handler already
discards the child's output.

Co-authored-by: alexis <alexis@launchdarkly.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants