Skip to content

fix(coordinator): retain healthy speculative attempts after terminal errors - #987

Closed
Gajesh2007 wants to merge 2 commits into
masterfrom
fix/speculative-race-terminal-order
Closed

Gajesh2007 wants to merge 2 commits into
masterfrom
fix/speculative-race-terminal-order

Conversation

@Gajesh2007

@Gajesh2007 Gajesh2007 commented Sep 12, 2026 •

Copy link
Copy Markdown
Member

When a speculative provider fails before content, its error is queued before its chunk channel closes. Selecting the closed chunk previously cancelled the healthy racer before checking that error: a primary failure abandoned the backup and retried, while a backup failure waited on an already-cancelled primary.

Resolve both closed-chunk errors through the existing direct-error transitions before winner cancellation. The survivor keeps its pending request, settlement decision and remaining first-content deadline. Buffered content still wins ahead of its later error. Extract four terminal operations from dispatch.go and remove the duplicate closed-backup wait loop; production source shrinks by 107 lines.

Before:

flowchart LR
  E[Provider error queued and ChunkCh closed] --> R[runRace selects closed ChunkCh]
  R --> C[cancelDispatch on healthy racer]
  C --> P[Primary error: retry despite live backup]
  C --> B[Backup error: wait on cancelled primary]
Loading

After:

flowchart LR
  E[Provider error or closed ChunkCh] --> R[runRace terminal operation]
  R --> Q[resolvePrimaryRaceError or resolveBackupRaceError]
  Q --> F[Retire failed attempt]
  F --> S[Keep survivor pending and allow settlement]
  S --> W[Existing remaining-deadline wait]
  W --> C[Survivor content commits]
Loading

Validation at source d5c07ea67c37abda2fff856eacfeeff7ffd033e2:

  • Deterministic primary/backup regressions fail in 0.587s against master 7c394fa2b after only a behavior-preserving extraction of its selected chunk-handler bodies. The real provider error handler supplies the terminal; both original handlers remove the live survivor. This is selected-branch coverage, not a claim that Go select order is deterministic.
  • Focused Go 1.25 race checks pass in 3.921s, including the new race/winner cases and existing speculative/deadline controls. The final fixture also replaces terminal receives with nonblocking assertions.
  • Full API race suite passes in 226.818s at the final source, with both database environment variables unset. No native provider or live-fleet execution is claimed.
  • Independent root and coordinator peer reviews are clean. Documentation check passes for 278 files; both commits have verified SSH signatures.

Source scope is terminal ownership and duplicate control-flow cleanup. Routing thresholds, hedge timing, protocol fields and model behavior are unchanged.

@vercel

vercel Bot commented Sep 12, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
d-inference Ready Ready Preview Sep 12, 2026 11:20pm UTC
d-inference-console-ui-dev Ready Ready Preview Sep 12, 2026 11:20pm UTC
d-inference-landing Ready Ready Preview Sep 12, 2026 11:20pm UTC

Request Review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 12, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-12T23:26:20.075750Z 8b27e90 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Gajesh2007

Copy link
Copy Markdown
Member Author

Consolidated into #1056 for review and merge after #1094, #1095 and #1096. #1056 contains this branch's exact head (8b27e90806822a45b95f7d3d47965aa94640b3f8), including its reviewed fixes, with implementations and regressions reconciled into the coordinator subsystem owners. Closing the component PR to collapse the stack; its branch, commits and review history are retained. Follow #1056 for combined validation and merge status.

@Gajesh2007 Gajesh2007 closed this Sep 16, 2026

This branch had an error being deployed

1 failed and 3 active deployments
Preview – d-inference — 8b27e908 Deployed Sep 12, 2026 by vercel[bot]
Preview – d-inference-console-ui-dev — 8b27e908 Deployed Sep 12, 2026 by vercel[bot]
benchmarks — 8b27e908 Deployed Sep 12, 2026 by Gajesh2007 via E2E Benchmarks #1088
Preview – d-inference-landing — 8b27e908 Deployed Sep 12, 2026 by vercel[bot]
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.

1 participant