Skip to content

refactor(coordinator): consolidate subsystem restructuring and correctness fixes - #1056

Open
Gajesh2007 wants to merge 577 commits into
refactor/tooling-consolidatedfrom
refactor/coordinator-restructure-complete
Open

Gajesh2007 wants to merge 577 commits into
refactor/tooling-consolidatedfrom
refactor/coordinator-restructure-complete

Conversation

@Gajesh2007

@Gajesh2007 Gajesh2007 commented Sep 14, 2026 •

Copy link
Copy Markdown
Member

Summary

This collapses 81 coordinator PRs into one review: 51 subsystem restructuring PRs plus 30 correctness and regression fixes. Consumer ingress, dispatch, response formatting, provider sessions and verification, registry decisions, API controllers, storage and telemetry now have named owners and colocated tests. The component commits and review history remain reachable; the smaller PRs redirect here.

Merge order: #1094 provider → #1095 web/admin → #1096 tooling/E2E → #1056 coordinator. This PR targets refactor/tooling-consolidated; its diff contains the coordinator work. Shared documentation and source-reference conflicts are already resolved. Use merge commits to preserve the stack ancestry, and retarget the next PR to master after its predecessor merges.

The aggregate includes current master through 0f7b1e611: App Attest shadow enrollment, archive and machine inventory remain in the new protocol/session/store owners, and warm-pool telemetry startup is preserved. Provider version 0.9.4 stays synchronized; this PR adds no release bump.

Correctness carried through the restructuring

  • Serialize token admission and reconciliation; reject overflowing output estimates before quota, billing and routing; release media reservations on panic.
  • Preserve alternate dispatches when a hedge fails, bound Retry-After arithmetic, keep streamed item text separate, and ignore pre-registration completions.
  • Publish immutable runtime manifests, fence stale verification claims and API-key cache fills, validate catalog reads, and retain attestation snapshots safely.
  • Credit Stripe deposits once, settle reversal refunds atomically, fence stale payout/sweep/withdrawal updates, and apply invite credits with redemption in one transaction.
  • Fence model-price cache publication after mutation, bound telemetry allocations, preserve public readiness gates, validate finite configuration, and strengthen analytics/reward regression assertions.

Existing setup tests now require explicit runtime-manifest republication after caller mutation, matching the immutable-publication fix. The real HTTP, WebSocket and database regression paths remain exercised after relocation.

Before

flowchart TB
  C[Consumer or provider request] --> API[Large API server and provider handlers]
  API --> Mixed[Mixed admission, routing, lifecycle and settlement]
  Mixed --> P[Provider and persistence]
  P --> R[Response or account state]
  F[Separate correctness branches] -. not consistently integrated .-> Mixed
Loading

After

flowchart TB
  C[Consumer request] --> H[API routes and current dependency bindings]
  H --> I[inference/ingress: bounded admission]
  I --> D[inference/dispatch and registry reservation]
  D --> P[Provider]
  P --> S[providercontrol/session and inference/providerframe]
  S --> B[inference/settlement]
  S --> R[inference/response]
  R --> C
  W[Billing webhook or invite] --> A[api/billing and api/accounts]
  A --> T[store/memory or store/postgres: atomic state transitions]
  T --> O[One credit and consistent terminal state]
Loading

See the navigation guide for behavior-to-owner paths and symbols.

Review map

Area Review slices
Shared contracts, HTTP composition and startup #1003, #1006, #1011, #1033, #1036, #1039
Inference admission, dispatch, responses and accounting #1004, #1021, #1027, #1034, #1044, #1052, #1054, #1055
Registry state, capacity, routing and provider writes #1005, #1012, #1014, #1019, #1022, #1025, #1029, #1037, #1041, #1043, #1045, #1051
Provider connections, trust, verification and release policy #1017, #1023, #1026, #1028, #1035, #1040, #1046, #1047, #1053
Accounts, public/admin APIs, billing and model catalog #1009, #1015, #1016, #1018, #1020, #1024, #1031, #1032, #1048
Store, telemetry, wire protocol and MDM client #1007, #1008, #1010, #1013, #1042, #1049, #1050

Additional correctness/regression PRs: #914, #919, #925, #928, #931, #933, #940, #945, #946, #948, #957, #959, #966, #967, #969, #970, #972, #975, #979, #980, #981, #983, #984, #985, #986, #987, #988, #990, #991, #992.

Validation

  • Exact source-head ancestry checked for all 81 coordinator component PRs. GitHub verifies all 577 commits unique to the tooling base; signed merges preserve the reviewed history.
  • Focused race regressions pass for the imported request, dispatch, policy, billing and storage fixes. The Retry-After WebSocket fixture now awaits its write before teardown; the unchanged protocol assertions passed 30 race-enabled repetitions across five cases (150 subcases). Independent source/AST comparisons preserve the Stripe settlement assertions and all incoming App Attest declarations.
  • Native and Linux/amd64 coordinator builds pass; pinned golangci-lint v2.1.6 reports zero issues. The normal pre-push hook passed full Go tests, UI lint and the Node 22 Next.js build on the combined tree.
  • Combined CPU testbed race tests and integration-policy fixture checks pass. The tooling base passes 460 tests, including bootstrap coverage for all 22 dev secret resources.
  • Documentation lint: 300 files pass. Documentation-impact mapping passes against the tooling base. Active owner maps are updated; frozen reports and design records retain their content.
  • Fresh isolated PostgreSQL 16: real --migrate-only entry point and full storage race suite pass; 283 top-level / 508 including subtests, zero skips. The private database was stopped afterward.
  • Coordinator race checks: 3,518 top-level / 6,214 passes including subtests, 121 existing skips. The full package run exposed an obsolete manifest-alias expectation; the corrected full API package rerun passed. All other packages passed the full run, and production source was unchanged between those runs.

Final integration head: d3bd660a3. Fresh Codex review of this exact head completed with no findings and a thumbs-up; zero unresolved review threads (review). The previously failing Coordinator Tests job now passes on d3bd660a3 with the bounded fixture synchronization fix (CI result). Provider and E2E integration jobs are still running; E2E Benchmarks remains at its existing environment gate.

Interfaces and migration

HTTP/WebSocket contracts remain supported. The included fixes deliberately reject invalid overflow/nonfinite inputs and stop stale or duplicate mutations. Stripe ledger idempotency adds an account/type/reference-digest lookup index, built concurrently during startup; exact reference equality remains authoritative. Interrupted invalid indexes fail readiness for repair. Existing deposits and refunds are recognized for replay suppression.

This PR prepares code and migrations for review. No production deployment or release has been performed.

…o combined stack

# Conflicts:
#	docs/architecture/components/coordinator.md
#	docs/developer/test.md
#	docs/reference/api-contracts.md
#	docs/reference/configuration.md
#	docs/threat-model.yaml
# Conflicts:
#	docs/architecture/components/coordinator.md
#	docs/architecture/routing.md
#	docs/developer/navigation.md
#	docs/developer/test.md
…ystem stack

# Conflicts:
#	docs/AGENTS.md
#	docs/architecture/cache-aware-routing.md
#	docs/architecture/components/coordinator.md
#	docs/architecture/scheduling.md
#	docs/architecture/security/attestation.md
#	docs/developer/navigation.md
#	docs/developer/test.md
#	docs/reference/protocol-messages.md
… stack

# Conflicts:
#	docs/architecture/components/coordinator.md
#	docs/architecture/overview.md
#	docs/architecture/security/enrollment.md
#	docs/architecture/system-profiler.md
#	docs/developer/navigation.md
#	docs/developer/test.md
#	docs/reference/api-contracts.md
#	docs/reference/configuration.md
# Conflicts:
#	AGENTS.md
#	coordinator/api/profiler_test.go
#	coordinator/api/server.go
#	docs/architecture/billing.md
#	docs/architecture/cache-aware-routing.md
#	docs/architecture/components/consumer.md
#	docs/architecture/components/coordinator.md
#	docs/architecture/data-flow.md
#	docs/architecture/overview.md
#	docs/architecture/request-outcome-observability.md
#	docs/architecture/routing.md
#	docs/architecture/scheduling.md
#	docs/architecture/security/encryption.md
#	docs/architecture/system-profiler.md
#	docs/architecture/telemetry.md
#	docs/consumer/quickstart.md
#	docs/developer/build.md
#	docs/developer/navigation.md
#	docs/developer/test.md
#	docs/operations/coordinator-perf-tier1-rollout.md
#	docs/operations/routing-v2-rollout.md
#	docs/reference/api-contracts.md
#	docs/reference/configuration.md
#	docs/reference/protocol-messages.md
#	docs/reference/telemetry-inventory.md
#	docs/threat-model.yaml
…tack

# Conflicts:
#	docs/architecture/cache-aware-routing.md
#	docs/architecture/components/consumer.md
#	docs/architecture/components/coordinator.md
#	docs/architecture/data-flow.md
#	docs/architecture/overview.md
#	docs/architecture/routing.md
#	docs/architecture/scheduling.md
#	docs/architecture/security/encryption.md
#	docs/architecture/system-profiler.md
#	docs/developer/navigation.md
#	docs/developer/test.md
#	docs/operations/coordinator-perf-tier1-rollout.md
#	docs/reference/api-contracts.md
#	docs/reference/configuration.md
#	docs/reference/protocol-messages.md
# Conflicts:
#	coordinator/api/server.go
#	docs/architecture/billing.md
#	docs/architecture/cache-aware-routing.md
#	docs/architecture/components/consumer.md
#	docs/architecture/components/coordinator.md
#	docs/architecture/data-flow.md
#	docs/architecture/overview.md
#	docs/architecture/routing.md
#	docs/architecture/scheduling.md
#	docs/architecture/security/encryption.md
#	docs/architecture/system-profiler.md
#	docs/architecture/telemetry.md
#	docs/consumer/quickstart.md
#	docs/developer/navigation.md
#	docs/developer/test.md
#	docs/operations/coordinator-perf-tier1-rollout.md
#	docs/reference/api-contracts.md
#	docs/reference/configuration.md
#	docs/reference/protocol-messages.md
#	docs/reference/telemetry-inventory.md
#	docs/threat-model.yaml
… stack

# Conflicts:
#	docs/architecture/components/coordinator.md
#	docs/architecture/security/attestation.md
#	docs/architecture/security/identity-binding.md
#	docs/developer/navigation.md
#	docs/developer/test.md
@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 3e9f5daa67

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

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: d3bd660a33

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

This branch had an error being deployed

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