Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): a provider probe timeout no longer marks the provider broken #7232

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

Fixes #7230.

Problem

Provider status checks spawn CLI subprocesses on short fixed deadlines (4s for version probes, 10s for the Codex auth probe, 8s for cursor agent about, 4s and 15s for Grok). When the host is busy, a check misses its deadline and the timeout branch reports status: "error" with no version, and for Codex no models.

That snapshot is then treated as authoritative. makeManagedServerProvider publishes it, ProviderRegistry writes it to the per-instance status cache on disk, and the next boot hydrates from that cache. So one busy moment is persisted, survives a restart, and keeps the provider out of the new-session picker until a later check happens to win.

Hosts with several configured instances hit this most, because each instance refreshes on its own loop and the probes compete with each other for the same busy machine.

Fix

A timeout means the host was too busy to answer. That is not the same fact as the provider being broken, so the probes stop reporting it as one.

Codex, Claude, Cursor, and Grok status checks now fail with ProviderProbeTimeoutError, and makeManagedServerProvider decides what to publish:

  • After at least one successful check, the last known status, auth, version, and models are carried forward. Only checkedAt and message move. That still counts as a change, so the snapshot reaches clients and the cache, and a manual refresh is never a silent no-op.
  • Before the first successful check there is nothing worth carrying forward, so the timeout is reported plainly. Holding the pending placeholder instead would claim the check had not run, and for Codex that placeholder carries installed: false, which the settings panel renders as "Not found" — a worse and less true answer than the one it replaced.

Definite failures, including a missing CLI, are unchanged.

Per-provider decisions

Grok has two deadlines and both are converted. The 15s ACP one spawns a full ACP session and is the likelier of the pair to be missed, so converting only the cheap --version probe would have left the real problem in place.

OpenCode is deliberately unchanged. Its probe failure is an unreachable configured server (ECONNREFUSED, fetch failed, and similar), which is a real verdict about a remote endpoint rather than a local deadline, so reporting error is correct. If #6577 lands and gives OpenCode genuine spawn deadlines, those should raise ProviderProbeTimeoutError too.

The Claude capabilities probe (25s) and the Cursor ACP discovery probe (15s) already degrade without clobbering the snapshot, so they need no change.

Relationship to #5794

#5794 raises the Windows probe deadlines. It reduces how often the race is lost and is worth having on its own. It does not change what happens when a probe does time out, which is what this PR addresses. They compose: longer deadlines mean fewer timeouts, and a timeout that still happens no longer erases a working provider.

Testing

  • makeManagedServerProvider.test.ts: three new tests covering the carry-forward path, the publish-so-refresh-is-visible path, and the first-boot path.
  • Reworked the Codex probe-scope test, which asserted the old error snapshot. Its check that the spawned child is still killed on timeout is preserved.
  • vp run --filter t3 typecheck clean, vp lint apps/server/src/provider clean.
  • The Windows server suite has 74 pre-existing failures from shell escaping in the test harness (Unexpected args: ^"--version^"). I ran a baseline on untouched main and diffed failing test names; this change adds none. The only delta across runs is persists authoritative OpenCode removals..., which is flaky on Windows independently of this change (passes 2 of 3 runs on both).

Docs: docs/internals/providers.md gains a "Status probes and timeouts" section stating the contract for new drivers.

Model: Claude Opus 5; harness: Claude Code.


Note

Medium Risk Changes provider health and persistence behavior across multiple drivers; mistakes could leave stale “ready” status or confuse first-boot UX, but scope is localized to probe timeout handling with extensive tests.

Overview Provider health checks that miss their deadline no longer publish an error snapshot that gets cached and hides a working provider.

ProviderProbeTimeoutError is introduced so Claude, Codex, Cursor, and Grok probes signal a timeout instead of returning status: "error". makeManagedServerProvider catches it: after at least one successful non-error check it carries forward status, auth, version, and models and only updates checkedAt plus a timeout message (so refresh and the on-disk cache still move). With no usable prior status it reports an error using what the probe learned (installed, optional version). Stale enrichment is invalidated so late publishes cannot undo the timeout. Real failures (e.g. missing CLI) are unchanged.

Tests and docs/internals/providers.md document the contract for new drivers.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 41bbb0a2b285deb8bf9dbf229f200ed4a4d976f4. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Fix provider probe timeouts to preserve last known status instead of marking provider broken

  • Introduces ProviderProbeTimeoutError in providerSnapshot.ts as a structured error for probe timeouts, replacing the previous behavior of returning an error snapshot directly from each provider's status check function.
  • Updates ClaudeProvider, CodexProvider, CursorProvider, and GrokProvider to fail with ProviderProbeTimeoutError on timeout instead of building error snapshots internally.
  • makeManagedServerProvider now intercepts ProviderProbeTimeoutError: if a prior usable status exists, it carries that snapshot forward with an updated timestamp and a 'last known status' message; otherwise it emits an error snapshot reflecting what the probe established before timing out.
  • Stale enrichment fibers are cancelled on timeout to prevent them from overwriting the timeout outcome.
  • Behavioral Change: providers that previously became 'broken' on a slow probe now retain their last good status until the next successful check.
Macroscope summarized 41bbb0a.
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      Review in Change Stack →

      No actionable comments were generated in the recent review. 🎉

      ℹ️ Recent review info
      ⚙️ Run configuration
      • Configuration used: Path: .coderabbit.config.ts
      • Review profile: CHILL
      • Plan: Advanced
      • Run ID: ab23d4a4-610e-4197-9562-3f9552fc537e
      📥 Commits

      Reviewing files that changed from the base of the PR and between d81afa0a6f403bd6e5562ffcee2484089a1fdc3f and bb7eacceb277c9ab0d4b92dad23864f4197849d3.

      📒 Files selected for processing (10)
      • apps/server/src/provider/ClaudeProvider.ts
      • apps/server/src/provider/CodexProvider.ts
      • apps/server/src/provider/CursorProvider.test.ts
      • apps/server/src/provider/CursorProvider.ts
      • apps/server/src/provider/GrokProvider.ts
      • apps/server/src/provider/ProviderRegistry.test.ts
      • docs/internals/providers.md
      • packages/provider-core/src/server/managedProvider.test.ts
      • packages/provider-core/src/server/managedProvider.ts
      • packages/provider-core/src/server/snapshotProbe.ts

      Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.


      📝 Walkthrough

      Walkthrough

      Provider status checks now raise a typed error when a probe times out. Managed providers publish a timeout snapshot and preserve the last usable status when available. Tests cover timeout details, snapshot updates, and interrupted enrichment.

      Changes

      Provider probe timeout handling

      Layer / File(s)Summary
      Typed probe timeout errors
      packages/provider-core/src/server/snapshotProbe.ts, apps/server/src/provider/{ClaudeProvider,CodexProvider,CursorProvider,GrokProvider}.ts, apps/server/src/provider/{CursorProvider,ProviderRegistry}.test.ts
      The four provider checks now raise ProviderProbeTimeoutError on timeout, with provider, probe, timeout, and installation details. Tests check timeout errors and process cleanup.
      Managed timeout snapshots
      packages/provider-core/src/server/managedProvider.ts, packages/provider-core/src/server/managedProvider.test.ts, docs/internals/providers.md
      Managed providers publish timeout snapshots and preserve a prior usable status when available. Timeout handling interrupts active enrichment. Tests cover prior status, first checks, refreshes, and enrichment. Documentation describes the timeout behavior.

      Priority: ➖ Normal

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

      Change: Bug fix · Severity of issue fixed: Medium

      Sequence Diagram(s)

      sequenceDiagram
        participant ProviderCheck
        participant ManagedProvider
        participant StatusStream
        ProviderCheck->>ManagedProvider: Returns ProviderProbeTimeoutError
        ManagedProvider->>ManagedProvider: Preserves usable status or sets error status
        ManagedProvider->>StatusStream: Publishes updated snapshot

      Suggested reviewers: juliusmarminge

      Merge Risk: ⚪ Minimal · up to bb7ea

      A timed-out provider status check now keeps the last known good status instead of marking a working provider broken. No merge-blocking risk was identified. A first-ever check that times out on a slow machine can still show an error, as the PR describes.

      Security Architecture Review

      Security architecture risk: 🔵 Low · up to bb7ea

      Slow checks no longer erase usable provider status. No new privilege or credential access was established, but previously reported authentication can remain visible during repeated timeouts, and restart behavior has limitations.

      Retained concerns No architecture-level concerns identified.

      Security review details

      Security Blast Radius

      • inferred — The evidenced propagation scope is the four changed provider probes, shared managed snapshots, registry consumers and per-instance status persistence. The change preserves metadata and selection eligibility; broader tenant, datastore or deployment authority expansion was not established by this bounded review.

      Trust Boundaries and Controls

      • observed — Live snapshots must match their source instance and driver. Cache hydration likewise requires matching instance and driver and respects the current enabled state. These existing controls constrain cross-instance reuse of preserved metadata.
      • observed — In the inspected Codex path, adapter construction takes instance configuration and environment rather than snapshot authentication. Live subprocess startup derives the executable, arguments and CODEX_HOME from those settings. Timeout preservation does not supply new credentials or change this execution boundary.
      • observed — The new timeout message contains provider, probe and duration, and timeout logging records those same structured identifiers. This new path does not copy subprocess stdout or stderr into the published timeout diagnostic.

      Resilience and Maintainability Implications

      • observed — Inspected subprocess collection remains scope-owned, and managed-provider background work is forked within its lifecycle scope. Timeout classification does not replace these cleanup owners; generation retirement additionally limits stale enrichment publication. Actual process termination under interruption was not exercised.

      Hardening Proposals

      • proposed — Consider representing last successful validation separately from the latest check attempt, so consumers can distinguish preserved authentication metadata from freshly validated status without interpreting message text. This is a hardening proposal, not an observed authorization bypass.
      🚥 Pre-merge checks | ✅ 3 | ❌ 1

      ❌ Failed checks (1 warning)

      Check nameStatusExplanationResolution
      Linked Issues checkWarningThe implementation satisfies the carry-forward path after a successful non-error probe. makeManagedServerProvider publishes the prior snapshot with a new checkedAt and timeout message, cancels enr…Treat a non-error hydrated initial snapshot as usable, or otherwise preserve the current non-error snapshot on a first timeout. Keep the timeout publish and retry behavior so the timeout is visible without marking the provider broken.
      ✅ Passed checks (3 passed)
      Check nameStatusExplanation
      Title checkPassedThe title is concise, uses the repository's conventional format, and accurately summarizes the main behavior change: provider probe timeouts no longer mark providers as broken.
      Description checkPassedThe description clearly explains the problem, implementation, provider-specific decisions, scope, testing, documentation, and known pre-existing failures. It uses a "Fix" section instead of the templa…
      Out of Scope Changes checkPassedThe changed provider probes, ProviderProbeTimeoutError, managed-provider handling, tests, and provider documentation all support #7230's timeout and persistence behavior. The implementation leaves O…
      Full details: Linked Issues check

      Explanation

      The implementation satisfies the carry-forward path after a successful non-error probe. makeManagedServerProvider publishes the prior snapshot with a new checkedAt and timeout message, cancels enrichment, and leaves settings eligible for a later probe. However, hasUsableStatus starts as false even when initialSnapshot is a hydrated cached ready or warning snapshot. A first timeout therefore changes that snapshot to status: "error" and can cache the error. This does not meet #7230's requirement that every timed-out check leave the provider as it was, including after restart. The new first-boot test documents this exception instead of preventing it.

      • Fix all pre-merge checks with AI
      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create a new PR
      • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

      Comment `@coderabbitai help` to get the list of available commands.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    3. One convention issue found in the new timeout handling. See the inline comment.

      Posted via Macroscope — Effect Service Conventions
      @@ -121,4 +173,15 @@
      121173 return yield* Ref.get(snapshotStateRef).pipe(Effect.map((state) => state.snapshot));
      122174 }
      123175
      124- const nextSnapshot = yield* input.checkProvider;
      176+ const checkOutcome = yield* input.checkProvider.pipe(
      177+ Effect.tap(() => Ref.set(hasCompletedCheck, true)),
      178+ Effect.catchTag("ProviderProbeTimeoutError", (error) =>
      179+ Effect.logWarning("Provider status probe timed out.").pipe(
      180+ Effect.annotateLogs({
      181+ "provider.name": error.provider,
      182+ "provider.probe": error.probe,
      183+ "provider.probe.timeout_ms": error.timeoutMs,
      184+ }),
      185+ Effect.as(error),
      186+ ),
      187+ ),

      Effect.catchTag is not used in this codebase's Effect conventions — statically known tagged failures should be recovered with Effect.catchTags({ ... }), even when only one tag is handled (the rest of provider/ already does this, e.g. Drivers/CodexHomeLayout.ts). Consider switching to the record form:

      Suggested change
      178- Effect.catchTag("ProviderProbeTimeoutError", (error) =>
      179- Effect.logWarning("Provider status probe timed out.").pipe(
      180- Effect.annotateLogs({
      181- "provider.name": error.provider,
      182- "provider.probe": error.probe,
      183- "provider.probe.timeout_ms": error.timeoutMs,
      184- }),
      185- Effect.as(error),
      186- ),
      187- ),
      178+ Effect.catchTags({
      179+ ProviderProbeTimeoutError: (error) =>
      180+ Effect.logWarning("Provider status probe timed out.").pipe(
      181+ Effect.annotateLogs({
      182+ "provider.name": error.provider,
      183+ "provider.probe": error.probe,
      184+ "provider.probe.timeout_ms": error.timeoutMs,
      185+ }),
      186+ Effect.as(error),
      187+ ),
      188+ }),

      If the recovery branch instead returned snapshotAfterProbeTimeout(error) directly from catchTags, the error-as-success-value round trip and the module-private isProviderProbeTimeoutError = Schema.is(...) narrowing at line 25 would no longer be needed.

      Posted via Macroscope — Effect Service Conventions

      Adopted, thanks. Switched to Effect.catchTags and took the second half of the suggestion too: the catch now calls snapshotAfterProbeTimeout(error) directly and yields Option.none(), so the error-as-success-value round trip and the private Schema.is narrowing are both gone.

      One correction for the rule's wording: Effect.catchTag is used elsewhere in the repo (apps/server/src/auth/http.ts:196 and :411), so it is not unused. The record form is still the better fit here and the simplification it enabled was worth it on its own.

      Sorry, I'm unable to act on this request because you do not have permissions within this repository.

    4. Cursor Bugbot has reviewed your changes using high effort and found 3 potential issues.

      Fix All in Cursor ❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the [Cursor dashboard](https://www.cursor.com/dashboard/bugbot).

      Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.

      Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 503e227eb95880d8c9db029c5c4af8bdba21f271. Configure [here](https://www.cursor.com/dashboard/bugbot).
    5. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Not approved

      Macroscope's review found this PR not approvable — This changes live provider-health and persisted-cache behavior across four providers and shared management code, including carry-forward state and stale enrichment cancellation. The timeout intent is focused and well tested, but the cross-cutting runtime semantics merit human review.

      Notes:

      • Macroscope's correctness review did not run, so approvability was decided on eligibility alone.
      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    6. On packaged T3 Code 0.0.40 on Windows 11, direct Codex initialization and model listing completed in 225 ms, but T3's full Codex provider checks took 18.764 and 19.080 seconds. The stock 10-second deadline consistently reported the provider unavailable. Changing only the Codex status deadline from 10 to 60 seconds made the same checks return ready with Codex 0.154.0 and six models. This suggests #7232's last-known-good handling should be combined with a longer Windows deadline, because its first-success path can still fail indefinitely when valid checks consistently exceed 10 seconds.

    7. +1 from a Windows 11 / T3 Nightly / Cursor user.

      Still hitting the pre-fix behavior from #7230: a busy agent about probe times out, Cursor flips to error, and the live session dies. The CLI answers about in ~1.4s when idle. Settings → Providers → Refresh recovers it.

      Please merge this. Keeping last-known-good status on probe timeout is the right behavior; the current error snapshot is taking down working sessions.

    8. juliusmarminge added labelsmacroscope-review

    9. Note

      Posted by an AI agent on behalf of Tyler.

      Rebased onto current main and ported to the provider-core layout. Codex, Claude, Cursor and Grok timeouts now raise ProviderProbeTimeoutError, and the managed provider keeps the last usable status instead of publishing an error. The very first check can still time out on slow machines (the Windows case above), since there is nothing to fall back to yet. A longer Codex deadline would be a separate change.

    10. github-actions[bot](GitHub profile, opens in a new tab) removed labelsvouch:unvouched

    11. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    12. Note

      Written by claude-opus-5-5 on behalf of Maria

      Hi! We are cleaning up open PRs, and this one appears to have been created with an older model (opus 5). If this change is really important, we recommend rebuilding the PR with a newer model if possible.

    13. maria-rcks closed this

    14. Note

      Written by claude-opus-5-5 on behalf of Maria

      Reopening, this was closed by mistake. Sorry for the noise!

    15. maria-rcks reopened this

    16. Note

      Written by claude-opus-5-5 on behalf of Maria

      Closing again after a second look, sorry for the back and forth. This PR has merge conflicts with main and was opened more than two weeks ago. If this change is still important, please rebuild it on current main with a newer model and note the model in the PR description.

    17. maria-rcks closed this

Sign in to join this conversation.