Repository navigation
fix(coordinator): bound non-streaming provider response retention - #1297
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
The EXIT trap ran after install_brew returned, when the local variable was gone, so set -u failed the step after a successful install. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Run setup-macos-homebrew.sh with a local fake installer and its own checksum, selected by test-only overrides that need SETUP_MACOS_HOMEBREW_TEST=1. The test fails with "installer: unbound variable" when the exit-trap fix is removed, and checks that a wrong checksum stops the installer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Deployment failed for project eigen-homepages-darkbloom with the following error: View Documentation: https://vercel.com/docs/accounts/team-members-and-roles |
|
Deployment failed for project d-inference-console-ui-dev with the following error: View Documentation: https://vercel.com/docs/accounts/team-members-and-roles |
|
Deployment failed for project d-inference-landing with the following error: View Documentation: https://vercel.com/docs/accounts/team-members-and-roles |
|
Deployment failed for project d-inference with the following error: View Documentation: https://vercel.com/docs/accounts/team-members-and-roles |
Threat model review — advisoryReviewed head Review not completed for this head. Previous findings are superseded, not confirmed resolved. Models: budgeted Sonnet / selective Opus / selective Sol 6.1. Findings require human validation; this review never requests changes or blocks merging. Coverage: 0/0 source units; cross-file integration pending. 0 selected depth batch(es) pending. All threat definitions indexed; relevant full definitions selected. Unchanged callers are not scanned. Cost this run: $0.0000 reported, $0.0000 reserved with unknown cost; 0 paid request(s), 0 reused batch(es), 0 provider cache-hit tokens. Saved findings and earlier report · Historical findings are not confirmed resolved. |
…zed coordinator Upstream reorganized the coordinator (#1324): response assembly is owned by coordinator/internal/inference/relay, dispatch by coordinator/internal/inference/dispatch, provider ingress and the queue placeholder by coordinator/api/inference, and every Go test lives under coordinator/tests. - Account each decrypted chunk in Owner.HandleChunk before it is classified or queued, and normalize the coordinator-only response_limit terminal in handleInferenceErrorOwned, as before. - Budget the assembler in relay.Controller.NonStream (held first chunks and channel chunks), every dispatched attempt in dispatch.Plan.Dispatch, and the queue placeholder in Primary.Run. - The limits-to-budget rule, which the owner, the dispatcher and the relay all need, is the small package coordinator/internal/inference/responselimit. registry.ResponseBudget and both environment variables are unchanged. - Move the eleven tests, with the same names and assertions, to the owners they exercise: tests/api/inference, tests/api/inference/failure, tests/api and tests/registry. - Documentation: keep both sides, cite the new paths, and note the limit in the coordinator component map, the error-vocabulary row and consumer billing troubleshooting. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…m flag Outcome of the required refactor pass on the ported change. No production statement changes. - Document ResponseBudget.Accept: a nil budget accepts everything (streaming attempts carry none), limits are inclusive, and an empty chunk still uses a slot. - Add TestNonStreamingResponseLimitBudgetFollowsRequestStream. It sends a non-streaming and a streaming request through the real router and reads the budget on the dispatched attempt, covering the one copy of the stream flag the port left without a test. - encryption.md: the row this change edits cited two sanitizer symbols by their pre-reorganization names. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Gajesh2007
left a comment
There was a problem hiding this comment.
Reviewed head 5f983a2, including per-attempt queue/retry/speculation wiring, synchronous ingress enforcement, cancellation, settlement/refund ownership, and non-forgeable error normalization. No blocking correctness or security findings. Focused NonStreamingResponseLimit/ResponseBudget tests passed locally under -race (Go 1.25.4). Current applicable CI and integration checks pass; the E2E benchmark environment remains awaiting approval, not validated by this review.
Fixes #337.
A provider can currently grow the coordinator's non-streaming
[]stringaccumulator for the entire inference timeout. This change rejects an attempt before retaining more than 64 MiB of decrypted chunk payload or 262,144 frames by default, with positive deployment overrides. Empty and malformed frames count too. Limits apply across chat completions, Responses, completions, and messages; streaming consumers retain the existing backpressure behavior.Enforcement happens at decrypted
handleChunkingress before classification/queuing, so a fast completion cannot settle an over-limit attempt while the HTTP handler drains its queue. Primary/retry/speculative and queued attempts receive separate budgets before dispatch. The response assembler independently checks already-held first chunks and subsequent chunks. Overflow sends the existing tracked cancel, removes the pending attempt through the existing error lifecycle, forgets the chunk key, and returns 502provider_error. Existing reservation finalization prevents duplicate refunds or late success settlement. A coordinator-onlyresponse_limitcause preserves the status through error normalization and cannot be supplied over provider JSON.No provider wire change or Swift source change is needed: the provider already force-streams non-streaming requests and propagates coordinator cancellation to the inference task. The coordinator bound does not depend on provider cooperation.
Before
After
Limits and compatibility
EIGENINFERENCE_NONSTREAM_RESPONSE_MAX_BYTESdefaults to 67,108,864;EIGENINFERENCE_NONSTREAM_RESPONSE_MAX_CHUNKSdefaults to 262,144. Invalid/non-positive values retain defaults. Exact ceilings are accepted; the next byte/frame is rejected.Ported onto the reorganized coordinator (2026-10-04)
Merged current master
c5552d3af7(after #1324, #1338 and #1340). Signed commits on top of the previous head: merge89ee0b56, refactor passf83ea9a8, merge5f983a2d; the resolved source tree is8a5d09cc. The text above names functions as they were; this table gives their homes now. Limits, defaults, status codes and the two environment variables are unchanged.handleChunk, error normalization inhandleInferenceErrorOwned(coordinator/api/provider.go)Owner.HandleChunkandOwner.handleInferenceErrorOwnedincoordinator/api/inference/provider_inference.gocoordinator/api/consumer_response.gorelay.Controller.NonStreamincoordinator/internal/inference/relay/consumer_response.godispatchProviderWithdispatch.Plan.Dispatchincoordinator/internal/inference/dispatch/plan.go, with a newInput.StreamdispatchPrimaryPrimary.Runincoordinator/api/inference/primary_run.go(*Server).newNonStreamingResponseBudgetand the two default constantsresponselimit.Limits.NewBudgetin the small packagecoordinator/internal/inference/responselimit. The owner, the dispatcher and the relay all need the same rule, and the last two cannot import the ownerapifailure.NonStreamingResponseLimitError, beside the sanitizer that uses itapi, one inregistrycoordinator/tests/api/inference(7),coordinator/tests/api/inference/failure(1),coordinator/tests/api(1),coordinator/tests/registry(2)registry.ResponseBudget,PendingRequest.NonStreamingResponseBudgetandprotocol.CoordinatorCauseResponseLimitare where they were.Documentation added for the new layout, which the widened docs rules require: the limit joins the list of
coordinator/internal/inferencecomponents indocs/architecture/components/coordinator.md; the error-vocabulary row ofdocs/architecture/security/encryption.mdsays theresponse_limitterminal cannot come from a provider frame;docs/consumer/billing.mdhas a troubleshooting row (the reservation is refunded in full).Refactor pass. A dedicated refactor subagent reviewed the ported change against the structure and clean-code rules in
AGENTS.md. Changes followed, in a separate commit (f83ea9a8), none to a production statement: a doc comment onResponseBudget.Accept(a nil budget accepts everything, limits are inclusive, an empty chunk uses a slot); a twelfth test,TestNonStreamingResponseLimitBudgetFollowsRequestStream, which sends a non-streaming and a streaming request through the real router and reads the budget on the dispatched attempt; and two symbol names in the documentation row. It judged theresponselimitpackage the right shape and left it. Noted for a follow-up: nothing asserts the budget on the queue placeholder, and an overflow before first content is retried like any other provider failure.Validation on the merged head (Go 1.25.0, PostgreSQL 16):
gofmtclean,go build ./coordinator/...,go vet ./coordinator/..., layout guardTestCoordinatorTestsAreIsolated.-race.go test -overlay: master's ingress and assembler givestatus 200 want 502on the oversized, aggregate, empty and malformed cases and leave the attempt pending; without the budget in the dispatch plan,budget not installed correctly before reservation; without the sanitizer branches,status 500 want 502; without the stream flag reaching the plan,stream=true: dispatched attempt budgeted=true.python3 scripts/run-coordinator-tests.py --jobs 1 ./coordinator/...: 8,154 passed, 0 failed, 5 skipped. The same five tests skip on master.make docs-check(330 files) andmake docs-impact-check BASE=origin/master.golangci-lint, the Linux cross-build, the Rust and native suites listed below for the earlier head. CI covers the coordinator ones.Validation
Current branch is based on upstream master
55441677e49059a164211d0c08b62ddcec63c3ce. Refresh preserved both changelog entries; no additional production behavior changes.On the refreshed patch: focused Go race regressions across api/registry/protocol PASS; docs-impact and docs-check PASS (326 docs); diff whitespace check PASS.
Historical validation on the identical fix before refresh (commit
0c44a07a49891bda8f4335686f95242f2a334860, base6af40ccb97891ba8ed9e2b05adc798190eb13551): full Go race suites including disposable PostgreSQL16, Go vet/build/Linux cross-build, CI-pinned golangci-lint2.1.6, Rust163 tests/fmt/check/clippy, provider regression script,17 explicit native tests,22 SDK selections plus paged-kernel/composition checks, and cached-codec audio HTTP test passed. General provider logs contain89 opt-in skips; these are not full model qualification. Native testing held the documented exclusive lane. Local CMake4.3.2 differs from CI pin3.31.12.Negative control: the new tests fail against original accumulator/ingress source with HTTP200 on oversized first/aggregate/empty/malformed cases and oversized attempts left pending. Tests use small synthetic payloads and local fixtures. Independent local review found no blocking findings.
Not yet qualified locally: full model/E2E and production prompt parity; AAC-video fixture case; Docker Linux load proof; Node22 console lint/build.
test-prod-env-refresh.shhad a macOS awk failure reproduced on unchanged base. Hosted CI for this refreshed head is pending. Readiness follows the requested review workflow; benchmark approval and preview permissions are disclosed separately.Integration refresh
Merged current master
b1c14ed896e8f3fdb9a31a96fbd1a3cce977c86dvia signed commitb2b4eb99d9e9870357b5364bdbed2c38c23e36d5. Master now includes the Homebrew cleanup fix from #1287. Retained its implementation/tests exactly and removed the redundant #1290 additions and test-specific docs. The diff against master is again only the18 intended #337 files; coordinator additions/deletions are identical to the original fix.On this refreshed head: focused coordinator race tests, the upstream offline Homebrew regression, docs-impact/docs-check and whitespace checks passed. Reverting the cleanup trap in an isolated negative control reproduces the original unbound-variable failure.
Previous head
8efc8b4d17fe6ac3dfee0b379308cd0d7928e9e8passed main CI, E2E integration and CodeQL. Fresh CI is required for the new head. The PR remains ready for review per request, not merged. Benchmark approval and preview-permission failures were outstanding on the previous head; no permission/settings changes were made.