Skip to content

fix(server): keep a ready OpenCode provider through a slow version probe - #75

Closed
macodev00 wants to merge 9 commits into
mainfrom
cursor/opencode-probe-timeout-redo1-1796
Closed

macodev00 wants to merge 9 commits into
mainfrom
cursor/opencode-probe-timeout-redo1-1796

Conversation

@macodev00

@macodev00 macodev00 commented Oct 1, 2026 •

Copy link
Copy Markdown
Owner

Fixes pingdotgg#11080.

This supersedes pingdotgg#12701. Macroscope was Not approved for raising the hardcoded OpenCode --version timeout.

What Changed

A slow opencode --version keeps the last ready, versioned snapshot: status, version, auth, and catalog. The 4 second default stays 4 seconds. T3CODE_OPENCODE_VERSION_PROBE_TIMEOUT can raise the wait. Accepted values are clamped to 1–60 seconds, and invalid values are ignored. A first probe with no prior version still errors. A missing opencode binary still errors.

The timeout is read from that environment variable on the machine running T3 Code. The OpenCode user guide mentions the variable. There is no settings-schema field and no settings form control.

Why

OpenCode health checks run opencode --version and fail the provider when it does not return within 4 seconds. That budget was added in pingdotgg#8750 to kill hung probes (pingdotgg#8681). A cold start on a loaded or ARM host can land just past it, and the provider then shows Unavailable even though it had already reported a version. pingdotgg#12701 raised the hardcoded timeout to 10 seconds. This leaves the production default at 4 seconds, makes a longer wait opt-in, and keeps an already ready provider through a timeout.

Verification

Node 24.13.1. vp was /workspace/node_modules/.bin/vp (vite-plus 1.0.0).

Server typecheck, from apps/server:

vp run typecheck

Exit 0. tsc --noEmit printed existing suggestions in unrelated files (CodexInstallation.ts, CodexAdapter.test.ts, CodexProvider.ts, ws.ts). No errors in this change.

Format, from the repo root:

vp fmt apps/server/src/provider/Layers/OpenCodeProvider.ts apps/server/src/provider/Layers/OpenCodeProvider.test.ts apps/server/src/provider/Layers/ProviderRegistry.ts apps/server/src/provider/Layers/ProviderRegistry.test.ts docs/user/providers-opencode.md

Exit 0. Finished on 5 files. The working tree stayed clean.

Lint, from the repo root:

vp lint --report-unused-disable-directives apps/server/src/provider/Layers/OpenCodeProvider.ts apps/server/src/provider/Layers/OpenCodeProvider.test.ts apps/server/src/provider/Layers/ProviderRegistry.ts apps/server/src/provider/Layers/ProviderRegistry.test.ts docs/user/providers-opencode.md

Exit 0. No findings.

From apps/server:

vp test run src/provider/Layers/OpenCodeProvider.test.ts

1 file passed, 22 tests passed.

From apps/server:

vp test run src/provider/Layers/ProviderRegistry.test.ts

1 file passed, 56 tests passed.

Limitations: these checks did not launch a slow OpenCode binary on a loaded host; the timeout and last-known-good behavior are covered by the server tests above.

Docs note (c9ac543fd, Linux, Node v24.13.1): JSDoc only, on normalizeProbeMessage and normalizedErrorMessage. CodeRabbit's 50% pair is those function declarations next to formatOpenCodeProbeError. Comments on checkOpenCodeProviderStatus are not in that pair. Re-ran from the repo root:

./node_modules/.bin/vp test run apps/server/src/provider/Layers/ProviderRegistry.test.ts apps/server/src/provider/Layers/OpenCodeProvider.test.ts

Test Files 2 passed (2), Tests 79 passed (79), 3.66s.

./node_modules/.bin/vp lint --report-unused-disable-directives apps/server/src/provider/Layers/OpenCodeProvider.ts apps/server/src/provider/Layers/ProviderRegistry.ts

Exit 0.

./node_modules/.bin/vp fmt --check apps/server/src/provider/Layers/OpenCodeProvider.ts

Exit 0. All matched files use the correct format.

./node_modules/.bin/vp run --filter t3 typecheck

Exit 0. Same pre-existing suggestions in CodexInstallation.ts, CodexAdapter.test.ts, CodexProvider.ts, and ws.ts. None in this change.

UI Changes

None. Provider health behavior only. There is no settings form change, so there are no before/after screenshots.

Checklist

Grok 4.7, Cursor cloud agent.

Open in Web Open in Cursor 

t3dotgg and others added 3 commits September 30, 2026 23:40
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…nup (pingdotgg#14553)

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:XXL labels Oct 1, 2026
A timeout on opencode --version keeps the last ready, versioned snapshot.
The 4 second default is unchanged. T3CODE_OPENCODE_VERSION_PROBE_TIMEOUT
can raise it, clamped to 1-60 seconds. A first probe with no prior version
and a missing binary still error.

Fixes pingdotgg#11080.
@cursor
cursor Bot force-pushed the cursor/opencode-probe-timeout-redo1-1796 branch from 219462b to c37210d Compare October 1, 2026 08:49
cursoragent and others added 5 commits October 1, 2026 10:34
A non-timeout launch failure was classified as a timeout when binaryPath
contained "version probe timed out", so the last ready snapshot was kept.
The merge now requires the provider message to equal the exact timeout
text, including its duration label.

Fixes pingdotgg#11080.

Verification:
vp test run apps/server/src/provider/Layers/ProviderRegistry.test.ts apps/server/src/provider/Layers/OpenCodeProvider.test.ts

Test Files  2 passed (2)
     Tests  79 passed (79)
  Duration  3.18s

Model: Grok 4.7 via Cursor cloud agent

Co-authored-by: maco <macodev00@users.noreply.github.com>
CodeRabbit docstring coverage on PR pingdotgg#14575 was 0.00% (threshold 80%, one function across four files). Added JSDoc on the production functions this change touches, including the exact timeout match and the probe error formatter. No runtime behavior change.

Verification:
./node_modules/.bin/vp test run apps/server/src/provider/Layers/ProviderRegistry.test.ts apps/server/src/provider/Layers/OpenCodeProvider.test.ts
Test Files  2 passed (2)
     Tests  79 passed (79)
  Duration  3.31s

./node_modules/.bin/vp lint --report-unused-disable-directives apps/server/src/provider/Layers/OpenCodeProvider.ts apps/server/src/provider/Layers/ProviderRegistry.ts
exit 0

./node_modules/.bin/vp run --filter t3 typecheck
exit 0 (pre-existing suggestions only; none in these files)

Model: Grok 4.7 via Cursor cloud agent

Co-authored-by: maco <macodev00@users.noreply.github.com>
CodeRabbit docstring coverage on PR pingdotgg#14575 was 50.00% (threshold 80%, two functions across four files). The status-check JSDoc sat above the export, so it did not cover the function* passed to Effect.fn. That comment now precedes the generator. No runtime behavior change.

Verification (Node v24.13.1):

./node_modules/.bin/vp test run apps/server/src/provider/Layers/ProviderRegistry.test.ts apps/server/src/provider/Layers/OpenCodeProvider.test.ts
Test Files  2 passed (2)
     Tests  79 passed (79)
  Duration  3.79s

./node_modules/.bin/vp lint --report-unused-disable-directives apps/server/src/provider/Layers/OpenCodeProvider.ts apps/server/src/provider/Layers/ProviderRegistry.ts
exit 0

./node_modules/.bin/vp fmt --check apps/server/src/provider/Layers/OpenCodeProvider.ts
exit 0 (all matched files use the correct format)

./node_modules/.bin/vp run --filter t3 typecheck
exit 0 (pre-existing suggestions only in CodexInstallation.ts, CodexAdapter.test.ts, CodexProvider.ts, and ws.ts; none in these files)

Model: Grok 4.7 via Cursor cloud agent

Co-authored-by: maco <macodev00@users.noreply.github.com>
CodeRabbit docstring coverage on PR pingdotgg#14575 stayed at 50% after the
status-check comment moved onto the Effect.fn generator. That comment
documents the generator, and the exported binding needs its own JSDoc
immediately above the declaration. No runtime behavior change.

Verification (Node v24.13.1, linux):

./node_modules/.bin/vp test run apps/server/src/provider/Layers/ProviderRegistry.test.ts apps/server/src/provider/Layers/OpenCodeProvider.test.ts
Test Files  2 passed (2)
     Tests  79 passed (79)
  Duration  3.25s

./node_modules/.bin/vp lint --report-unused-disable-directives apps/server/src/provider/Layers/OpenCodeProvider.ts apps/server/src/provider/Layers/ProviderRegistry.ts
exit 0

./node_modules/.bin/vp fmt --check apps/server/src/provider/Layers/OpenCodeProvider.ts
exit 0 (all matched files use the correct format)

./node_modules/.bin/vp run --filter t3 typecheck
exit 0 (pre-existing suggestions only in CodexInstallation.ts, CodexAdapter.test.ts, CodexProvider.ts, and ws.ts; none in these files)

Model: Grok 4.7 via Cursor cloud agent

Co-authored-by: maco <macodev00@users.noreply.github.com>
CodeRabbit's 50% score is the two function declarations beside the probe
error formatter, not the Effect.fn status check. normalizedErrorMessage
had no docstring. normalizeProbeMessage is documented too, because the
new comment hunk would otherwise count that preceding declaration as
undocumented.

Co-authored-by: maco <macodev00@users.noreply.github.com>
@macodev00

Copy link
Copy Markdown
Owner Author

Opened upstream as pingdotgg#14575.

@macodev00 macodev00 closed this Oct 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XXL vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: OpenCode provider flagged Unavailable when CLI version probe exceeds hardcoded 4s

3 participants