Skip to content
Source
Sign inSign up
pingdotgg/t3code

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

Closedmacodev00(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/12701/headopened View on GitHub

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.

Verification

From apps/server at commit 4f6663b646db:

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

Result: 2 files passed, 72 tests passed (3.50s). Regression coverage is the provider test that times out a hanging local CLI version probe after 10 seconds and the test that waits past the legacy four-second budget for a slow local CLI version probe, plus the registry tests that keep a ready OpenCode snapshot through a single version-probe timeout and do not keep last-known-good OpenCode state without a ready versioned snapshot.

vp run typecheck

Result: tsc --noEmit exited 0 (cache disabled). The compiler also printed 422 suggestion diagnostics and no error TS lines.

Limitations: Checked on Linux only. The slow version probe is covered by these unit tests with a test clock; a live OpenCode CLI was not exercised.

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.
    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    2. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      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 7445aa733ada33e45289e5aa5055f79142556513 and 4f6663b646db53321c244803a90b0cce15ab8254.

      📒 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

      Suggested reviewers: t3dotgg

      🚥 Pre-merge checks | ✅ 4 | ❌ 1

      ❌ Failed checks (1 warning)

      Check nameStatusExplanationResolution
      Description check⚠️ WarningThe description explains the problem, change, verification, limitations, and test results. It does not include the required Scope and approval section or explain the linked issue's triage and maintain…Add a Scope and approval section. Link the triaged issue or approval discussion and identify the maintainer approval comment. If no prior approval is required, explain why this is a focused fix of an obvious bug and provide the relevant sco…
      ✅ Passed checks (4 passed)
      Check nameStatusExplanation
      Linked Issues check✅ PassedThe 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✅ PassedAll 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✅ PassedNo 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✅ PassedThe title clearly and concisely describes the main change: allowing slower OpenCode version probes.
      Full details: Description check

      Explanation

      The description explains the problem, change, verification, limitations, and test results. It does not include the required Scope and approval section or explain the linked issue's triage and maintainer approval, or why this focused fix qualifies without them.

      Resolution

      Add a Scope and approval section. Link the triaged issue or approval discussion and identify the maintainer approval comment. If no prior approval is required, explain why this is a focused fix of an obvious bug and provide the relevant scope justification.

      • Fix all pre-merge checks with AI
      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create a new PR

      Comment `@coderabbitai help` to get the list of available commands.
    3. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      ⚠️ 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.

    4. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      ⚠️ 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.

    5. juliusmarminge added labelsmacroscope-review

    6. Approvability

      Verdict: Not approved

      Macroscope's review found this PR not approvable — The PR changes production provider health behavior by increasing the default OpenCode version-probe timeout and retaining last-known-good state after a timeout, with focused regression coverage. Because the hardcoded probe timeout is a product default, this change is policy-sensitive despite its limited scope.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    7. Superseding: Macroscope Not approved (eligibility/policy on OpenCode probe-timeout default). Opening a fresh READY redo from upstream main.

Sign in to join this conversation.