Repository navigation
Consolidate coordinator SSE lifecycle and completion policies - #898
Gajesh2007 wants to merge 3 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 775c41e32d
ℹ️ 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".
|
@codex review |
|
Codex Review: Didn't find any major issues. 🚀 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
Final validation for
Individual validation details and limitations are in each PR description, including the dedicated-M5 provider/live GPT-OSS checks and the unchanged baseline TypeScript diagnostics in #899. No merge or deployment was performed. |
77f0ea8 to
275190b
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. 👍 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
@codex review |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
Superseded by #1054, 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 #1054; 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. |
The coordinator maintained three copies of the provider SSE relay loop and two copies of translated-endpoint setup, error settlement and completion handling. This change gives channel arbitration one implementation and makes endpoint completion differences explicit, so changes to coalescing or late-error delivery have one owner.
Stacked on
feat/gpt-oss-20b-prefix-cache(#894); no release/default changes are introduced here.relayProviderStreamowns bounded queued-chunk draining, flush-before-terminal ordering, idle timeout and cancellation selection for Chat, Responses, Completions and Messages.handleEndpointStreamingResponseowns shared translated-endpoint setup, initial provider errors, route outcomes, refunds and final flushing. Emitters retain their exact wire formats; chat retains its held finish/usage/metadata logic.streamCompletionPolicyexplicitly preserves existing differences: Messages/Completions require completion usage even without a reservation and observe cancellation during the completion wait; Responses retains its settled-reservation fallback and independent usage grace period.Before:
flowchart TD A[Committed provider request] --> B{Consumer endpoint} B --> C[Chat handler: own select/drain/flush loop] B --> D[Responses handler: own setup/error/select loop] B --> E[Generic handler: own setup/error/select loop] C --> F[Chat held usage/finish and metadata] D --> G[Responses completion grace and emitter] E --> H[Explicit completion required and Messages/Completions emitters] C --> I[Queued chunks before error; refund/route outcome] D --> I E --> I F --> J[Existing endpoint success terminal] G --> J H --> J I --> K[Existing endpoint in-band error or client departure]After:
flowchart TD A[Committed provider request] --> B{Consumer endpoint} B --> C[Chat handler: chat wire state] B --> D[handleEndpointStreamingResponse: shared setup/error settlement] C --> E[relayProviderStream: one select/drain/flush loop] D --> E E -->|Closed| F[Chat held usage/finish and metadata] E -->|Closed| G[finishEndpointStream: explicit completion policy] G --> H[Responses or Messages/Completions emitter] F --> J[Same endpoint success terminal] H --> J E -->|Error / idle timeout / client gone| I[Caller settles and records outcome] I --> K[Same endpoint in-band error or client departure]Validation:
GOTOOLCHAIN=go1.25.0 go test ./coordinator/...passes (API package 194.418s; registry/routing simulation/store/billing and all other coordinator packages pass).git diff --checkand docs lint pass (278 documents).The observable API shapes, status codes, flush bounds, timer-reset placement, settlement calls, telemetry, provider cancellation ownership and GPT-OSS defaults remain unchanged. This is a focused coordinator refactor, not a rewrite of the scheduler or ledger.