Skip to content

fix(server): tolerate slow OpenCode version probes - #12701

Open
macodev00 wants to merge 1 commit into
pingdotgg:mainfrom
macodev00:cursor/opencode-probe-timeout-ce65
Open

macodev00 wants to merge 1 commit into
pingdotgg:mainfrom
macodev00:cursor/opencode-probe-timeout-ce65

Conversation

@macodev00

@macodev00 macodev00 commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

What Changed

Raise OpenCode CLI version-probe timeout from 4s to 10s (OPENCODE_VERSION_PROBE_TIMEOUT in OpenCodeProvider.ts). Process-group kill on timeout is unchanged.

In mergeProviderSnapshot: if a probe times out after a ready, versioned snapshot, keep that version/auth/ready status (plus cached models/skills) instead of flipping to error. First-boot timeouts with no prior version still error. Missing binary / inventory failures still error.

Fixes #11080

Why

The 4s budget was added for hung wrappers (#8750), not slow-but-healthy OpenCode startups (e.g. ARM under load). A single timeout was clearing ready status and making the provider look Unavailable.

UI Changes

No UI change. Provider health behavior only. Screenshots/video not applicable.

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

Summary by CodeRabbit

  • Bug Fixes
    • OpenCode version checks now allow up to 10 seconds, improving detection on slower or heavily loaded systems.
    • When a refresh times out, previously confirmed OpenCode provider details remain available instead of being cleared.
    • Providers without a previously confirmed version continue to show an error when version detection times out.

Cold wrappers and loaded hosts can take more than 4s for `opencode --version`,
which flipped a working provider to Unavailable. Raise the probe budget to 10s
and keep the last ready version/status through a single timeout. Hung probes
are still process-group killed at the cap.

Fixes pingdotgg#11080
@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Sep 20, 2026
@macodev00
macodev00 marked this pull request as ready for review September 20, 2026 08:39
@coderabbitai

coderabbitai Bot commented Sep 20, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: pingdotgg/t3code/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 175df7ab-a4fd-4c68-8b91-3bf079503415

📥 Commits

Reviewing files that changed from the base of the PR and between 7445aa7 and 4f6663b.

📒 Files selected for processing (4)
  • apps/server/src/provider/Layers/OpenCodeProvider.test.ts
  • apps/server/src/provider/Layers/OpenCodeProvider.ts
  • apps/server/src/provider/Layers/ProviderRegistry.test.ts
  • apps/server/src/provider/Layers/ProviderRegistry.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review.


📝 Walkthrough

Walkthrough

The OpenCode version probe timeout increases from 4 to 10 seconds. Tests cover delayed probes and hanging probes. Provider snapshot merging preserves ready, versioned OpenCode state after a version-probe timeout.

Changes

OpenCode version probe timeout handling

Layer / File(s) Summary
Version probe timeout and test coverage
apps/server/src/provider/Layers/OpenCodeProvider.ts, apps/server/src/provider/Layers/OpenCodeProvider.test.ts
The probe timeout is 10 seconds. Test runtime state can delay version output. Tests cover five-second delays and ten-second timeouts.
Provider snapshot preservation
apps/server/src/provider/Layers/ProviderRegistry.ts, apps/server/src/provider/Layers/ProviderRegistry.test.ts
The registry detects OpenCode version-probe timeouts and preserves status, version, auth, models, slash commands, and skills when the previous snapshot was ready and versioned. Pending snapshots remain errors without a version.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix · Severity of issue fixed: Low

Sequence Diagram(s)

sequenceDiagram
  participant OpenCodeProvider
  participant ProviderRegistry
  participant OpenCodeCLI
  OpenCodeProvider->>OpenCodeCLI: Run --version
  OpenCodeCLI-->>OpenCodeProvider: Return version or exceed probe timeout
  OpenCodeProvider->>ProviderRegistry: Submit provider snapshot
  ProviderRegistry-->>OpenCodeProvider: Preserve eligible last-known-good state
Loading

Suggested reviewers: t3dotgg

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes satisfy the coding requirements in [#11080]. OPENCODE_VERSION_PROBE_TIMEOUT increases from 4 seconds to 10 seconds. The timeout test verifies the new limit. A new slow-probe test verifie…
Out of Scope Changes check ✅ Passed All changed files support [#11080]. The runtime test delay, timeout assertions, provider snapshot merge logic, and registry tests directly cover slow OpenCode startup and last-known-good state retenti…
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 4…
Title check ✅ Passed The title clearly and concisely describes the main change: allowing slow OpenCode version probes.
Description check ✅ Passed The description includes the required What Changed, Why, UI Changes, and Checklist sections. It explains the timeout increase, last-known-good behavior, retained timeout behavior, and test scope. The …
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

Comment @coderabbitai help to get the list of available commands.

@macodev00

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Already reviewed the last commit. Use @coderabbitai full review to rerun a review of the entire changeset.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@macodev00

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Already reviewed the last commit. Use @coderabbitai full review to rerun a review of the entire changeset.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in 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

1 participant