Skip to content

Simplify heartbeat counter handling and fix fleet version gauge race - #934

Closed
Gajesh2007 wants to merge 2 commits into
masterfrom
refactor/coordinator-heartbeat
Closed

Gajesh2007 wants to merge 2 commits into
masterfrom
refactor/coordinator-heartbeat

Conversation

@Gajesh2007

@Gajesh2007 Gajesh2007 commented Sep 12, 2026 •

Copy link
Copy Markdown
Member

Fleet version gauges read Provider.Version after releasing the mutex, racing with registration's SetVersion. Capture status and version together under the existing provider lock. A concurrent test reproduces the race on master and passes after the fix.

Heartbeat ingestion also repeated signed integer clamp branches and optional session-counter retention. Use direct integer bounds and the existing field-pair loop. Float rejection policies remain explicit: invalid load headroom becomes absent and invalid observed prefill becomes zero, preserving conservative routing estimates. Sequence ordering, liveness, snapshot ownership, nil clearing, durability, admission and default values are unchanged.

Before:

flowchart LR
  H[Accepted heartbeat] --> C[Repeated integer bound branches]
  C --> S[Repeated optional counter zero branches]
  S --> P[Publish capacity and lifetime statistics]
  G[ProviderCountByVersion] --> L[Lock and read status]
  L --> U[Unlock then read version]
  V[SetVersion under provider lock] -. can race .-> U
  U --> M[Fleet version gauge]
Loading

After:

flowchart LR
  H[Same accepted heartbeat] --> C[Direct min and max integer bounds]
  C --> S[One optional counter retention loop]
  S --> P[Same capacity and lifetime statistics]
  G[ProviderCountByVersion] --> L[Lock and copy status plus version]
  V[SetVersion under provider lock] --> L
  L --> U[Unlock and aggregate detached values]
  U --> M[Same gauge without version read race]
Loading

Reviewed the ten heartbeat, persistence and fleet telemetry production files as one operation group. Kept the two-phase profiler sampling, trust restoration, sticky per-slot KV attribution, accounting identities, public projections and versioned token budgets intact. Production is 48 lines smaller; three regression/characterization tests and documentation increase the overall diff.

Validation:

  • The version-update fixture reproduces a Go race on unchanged master (fleet_views.go versus version_reset.go), then passes on this branch.
  • Counter characterization covers all 17 wire counters and their required/optional behavior; integer characterization covers negative, zero, ordinary and maximum signed values. Both pass before and after refactoring.
  • GOTOOLCHAIN=go1.25.0 go test -race ./coordinator/registry -count=1 passes (24.344s).
  • Independent source/test review found no blocker; documentation lint and whitespace checks pass.
  • No live coordinator, model, deployment or benchmark execution. Broader indirect attestation tests ran in the package suite but are not claimed as a full source audit here.

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

@Gajesh2007

Copy link
Copy Markdown
Member Author

@codex review

@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:14am UTC
d-inference-console-ui-dev Ready Ready Preview Sep 12, 2026 12:14am UTC
d-inference-landing Building Building Preview Sep 12, 2026 12:14am 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-12T00:32:46.993499Z 1a1a703 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.

@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: 1a1a7031c8

ℹ️ 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 docs/reference/protocol-messages.md Resolved
@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: 1a1a7031c8

ℹ️ 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 docs/reference/protocol-messages.md Resolved
@Gajesh2007

Copy link
Copy Markdown
Member Author

@codex review Please use the real PR base 7c394fa and head 1a1a703. GitHub lists e825fad as the first PR commit and 1a1a703 as its child; the docs source stamp is reachable in that actual history. The previously cited 68eb246 and 135ee0b synthetic checkout commits are not published PR commits.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: 1a1a7031c8

ℹ️ 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 had an error being deployed

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