Skip to content

fix(runtime): classify expired probe budget as timeout - #2344

Merged
Astro-Han merged 1 commit into
apache:mainfrom
liugddx:fix/runtime-probe-deadline-classification
Aug 7, 2026
Merged

fix(runtime): classify expired probe budget as timeout#2344
Astro-Han merged 1 commit into
apache:mainfrom
liugddx:fix/runtime-probe-deadline-classification

Conversation

@liugddx

@liugddx liugddx commented Aug 6, 2026

Copy link
Copy Markdown
Member

Summary

  • classify an already-exhausted shared OpenCode fallback budget as timeout
  • avoid starting a provider request after the strict deadline has elapsed
  • remove the test assumption that at least one probe must start before a shared deadline expires

Why

If the process is descheduled for the full 40ms test budget before the first fallback iteration, no probe starts and lastFailure remains empty. The old fallback then reported provider_unavailable, even though the only known fact is that the shared deadline expired. This caused a CI flake and exposed an incorrect production edge classification.

Validation

  • npm --workspace @maka/core run build
  • npm --workspace @maka/runtime run build
  • target deadline test repeated 30 times
  • node --test packages/runtime/dist/__tests__/opencode-free-anonymous.test.js (7 pass)
  • Biome and git diff --check

@liugddx
liugddx force-pushed the fix/runtime-probe-deadline-classification branch from 57eca2a to 2c6a579 Compare August 7, 2026 00:20
@liugddx

liugddx commented Aug 7, 2026

Copy link
Copy Markdown
Member Author

@Astro-Han

@Astro-Han Astro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks — this is a clean, minimal reclassification. We traced the reachability: on the dominant path (all candidates fail, last one aborted) the old code already returned timeout, so the real change is the unreachable-in-production index-0 budget-expiry corner, and every reachable outcome is field-for-field identical to the old behavior. Consumers (connections:test status patch, runtime-host summary, redaction of 'Fetch timeout') all map consistently; no retry/metric consumers exist. 7/7 + 10/10 + 19/19 green.

Two optional notes:

  • The deleted assert.ok(requestedModels.length > 0) (opencode-free-anonymous.test.ts:244,254-255,273) was the only assertion that could distinguish 'probes were actually issued' from 'no probe was ever issued'. Under the new semantics the test would pass even if the loop never fired a single request. Keeping it (it still passes on a normal machine) or an equivalent counting assertion would keep the deadline test load-bearing.
  • The lastFailure ?? timeout fallback at test-connection.ts:171 is dead code (the candidate list is statically non-empty and index-0 expiry is pre-returned) — harmless, could be simplified.

Merging.

@Astro-Han
Astro-Han merged commit 0731bfa into apache:main Aug 7, 2026
11 checks passed
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.

2 participants