Skip to content

Harden capacity readiness, quote expiry and request sizing - #943

Closed
Gajesh2007 wants to merge 4 commits into
masterfrom
refactor/coordinator-capacity
Closed

Gajesh2007 wants to merge 4 commits into
masterfrom
refactor/coordinator-capacity

Conversation

@Gajesh2007

@Gajesh2007 Gajesh2007 commented Sep 12, 2026 •

Copy link
Copy Markdown
Member

Capacity operations had three discrepancies: expiry cleanup could strand a live quote collector; public readiness could advertise a provider/model pair that routing rejects; and prompt-plus-output arithmetic could overflow below a known token limit. Fix those paths using the existing delivery and routing policies, and share request-size and dedicated-pattern normalization.

Before:

flowchart LR
  S[quoteTracker expiry sweep] --> D[Delete entry without delivery]
  D --> W[Collector waits indefinitely]
  C[ModelCapacitySnapshot] --> H[Concurrency and token headroom]
  H --> R[Broken template or mixed dedicated box can appear ready]
  Q[Prompt and output counts] --> A[Repeated signed addition]
  A --> O[Overflow can pass known limits]
  P[CSV parser and startup setter] --> N[Separate pattern normalization loops]
Loading

After:

flowchart LR
  S[quoteTracker expiry sweep] --> D[Claim and buffer timeout delivery]
  D --> W[Collector demotes plan, publishes outcome, closes]
  C[ModelCapacitySnapshot] --> G[Existing public model routing gates]
  G --> F[Shared fleet fallback when breakers alone remove all routes]
  F --> H[Same concurrency and token headroom]
  H --> R[Readiness matches gates; model inventory remains]
  Q[Prompt and output counts] --> A[Shared normalized uint64 sum]
  A --> O[Known context and budget checks cannot wrap]
  P[CSV parser and startup setter] --> N[One dedicated-pattern normalizer]
Loading

The request-size helper preserves negative-prompt normalization and the default output allowance. Two nonnegative int counts fit in uint64; only the displayed RequestTokens field saturates at the largest int when the sum is unrepresentable. Unknown budgets retain fail-open behavior. Capacity inventory remains visible while readiness includes the existing public model gates and fleet-wide breaker/ejection fallback. Only affected models run the shared candidate scan with a minimal positive text reservation; healthy-but-busy peers suppress fail-open, and the read-only scan never commits or claims capacity. No wire schema, model reserve, quality-cap default, or pooled-KV numerical policy changes.

All eight assigned capacity/servability production files were inspected. Stable shared/private pool reconstruction, per-class solo-rate resolution, rejection ordering and inline KV-rate storage were retained. The focused normalization removes duplication; the correctness fixes and regression coverage increase the overall diff.

Validation:

  • Actual WebSocket/dispatch-plan expiry fixture fails on master because the collector never settles; corrected source emits one timeout after demotion and closes.
  • Actual routing versus capacity fixtures fail on master for broken-template and mixed dedicated-family pairs; corrected source keeps their model/warm inventory but reports not ready.
  • Oversized request fixture fails on master for context, structural fleet and known provider budgets; corrected source rejects and preserves unknown-budget fallback.
  • GOTOOLCHAIN=go1.25.0 go test -race ./coordinator/registry -count=1: PASS, 24.679s. Added explicit inventory-preservation assertion then reran its race test: PASS, 1.473s.
  • Codex identified the missing fleet-wide health-breaker valve; ten added matrix cases compare capacity with actual dispatch. Four fail on the prior PR head. Corrected full registry race suite PASS24.626s; independent review of the corrected source/new tests is clean.
  • Added the required Unreleased changelog entry; docs lint passes for all278 pages.
  • All 13 associated test/benchmark files were inspected, including the executable assertions throughout the three large legacy matrices. Historical measurements were retained and benchmarks were not rerun as performance evidence. No model execution.

CI limitation: the Threat Model Review job fails before reviewing source because its Anthropic API key returns HTTP401 (invalid key). Local race validation above is complete; credentials were not changed.

@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 12:44am UTC
d-inference-console-ui-dev Ready Ready Preview Sep 12, 2026 12:44am UTC
d-inference-landing Ready Ready Preview Sep 12, 2026 12:44am UTC

Request Review

@Gajesh2007

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6c418446d6

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread coordinator/registry/model_capacity.go Resolved
Comment thread docs/architecture/routing.md Resolved
@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-12T01:00:07.439419Z 9c88a77 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

@codex review Both findings are fixed at 9c88a77; please review the corrected fleet fallback and changelog against the current PR base/head.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: 9c88a7716a

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Gajesh2007

Copy link
Copy Markdown
Member Author

Superseded by #1051, which carries this change and its regression coverage into the coordinator subsystem layout. The replacement passed the relevant local race tests, build/lint checks, and independent source review.

Please review #1051; closing this older implementation to keep one active version of the change. The branch and review history are retained. No change has been merged to master by this closure.

This branch is waiting to be deployed

3 active and 1 waiting deployments
Preview – d-inference — 9c88a771 Deployed Sep 12, 2026 by vercel[bot]
Preview – d-inference-console-ui-dev — 9c88a771 Deployed Sep 12, 2026 by vercel[bot]
Preview – d-inference-landing — 9c88a771 Deployed Sep 12, 2026 by vercel[bot]
benchmarks — 9c88a771 Waiting Sep 12, 2026 by Gajesh2007 via E2E Benchmarks #1031
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