Skip to content

refactor(coordinator): isolate provider inference frame lifecycle - #1052

Closed
Gajesh2007 wants to merge 4 commits into
refactor/coordinator-provider-sessionfrom
refactor/coordinator-provider-frames
Closed

Gajesh2007 wants to merge 4 commits into
refactor/coordinator-provider-sessionfrom
refactor/coordinator-provider-frames

Conversation

@Gajesh2007

@Gajesh2007 Gajesh2007 commented Sep 14, 2026 •

Copy link
Copy Markdown
Member

Provider acceptance, encrypted chunks and terminal accounting were mixed into the API's connection file. This moves those operations into inference/providerframe.Service, reducing api/provider.go from 1,219 to 255 lines. The Session binds four direct methods; api/provider_frames.go supplies current registry, logger, attempt, settlement, profile and admission dependencies.

The shared terminal claim, pending/parked records, cancellation tracker, reservation locks and billing operations stay with their existing owners. Completion still publishes usage and observes the outcome before waiting for credits, then signals consumer channels. Error/drain, deadline, speculative-race, decryption and overflow behavior remain unchanged. Shared cache/outcome emitters still serve both consumer and provider paths. The new service owns only the existing chunk-key cache and cumulative unknown-frame counter.

Stacked on #1046. No protocol, policy, model, dependency or deployment change.

Before:

flowchart LR
  S[Session.Run: same frame guards] --> A[API accepted / chunk handlers]
  S -->|timestamp then async| C[API completion handler]
  S --> E[API error handler]
  A --> D[Decrypt and deliver or cancel/error]
  C --> T[Terminal claim and shared settlement]
  T --> U[Usage then outcome observations]
  U --> P[Wait for credits then signal consumer]
  E --> R[Claim then drain/refund/outcome/error signal]
Loading

After:

flowchart LR
  S[Session.Run: same frame guards] --> A[providerframe.Service Accepted / Chunk]
  S -->|timestamp then async| C[providerframe.Service CompleteAt]
  S --> E[providerframe.Service Error]
  B[API live bindings and shared sinks] -.-> A
  B -.-> C
  B -.-> E
  A --> D[Same decrypt/delivery and cancel/error]
  C --> T[Same terminal claim and shared settlement]
  T --> U[Same usage then outcome observations]
  U --> P[Same waited credits then consumer signals]
  E --> R[Same claim / drain / refund / outcome / error signal]
Loading

All 3,566 original test/benchmark/fuzz/example entries remain. Actual-Git strict-token checks preserve 38 mapped declarations and 11,076 retained declarations; the small constructor, callback, accessor and fixture boundaries are qualified separately. Pure key-cache/usage tests move beside the owner. API integration assertions remain; terminal key eviction is now observed through fresh-key decryption using the original key pointer, and the credit-order fixture binds the service before replacing its store.

Validation at source 359c622936 (Go 1.25.0; database environment variables unset):

  • Full coordinator race: 68 tested packages, 3,398 passed top-level tests / 5,755 passes including subtests; 106 existing opt-in skips. API 195.863s. The total completed test entries including skips are 3,490 top-level / 5,861 including subtests.
  • Focused API/owner race: 40 top-level / 65 results pass. Both adapted real API fixtures also pass unchanged original source (1.892s).
  • Removing the actual error-path key eviction through an overlay fails the fresh-key decryption assertion (0.863s), proving the new observer catches retained keys.
  • Command build and pinned golangci-lint v2.1.6 pass; all three relay benchmark arms complete a 100-iteration smoke run, with no performance claim.
  • Maintained source maps and 281 documentation pages pass; YAML parses and the actual CI selector finds the 13 checked producer/binding paths. Historical records remain untouched. Encryption documentation now describes the existing bounded retention of abandoned cache entries and does not claim immediate key wiping on disconnect.

The subsequent Session-parent refresh preserves every frame source byte and inherits only its reviewed deletion fixture plus three documentation fixes. Complete Git-tree composition is verified; 9 focused tests, command build and pinned lint pass after the merge (API 13.015s).


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

@vercel

vercel Bot commented Sep 14, 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 14, 2026 6:59pm UTC
d-inference-console-ui-dev Ready Ready Preview Sep 14, 2026 6:59pm UTC
d-inference-landing Ready Ready Preview Sep 14, 2026 6:59pm UTC

Request Review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 14, 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-14T19:04:18.308123Z 39124e0 PR opened
ℹ️ 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 (39124e05a82883c5f03b91fe45e63de171bae2f9), 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-console-ui-dev — 39124e05 Deployed Sep 14, 2026 by vercel[bot]
Preview – d-inference — 39124e05 Deployed Sep 14, 2026 by vercel[bot]
Preview – d-inference-landing — 39124e05 Deployed Sep 14, 2026 by vercel[bot]
benchmarks — 39124e05 Deployed Sep 14, 2026 by Gajesh2007 via E2E Benchmarks #1293
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