Skip to content

feat(server): Add OpenCode 2 transport runtime - #18

Closed
mwolson wants to merge 657 commits into
contrib/ctm/legacy-wake-presentationfrom
contrib/ctm/opencode-runtime
Closed

mwolson wants to merge 657 commits into
contrib/ctm/legacy-wake-presentationfrom
contrib/ctm/opencode-runtime

Conversation

@mwolson

@mwolson mwolson commented Sep 27, 2026 •

Copy link
Copy Markdown
Owner

What Changed

This adds the server-side runtime for talking to an OpenCode 2 service, pinned to @opencode/client 2.0.15, plus a helper that turns OpenCode 2 step token counts into turn usage. Nothing uses it yet. The existing OpenCode provider is unchanged, and the runtime becomes reachable only when a later change activates it.

The runtime attaches to the user's registered OpenCode 2 service after identity checks: the reported version is exactly 2.0.15, the server reports the registered process id, and the credentials and endpoint match the registration. When the service is definitely not running, it starts it once with opencode service start and attaches only after the same checks. "Definitely not running" means there is no registration, or the registered process is gone and its local address refuses connections. Concurrent callers share one start, and the command is bounded at 30 seconds. The started service does not inherit the desktop app's AppImage paths, Electron's Node mode or T3 Code's own settings. T3 Code never runs a server of its own and never stops, restarts or replaces a service. On Windows, where stopping a stuck start command would also end the service it launched, T3 Code stops waiting after 30 seconds and leaves the command to OpenCode's own deadline.

A service that is running but does not answer, rejects the credentials, reports another version or no longer matches its registration is left alone, and the runtime returns a typed reason, such as not running, start failed, wrong version, identity mismatch or missing credentials, so the provider can tell the user what to fix. It does not try a second start after a failed one.

Why

OpenCode 2 changes the client package, API shapes and service model, so it needs its own transport. Users expect OpenCode to come up when they use it, but OpenCode's own start command can replace a service it finds incompatible, and T3 Code cannot check and start in one step. Starting only when the service is provably absent, and failing closed in every uncertain state, keeps T3 Code from taking over a service other tools rely on.

Known Limitations

A service registered by an older OpenCode 2 beta that has no version field is reported as an identity mismatch rather than an unsupported version. If another service registers in the moment between T3 Code's last check and OpenCode's start command reading the registration, OpenCode's command decides what happens to it.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

saphid and others added 30 commits September 23, 2026 19:10
…dotgg#10880)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Mike Olson <mwolson@member.fsf.org>
Co-authored-by: Julius Marminge <julius0216@outlook.com>
Co-authored-by: Julius Marminge <julius0216@outlook.com>
…gg#9897)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…ingdotgg#8464)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Julius Marminge <julius0216@outlook.com>
…gg#9907)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Julius Marminge <julius0216@outlook.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Julius Marminge <julius0216@outlook.com>
…otgg#9905)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…gg#9928)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…dotgg#9920)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…ngdotgg#10051)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Julius Marminge <julius0216@outlook.com>
juliusmarminge and others added 23 commits September 23, 2026 19:10
)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Background-task notifications and delegated completions queued behind a
held queue are hidden from the queue UI, so the Resume queue control never
appeared, yet thread.settle counted them as active work. Settle now cancels
those automatic runs in the same transaction; user-queued messages still
block it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keep main's recycled mobile list and per-row clock scoping alongside V2 runtime ownership, subagent filtering, and unread completion labels. Preserve provider compatibility diagnostics and shared PR badge controls while retaining V2 authentication actions and linked-PR tooltips. Port main's PR batching and settlement quota improvements into the V2 services.
@mwolson
mwolson added this pull request to stack #36 September 27, 2026 21:48
@mwolson
mwolson force-pushed the contrib/ctm/opencode-runtime branch from 1fa1033 to e7f2a57 Compare September 30, 2026 20:01
@mwolson
mwolson force-pushed the contrib/ctm/legacy-wake-presentation branch from c701479 to b9e090b Compare October 1, 2026 12:38
@mwolson
mwolson removed this pull request from stack #36 October 1, 2026 12:39
@mwolson

mwolson commented Oct 1, 2026

Copy link
Copy Markdown
Owner Author

Replaced by Julius's upstream OpenCode 2 stack (pingdotgg#14239 oc2-1-runtime-probe onward), now carried on the fork as #45 oc2-4b-adapter-usage through #51 opencode2-continuation-ownership. Closing; the branch is kept.

@mwolson mwolson closed this Oct 1, 2026
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.