Repository navigation
test(api): add offline OpenRouter conformance and scenario gates - #1210
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@codex review the PR |
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: 491e6e4585
ℹ️ 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".
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. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Found 1 test failure on Blacksmith runners: Failure
|
Gajesh2007
left a comment
There was a problem hiding this comment.
Reviewed the incremental diff against dccc9ee. No blocking correctness findings. The real composed HTTP/encrypted-provider fixtures, concrete-to-public model rewrite assertions, cancellation/settlement synchronization, and negative oracle controls provide useful regression protection without production changes. The outstanding fixture-organization request is substantively addressed by coordinator/tests/internal/conformance and the thin contracts adapter, consistent with current test-isolation rules.
One non-blocking correction: the summary says four inference endpoints, but this addition sends inference requests to /v1/chat/completions (fixture.go:160), plus model-feed/registration checks. Please describe that scope accurately; this is not four-endpoint conformance or hosted OpenRouter certification.
Validation: the conformance suite passed 20 ordinary repetitions and three race repetitions; the entire inference-contracts package passed under -race; focused go vet and docs-impact passed. API conformance/privacy selectors also passed with -race on the final #1216 composition. A command-local matching Xcode compiler/SDK was needed for native linking. Local docs-check cannot resolve seven links into the uninitialized MLX submodule; hosted docs checks pass. E2E Benchmarks remains waiting.
This approval is for this exact incremental code change, not the other six PRs, and does not lift the explicit stack-wide merge/deploy hold.
…1211) * test(api): add offline OpenRouter conformance and scenario gates * fix(api): omit caller identifiers from provider inference requests * test(api): group conformance scenarios and verify model alias rewriting * docs: preserve cache guidance across conformance test organization * test(api): preserve shared seams and current provider contracts * docs: align merge inputs with current upstream * docs: retain qualified conformance guidance after upstream integration * test(api): expose shared fixtures through the conformance package * docs: align merge inputs with current upstream * docs: retain qualified conformance guidance after upstream integration * Prepare upstream integration conflicts for cache stack #1210 * Reconcile cache stack #1210 with current upstream behavior * Prepare upstream integration conflicts for cache stack #1211 * Reconcile cache stack #1211 with current upstream behavior * Synchronize cancellation conformance with completed provider dispatch * refactor(tests): simplify the conformance suite's seams after the port Outcome of the required refactor pass on the ported change. Test and documentation code only; the suite runs the same 22 entry points, 216 tests and 197 leaf cases with identical evidence lines. - The support package now lives beside testkit and can call it directly, so the seven pass-through hooks on Suite are removed. NewServer, the one real seam, remains. - Move the service-hold measurement into the support package as OutstandingServiceHold and state its contract: a probe briefly holds the amount it tests, and a reading is exact only while the account's balance and holds are stable. - Resolve the provider private key on the test goroutine instead of failing the test from the provider's reader goroutine. - Remove two unused fixture fields and reword one undefined label. - docs/developer/test.md: cite the new symbol and keep the cancellation fixture paragraph inside this change's own section. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(api): list the removed caller fields in the request table Outcome of the required refactor pass on the ported change: no code change was needed. The pass found one gap this change opens in the reference: the Chat Completions request table says uninterpreted fields pass through and did not list user and metadata, which are now removed before forwarding. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(changelog): give the cache reliability entry its own insertion point The entry sat directly after the newest sections, where other open pull requests also insert theirs, so each merge on master conflicted with it. Move the section below "leaderboard availability". No wording change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(api): also remove caller safety and cache-routing hints from provider bodies The privacy fix removed the caller's top-level user and metadata before a request is sealed for a provider, but two more caller-supplied top-level fields still reached providers: safety_identifier and the caller's prompt_cache_key. Neither is needed for inference; authentication, billing and cache scope come from trusted context. This carries the fix from the private cache remediation reviewed on 2026-10-03 onto the reorganized coordinator: - stripProviderCallerIdentity (coordinator/internal/inference/prelude) deletes both fields. Nested fields of the same name stay semantic input. The coordinator may still append its own protocol-0 cache-bust key after this point. - Tests: TestProviderIdentityRoutingHintsAreNotForwarded (through the real prelude), three new field-shape cases including escaped key names, the direct-encrypted and alias-fallback oracles, and the absence helper in all three test packages that keep a copy of it. - Docs: encryption model, consumer privacy expectations, API contracts (including that a cache scope is a stable account/model pseudonym). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(api): send the new caller fields on the alias-rewrite path too The alias-fallback privacy test's oracle already removed safety_identifier and prompt_cache_key, but its request never sent them, so the alias-rewrite path did not exercise the new minimization. Send both, as the direct-encrypted test does. Found by the refactor pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: jonathan308 <5055076+jonathan308@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* test(api): add offline OpenRouter conformance and scenario gates * fix(api): omit caller identifiers from provider inference requests * fix(cache): bound retained cache-attempt metadata * test(api): group conformance scenarios and verify model alias rewriting * docs: preserve cache guidance across conformance test organization * docs: preserve cache guidance across conformance test organization * test(api): preserve shared seams and current provider contracts * docs: align merge inputs with current upstream * docs: retain qualified conformance guidance after upstream integration * test(api): expose shared fixtures through the conformance package * docs: align merge inputs with current upstream * docs: retain qualified conformance guidance after upstream integration * Prepare upstream integration conflicts for cache stack #1210 * Reconcile cache stack #1210 with current upstream behavior * Prepare upstream integration conflicts for cache stack #1211 * Reconcile cache stack #1211 with current upstream behavior * Prepare upstream integration conflicts for cache stack #1212 * Reconcile cache stack #1212 with current upstream behavior * Synchronize cancellation conformance with completed provider dispatch * refactor(tests): simplify the conformance suite's seams after the port Outcome of the required refactor pass on the ported change. Test and documentation code only; the suite runs the same 22 entry points, 216 tests and 197 leaf cases with identical evidence lines. - The support package now lives beside testkit and can call it directly, so the seven pass-through hooks on Suite are removed. NewServer, the one real seam, remains. - Move the service-hold measurement into the support package as OutstandingServiceHold and state its contract: a probe briefly holds the amount it tests, and a reading is exact only while the account's balance and holds are stable. - Resolve the provider private key on the test goroutine instead of failing the test from the provider's reader goroutine. - Remove two unused fixture fields and reword one undefined label. - docs/developer/test.md: cite the new symbol and keep the cancellation fixture paragraph inside this change's own section. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(api): list the removed caller fields in the request table Outcome of the required refactor pass on the ported change: no code change was needed. The pass found one gap this change opens in the reference: the Chat Completions request table says uninterpreted fields pass through and did not list user and metadata, which are now removed before forwarding. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(changelog): give the cache reliability entry its own insertion point The entry sat directly after the newest sections, where other open pull requests also insert theirs, so each merge on master conflicted with it. Move the section below "leaderboard availability". No wording change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: locate the attempt budget's owner and file its changelog entry - Navigation: add the row for cache receipt attempts and their retained-byte budget, now owned by coordinator/internal/registry/cachetracker. - Changelog: the entry had been inserted between unrelated bullets of an older release-candidate section. Move it, unchanged, into this stack's "cache reliability" section. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(registry): let the attempt ledger own its arithmetic Required refactor pass for the ported change, by a dedicated subagent; its outcome is in the pull request description. - AttemptBudget gains replacementTotal (whether an exchange of charges fits, committing nothing) and refund (saturating on an inconsistent ledger). StoreAttemptLocked and RemoveAttemptLocked call them instead of doing the arithmetic inline: same checks, same order, same results. - New TestCacheAttemptBudgetInconsistentLedgerGrantsNoAdmission covers the incumbent guard and the refund saturation, which no test reached. - TestCacheAttemptBudgetCountEvictionRefundsWithoutChangingPublication pins its nonces, so the cap-of-one case evicts the newer record before its owner is published on every run. Under the frozen test clock the victim had been chosen by random nonce. - A comment and one documentation phrase now match the code (re-storing a terminal record; deriving the boundary claims). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(api): also remove caller safety and cache-routing hints from provider bodies The privacy fix removed the caller's top-level user and metadata before a request is sealed for a provider, but two more caller-supplied top-level fields still reached providers: safety_identifier and the caller's prompt_cache_key. Neither is needed for inference; authentication, billing and cache scope come from trusted context. This carries the fix from the private cache remediation reviewed on 2026-10-03 onto the reorganized coordinator: - stripProviderCallerIdentity (coordinator/internal/inference/prelude) deletes both fields. Nested fields of the same name stay semantic input. The coordinator may still append its own protocol-0 cache-bust key after this point. - Tests: TestProviderIdentityRoutingHintsAreNotForwarded (through the real prelude), three new field-shape cases including escaped key names, the direct-encrypted and alias-fallback oracles, and the absence helper in all three test packages that keep a copy of it. - Docs: encryption model, consumer privacy expectations, API contracts (including that a cache scope is a stable account/model pseudonym). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(api): send the new caller fields on the alias-rewrite path too The alias-fallback privacy test's oracle already removed safety_identifier and prompt_cache_key, but its request never sent them, so the alias-rewrite path did not exercise the new minimization. Send both, as the direct-encrypted test does. Found by the refactor pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(registry): reclaim finished cache attempts before refusing a new one When the 64 MiB attempt budget was full, a new record was refused and the request went out with prefix caching off, while records of requests that had already finished kept their bytes through the two-minute late-receipt grace; nothing counted the refusals. Simulated on the real registry code, that sent 30-59% of dispatches uncached at 120 cache-enabled dispatches per second. This carries the B1 fix from the private cache remediation reviewed on 2026-10-03 (Astra) onto the reorganized coordinator: - An attempt is marked terminal once; a repeated terminal call no longer extends its grace. Terminal attempts also sit in a per-generation terminal expiry order. - Admission validates and detaches the candidate first. If it does not fit, it peeks at most 64 earliest-expiring terminal records without changing anything, never the nonce being replaced, and removes them only if their full refund admits the candidate; otherwise it refuses and removes nothing. A record larger than the whole budget is refused. - Each boundary hash is charged once (it is stored once). - attempt_bytes, attempt_budget_refused and attempt_grace_reclaimed in /v1/cache/status, Prometheus and Datadog. - Tests: the remediation's pressure controls and terminal-grace test, plus TestCacheAttemptBudgetReclaimsFinishedRecordsBeforeRefusing and TestCacheAttemptBudgetRefusesWhenInFlightRecordsFillIt. With the previous store path substituted, 11 tests fail. - Docs: cache-aware routing (formula, reclaim policy, gauges), the API contracts, the test guide, navigation and the changelog entry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(telemetry): list the attempt-budget gauges The reclaim change added three exact-cache gauges; the telemetry inventory now names them with the status fields they mirror. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(registry): tidy the reclaim change's tests and wording Refactor pass on the reclaim change, by the dedicated subagent: - The two pressure controls that built the same 65-record terminal setup share one helper; the late-READY control uses the existing charge helper. Every assertion and message is unchanged. - The architecture doc says reclaim never takes the record being replaced, and that the count cap evicts the record that expires first. - The status field comment no longer implies that a refusal reclaims. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(registry): count only grace reclaims that cut a grace short attempt_grace_reclaimed also counted finished records whose two-minute grace had already ended but which the 30-second sweep had not removed yet. Those forfeit nothing, and the status contract and telemetry inventory define the gauge as records reclaimed inside their grace. - reclaimTerminalGraceLocked takes the admission's clock reading and counts a victim only if it was still inside its grace. - TestCacheAttemptPressureCountsOnlyGraceCutShort: a record whose grace ended 10 s before an admission (with the next sweep not yet due) is reclaimed without being counted; a record still inside its grace is counted. The first half fails without this change ("attempt_grace_reclaimed=1 for a record whose grace had ended 10s earlier"). - The telemetry inventory now states when a refusal is counted. Found by the refactor pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: jonathan308 <5055076+jonathan308@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…1213) * test(api): add offline OpenRouter conformance and scenario gates * fix(api): omit caller identifiers from provider inference requests * fix(cache): bound retained cache-attempt metadata * fix(cache): bound planner admission and isolate contract readiness * test(api): group conformance scenarios and verify model alias rewriting * docs: preserve cache guidance across conformance test organization * docs: preserve cache guidance across conformance test organization * test(api): preserve shared seams and current provider contracts * docs: align merge inputs with current upstream * docs: retain qualified conformance guidance after upstream integration * test(api): expose shared fixtures through the conformance package * docs: align merge inputs with current upstream * docs: retain qualified conformance guidance after upstream integration * Prepare upstream integration conflicts for cache stack #1210 * Reconcile cache stack #1210 with current upstream behavior * Prepare upstream integration conflicts for cache stack #1211 * Reconcile cache stack #1211 with current upstream behavior * Prepare upstream integration conflicts for cache stack #1212 * Reconcile cache stack #1212 with current upstream behavior * Prepare upstream integration conflicts for cache stack #1213 * Reconcile cache stack #1213 with current upstream behavior * Synchronize cancellation conformance with completed provider dispatch * refactor(tests): simplify the conformance suite's seams after the port Outcome of the required refactor pass on the ported change. Test and documentation code only; the suite runs the same 22 entry points, 216 tests and 197 leaf cases with identical evidence lines. - The support package now lives beside testkit and can call it directly, so the seven pass-through hooks on Suite are removed. NewServer, the one real seam, remains. - Move the service-hold measurement into the support package as OutstandingServiceHold and state its contract: a probe briefly holds the amount it tests, and a reading is exact only while the account's balance and holds are stable. - Resolve the provider private key on the test goroutine instead of failing the test from the provider's reader goroutine. - Remove two unused fixture fields and reword one undefined label. - docs/developer/test.md: cite the new symbol and keep the cancellation fixture paragraph inside this change's own section. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(api): list the removed caller fields in the request table Outcome of the required refactor pass on the ported change: no code change was needed. The pass found one gap this change opens in the reference: the Chat Completions request table says uninterpreted fields pass through and did not list user and metadata, which are now removed before forwarding. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(changelog): give the cache reliability entry its own insertion point The entry sat directly after the newest sections, where other open pull requests also insert theirs, so each merge on master conflicted with it. Move the section below "leaderboard availability". No wording change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: locate the attempt budget's owner and file its changelog entry - Navigation: add the row for cache receipt attempts and their retained-byte budget, now owned by coordinator/internal/registry/cachetracker. - Changelog: the entry had been inserted between unrelated bullets of an older release-candidate section. Move it, unchanged, into this stack's "cache reliability" section. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(registry): let the attempt ledger own its arithmetic Required refactor pass for the ported change, by a dedicated subagent; its outcome is in the pull request description. - AttemptBudget gains replacementTotal (whether an exchange of charges fits, committing nothing) and refund (saturating on an inconsistent ledger). StoreAttemptLocked and RemoveAttemptLocked call them instead of doing the arithmetic inline: same checks, same order, same results. - New TestCacheAttemptBudgetInconsistentLedgerGrantsNoAdmission covers the incumbent guard and the refund saturation, which no test reached. - TestCacheAttemptBudgetCountEvictionRefundsWithoutChangingPublication pins its nonces, so the cap-of-one case evicts the newer record before its owner is published on every run. Under the frozen test clock the victim had been chosen by random nonce. - A comment and one documentation phrase now match the code (re-storing a terminal record; deriving the boundary claims). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(api): also remove caller safety and cache-routing hints from provider bodies The privacy fix removed the caller's top-level user and metadata before a request is sealed for a provider, but two more caller-supplied top-level fields still reached providers: safety_identifier and the caller's prompt_cache_key. Neither is needed for inference; authentication, billing and cache scope come from trusted context. This carries the fix from the private cache remediation reviewed on 2026-10-03 onto the reorganized coordinator: - stripProviderCallerIdentity (coordinator/internal/inference/prelude) deletes both fields. Nested fields of the same name stay semantic input. The coordinator may still append its own protocol-0 cache-bust key after this point. - Tests: TestProviderIdentityRoutingHintsAreNotForwarded (through the real prelude), three new field-shape cases including escaped key names, the direct-encrypted and alias-fallback oracles, and the absence helper in all three test packages that keep a copy of it. - Docs: encryption model, consumer privacy expectations, API contracts (including that a cache scope is a stable account/model pseudonym). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(api): send the new caller fields on the alias-rewrite path too The alias-fallback privacy test's oracle already removed safety_identifier and prompt_cache_key, but its request never sent them, so the alias-rewrite path did not exercise the new minimization. Send both, as the direct-encrypted test does. Found by the refactor pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(registry): reclaim finished cache attempts before refusing a new one When the 64 MiB attempt budget was full, a new record was refused and the request went out with prefix caching off, while records of requests that had already finished kept their bytes through the two-minute late-receipt grace; nothing counted the refusals. Simulated on the real registry code, that sent 30-59% of dispatches uncached at 120 cache-enabled dispatches per second. This carries the B1 fix from the private cache remediation reviewed on 2026-10-03 (Astra) onto the reorganized coordinator: - An attempt is marked terminal once; a repeated terminal call no longer extends its grace. Terminal attempts also sit in a per-generation terminal expiry order. - Admission validates and detaches the candidate first. If it does not fit, it peeks at most 64 earliest-expiring terminal records without changing anything, never the nonce being replaced, and removes them only if their full refund admits the candidate; otherwise it refuses and removes nothing. A record larger than the whole budget is refused. - Each boundary hash is charged once (it is stored once). - attempt_bytes, attempt_budget_refused and attempt_grace_reclaimed in /v1/cache/status, Prometheus and Datadog. - Tests: the remediation's pressure controls and terminal-grace test, plus TestCacheAttemptBudgetReclaimsFinishedRecordsBeforeRefusing and TestCacheAttemptBudgetRefusesWhenInFlightRecordsFillIt. With the previous store path substituted, 11 tests fail. - Docs: cache-aware routing (formula, reclaim policy, gauges), the API contracts, the test guide, navigation and the changelog entry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(telemetry): list the attempt-budget gauges The reclaim change added three exact-cache gauges; the telemetry inventory now names them with the status fields they mirror. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(registry): tidy the reclaim change's tests and wording Refactor pass on the reclaim change, by the dedicated subagent: - The two pressure controls that built the same 65-record terminal setup share one helper; the late-READY control uses the existing charge helper. Every assertion and message is unchanged. - The architecture doc says reclaim never takes the record being replaced, and that the count cap evicts the record that expires first. - The status field comment no longer implies that a refusal reclaims. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(registry): count only grace reclaims that cut a grace short attempt_grace_reclaimed also counted finished records whose two-minute grace had already ended but which the 30-second sweep had not removed yet. Those forfeit nothing, and the status contract and telemetry inventory define the gauge as records reclaimed inside their grace. - reclaimTerminalGraceLocked takes the admission's clock reading and counts a victim only if it was still inside its grace. - TestCacheAttemptPressureCountsOnlyGraceCutShort: a record whose grace ended 10 s before an admission (with the next sweep not yet due) is reclaimed without being counted; a record still inside its grace is counted. The first half fails without this change ("attempt_grace_reclaimed=1 for a record whose grace had ended 10s earlier"). - The telemetry inventory now states when a refusal is counted. Found by the refactor pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(promptcontract): restore the planning-admission and connection-budget tests The port withheld eleven tests because they read the sidecar client's private admission state and connection pools. They are restored with their names, cases and messages through injected dependencies that production leaves unset, the pattern CacheDependencies already uses: - sidecar.PlanAdmission is the client's planning admission as an exported component (constructor, Acquire, read-only counts of workers, active and pending plans and pending bytes, and the two pending limits). NewClient builds it; Client.Plan acquires it on every call. - sidecar.ClientConfig.PlanAdmissions builds the admission and ClientConfig.Transports wraps each of the client's three HTTP pools (planning, health, control); nil gives exactly today's admission and transports. - promptcontract.SupervisorConfig forwards both, and its new Clients factory builds the supervisor's client from its effective configuration (nil uses sidecar.NewClient). Through it, TestPlanningConnectionBudget keeps its "worker capacity changed" and "server connection limit changed" checks. Restored: TestPlanningClientTracksConfiguredWorkers, TestPlanAdmissionBoundsAndRefunds, TestPlanAdmissionCancellationAndDeadline, TestPlanningConnectionBudget, TestControlReconnectsDuringPlanningSaturation, TestPlannerBurstWaitsForWorkersWithoutBlockingHealth, TestQueuedPlanCancellationNeverReachesSidecar, TestCancelledActivePlannerWorkStillFailsColdUntilBackendDrains, TestReviewControlTrafficAtConfiguredWorkerCapacity, and the two real-sidecar preload tests (gated on DARKBLOOM_TEST_PROMPT_SIDECAR). With the pull request's client changes reverted, the admission and connection-budget tests fail. The test guide paragraphs about them are restored, and docs cite the exported names. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(promptcontract): bind real-sidecar admission tests to current identities Carries a test change from the private cache remediation reviewed on 2026-10-03: the real-sidecar admission tests no longer hardcode old normalization and renderer identities. They select existing model metadata, recompute the current contract ID, and reject old versions, mismatched directories and ambiguous models without relabelling any artifact. TestAdmissionFixtureIdentityRejectsStaleAndMismatchedMetadata runs locally; the sidecar pairing test stays gated on the binary. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(promptcontract): one client seam on the supervisor, clearer test names Refactor pass on the ported change and its restored tests, by the dedicated subagent: - SupervisorConfig keeps a single injected dependency, Clients, which builds the supervisor's sidecar client from its effective configuration. PlanAdmissions and Transports were pure forwarding once Clients existed and are removed; tests attach the client's dependencies through Clients. With the field unset NewSupervisor builds the same client as before. - The control-capacity test loses its work-wave label: TestControlTrafficAtConfiguredWorkerCapacity in control_capacity_test.go, with permitListener and permitConn. Its body is unchanged. - planPromptRoute says why its two early returns still call the planner (to record the decision). Every test keeps its cases, assertions and messages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(cache): describe planning decisions and bounds as the code implements them Found by the refactor pass; documentation only. - Planning-decision telemetry: a decision is recorded each time a request's cache plan is computed, once per concrete model and provider-bound body. For a request that takes the public capacity preflight that happens while admission builds its forecast, so a request preflight then rejects is already counted and an alias fallback probe records a further decision. Nothing is recorded when prompt accounting declines first. lowering_unsupported is recorded after admission by the generic handler. - One legacy population grows: a media request to a verified, preload-acknowledged model is now counted once as ineligible in exact_cache_plan_total, because the planner is consulted to record its decision. No routing or billing effect. The changelog bullet says so. - The first-content bound on planning is promptwork.PlanningContext at the handlers; the planner's own bound applies only when its ReceivedAt and FirstContentBudget inputs are set, which production does not do. - With routing off, count-only prompt accounting still calls the sidecar for eligible text requests. - Rows the docs-impact rules ask for: the lowering_unsupported decision in the API contracts, the planner's owner in the routing page, and that a request without a cache plan is billed without a cached-token discount. - The test guide and a diagram use the current test and symbol names. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(preload): reconcile lifecycle fixtures with planner readiness * docs: refresh reconciled preload test coverage stamp --------- Co-authored-by: jonathan308 <5055076+jonathan308@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* test(api): add offline OpenRouter conformance and scenario gates * fix(api): omit caller identifiers from provider inference requests * fix(cache): bound retained cache-attempt metadata * fix(cache): bound planner admission and isolate contract readiness * fix(cache): select a bounded tokenizer preload set * test(api): group conformance scenarios and verify model alias rewriting * docs: preserve cache guidance across conformance test organization * docs: preserve cache guidance across conformance test organization * test(api): preserve shared seams and current provider contracts * docs: align merge inputs with current upstream * docs: retain qualified conformance guidance after upstream integration * test(api): expose shared fixtures through the conformance package * docs: align merge inputs with current upstream * docs: retain qualified conformance guidance after upstream integration * Prepare upstream integration conflicts for cache stack #1210 * Reconcile cache stack #1210 with current upstream behavior * Prepare upstream integration conflicts for cache stack #1211 * Reconcile cache stack #1211 with current upstream behavior * Prepare upstream integration conflicts for cache stack #1212 * Reconcile cache stack #1212 with current upstream behavior * Prepare upstream integration conflicts for cache stack #1213 * Reconcile cache stack #1213 with current upstream behavior * Prepare upstream integration conflicts for cache stack #1214 * Reconcile cache stack #1214 with current upstream behavior * Synchronize cancellation conformance with completed provider dispatch * refactor(tests): simplify the conformance suite's seams after the port Outcome of the required refactor pass on the ported change. Test and documentation code only; the suite runs the same 22 entry points, 216 tests and 197 leaf cases with identical evidence lines. - The support package now lives beside testkit and can call it directly, so the seven pass-through hooks on Suite are removed. NewServer, the one real seam, remains. - Move the service-hold measurement into the support package as OutstandingServiceHold and state its contract: a probe briefly holds the amount it tests, and a reading is exact only while the account's balance and holds are stable. - Resolve the provider private key on the test goroutine instead of failing the test from the provider's reader goroutine. - Remove two unused fixture fields and reword one undefined label. - docs/developer/test.md: cite the new symbol and keep the cancellation fixture paragraph inside this change's own section. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(api): list the removed caller fields in the request table Outcome of the required refactor pass on the ported change: no code change was needed. The pass found one gap this change opens in the reference: the Chat Completions request table says uninterpreted fields pass through and did not list user and metadata, which are now removed before forwarding. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(changelog): give the cache reliability entry its own insertion point The entry sat directly after the newest sections, where other open pull requests also insert theirs, so each merge on master conflicted with it. Move the section below "leaderboard availability". No wording change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: locate the attempt budget's owner and file its changelog entry - Navigation: add the row for cache receipt attempts and their retained-byte budget, now owned by coordinator/internal/registry/cachetracker. - Changelog: the entry had been inserted between unrelated bullets of an older release-candidate section. Move it, unchanged, into this stack's "cache reliability" section. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(registry): let the attempt ledger own its arithmetic Required refactor pass for the ported change, by a dedicated subagent; its outcome is in the pull request description. - AttemptBudget gains replacementTotal (whether an exchange of charges fits, committing nothing) and refund (saturating on an inconsistent ledger). StoreAttemptLocked and RemoveAttemptLocked call them instead of doing the arithmetic inline: same checks, same order, same results. - New TestCacheAttemptBudgetInconsistentLedgerGrantsNoAdmission covers the incumbent guard and the refund saturation, which no test reached. - TestCacheAttemptBudgetCountEvictionRefundsWithoutChangingPublication pins its nonces, so the cap-of-one case evicts the newer record before its owner is published on every run. Under the frozen test clock the victim had been chosen by random nonce. - A comment and one documentation phrase now match the code (re-storing a terminal record; deriving the boundary claims). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(api): also remove caller safety and cache-routing hints from provider bodies The privacy fix removed the caller's top-level user and metadata before a request is sealed for a provider, but two more caller-supplied top-level fields still reached providers: safety_identifier and the caller's prompt_cache_key. Neither is needed for inference; authentication, billing and cache scope come from trusted context. This carries the fix from the private cache remediation reviewed on 2026-10-03 onto the reorganized coordinator: - stripProviderCallerIdentity (coordinator/internal/inference/prelude) deletes both fields. Nested fields of the same name stay semantic input. The coordinator may still append its own protocol-0 cache-bust key after this point. - Tests: TestProviderIdentityRoutingHintsAreNotForwarded (through the real prelude), three new field-shape cases including escaped key names, the direct-encrypted and alias-fallback oracles, and the absence helper in all three test packages that keep a copy of it. - Docs: encryption model, consumer privacy expectations, API contracts (including that a cache scope is a stable account/model pseudonym). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(api): send the new caller fields on the alias-rewrite path too The alias-fallback privacy test's oracle already removed safety_identifier and prompt_cache_key, but its request never sent them, so the alias-rewrite path did not exercise the new minimization. Send both, as the direct-encrypted test does. Found by the refactor pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(registry): reclaim finished cache attempts before refusing a new one When the 64 MiB attempt budget was full, a new record was refused and the request went out with prefix caching off, while records of requests that had already finished kept their bytes through the two-minute late-receipt grace; nothing counted the refusals. Simulated on the real registry code, that sent 30-59% of dispatches uncached at 120 cache-enabled dispatches per second. This carries the B1 fix from the private cache remediation reviewed on 2026-10-03 (Astra) onto the reorganized coordinator: - An attempt is marked terminal once; a repeated terminal call no longer extends its grace. Terminal attempts also sit in a per-generation terminal expiry order. - Admission validates and detaches the candidate first. If it does not fit, it peeks at most 64 earliest-expiring terminal records without changing anything, never the nonce being replaced, and removes them only if their full refund admits the candidate; otherwise it refuses and removes nothing. A record larger than the whole budget is refused. - Each boundary hash is charged once (it is stored once). - attempt_bytes, attempt_budget_refused and attempt_grace_reclaimed in /v1/cache/status, Prometheus and Datadog. - Tests: the remediation's pressure controls and terminal-grace test, plus TestCacheAttemptBudgetReclaimsFinishedRecordsBeforeRefusing and TestCacheAttemptBudgetRefusesWhenInFlightRecordsFillIt. With the previous store path substituted, 11 tests fail. - Docs: cache-aware routing (formula, reclaim policy, gauges), the API contracts, the test guide, navigation and the changelog entry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(telemetry): list the attempt-budget gauges The reclaim change added three exact-cache gauges; the telemetry inventory now names them with the status fields they mirror. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(registry): tidy the reclaim change's tests and wording Refactor pass on the reclaim change, by the dedicated subagent: - The two pressure controls that built the same 65-record terminal setup share one helper; the late-READY control uses the existing charge helper. Every assertion and message is unchanged. - The architecture doc says reclaim never takes the record being replaced, and that the count cap evicts the record that expires first. - The status field comment no longer implies that a refusal reclaims. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(registry): count only grace reclaims that cut a grace short attempt_grace_reclaimed also counted finished records whose two-minute grace had already ended but which the 30-second sweep had not removed yet. Those forfeit nothing, and the status contract and telemetry inventory define the gauge as records reclaimed inside their grace. - reclaimTerminalGraceLocked takes the admission's clock reading and counts a victim only if it was still inside its grace. - TestCacheAttemptPressureCountsOnlyGraceCutShort: a record whose grace ended 10 s before an admission (with the next sweep not yet due) is reclaimed without being counted; a record still inside its grace is counted. The first half fails without this change ("attempt_grace_reclaimed=1 for a record whose grace had ended 10s earlier"). - The telemetry inventory now states when a refusal is counted. Found by the refactor pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(promptcontract): restore the planning-admission and connection-budget tests The port withheld eleven tests because they read the sidecar client's private admission state and connection pools. They are restored with their names, cases and messages through injected dependencies that production leaves unset, the pattern CacheDependencies already uses: - sidecar.PlanAdmission is the client's planning admission as an exported component (constructor, Acquire, read-only counts of workers, active and pending plans and pending bytes, and the two pending limits). NewClient builds it; Client.Plan acquires it on every call. - sidecar.ClientConfig.PlanAdmissions builds the admission and ClientConfig.Transports wraps each of the client's three HTTP pools (planning, health, control); nil gives exactly today's admission and transports. - promptcontract.SupervisorConfig forwards both, and its new Clients factory builds the supervisor's client from its effective configuration (nil uses sidecar.NewClient). Through it, TestPlanningConnectionBudget keeps its "worker capacity changed" and "server connection limit changed" checks. Restored: TestPlanningClientTracksConfiguredWorkers, TestPlanAdmissionBoundsAndRefunds, TestPlanAdmissionCancellationAndDeadline, TestPlanningConnectionBudget, TestControlReconnectsDuringPlanningSaturation, TestPlannerBurstWaitsForWorkersWithoutBlockingHealth, TestQueuedPlanCancellationNeverReachesSidecar, TestCancelledActivePlannerWorkStillFailsColdUntilBackendDrains, TestReviewControlTrafficAtConfiguredWorkerCapacity, and the two real-sidecar preload tests (gated on DARKBLOOM_TEST_PROMPT_SIDECAR). With the pull request's client changes reverted, the admission and connection-budget tests fail. The test guide paragraphs about them are restored, and docs cite the exported names. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(promptcontract): bind real-sidecar admission tests to current identities Carries a test change from the private cache remediation reviewed on 2026-10-03: the real-sidecar admission tests no longer hardcode old normalization and renderer identities. They select existing model metadata, recompute the current contract ID, and reject old versions, mismatched directories and ambiguous models without relabelling any artifact. TestAdmissionFixtureIdentityRejectsStaleAndMismatchedMetadata runs locally; the sidecar pairing test stays gated on the binary. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(promptcontract): one client seam on the supervisor, clearer test names Refactor pass on the ported change and its restored tests, by the dedicated subagent: - SupervisorConfig keeps a single injected dependency, Clients, which builds the supervisor's sidecar client from its effective configuration. PlanAdmissions and Transports were pure forwarding once Clients existed and are removed; tests attach the client's dependencies through Clients. With the field unset NewSupervisor builds the same client as before. - The control-capacity test loses its work-wave label: TestControlTrafficAtConfiguredWorkerCapacity in control_capacity_test.go, with permitListener and permitConn. Its body is unchanged. - planPromptRoute says why its two early returns still call the planner (to record the decision). Every test keeps its cases, assertions and messages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(cache): describe planning decisions and bounds as the code implements them Found by the refactor pass; documentation only. - Planning-decision telemetry: a decision is recorded each time a request's cache plan is computed, once per concrete model and provider-bound body. For a request that takes the public capacity preflight that happens while admission builds its forecast, so a request preflight then rejects is already counted and an alias fallback probe records a further decision. Nothing is recorded when prompt accounting declines first. lowering_unsupported is recorded after admission by the generic handler. - One legacy population grows: a media request to a verified, preload-acknowledged model is now counted once as ineligible in exact_cache_plan_total, because the planner is consulted to record its decision. No routing or billing effect. The changelog bullet says so. - The first-content bound on planning is promptwork.PlanningContext at the handlers; the planner's own bound applies only when its ReceivedAt and FirstContentBudget inputs are set, which production does not do. - With routing off, count-only prompt accounting still calls the sidecar for eligible text requests. - Rows the docs-impact rules ask for: the lowering_unsupported decision in the API contracts, the planner's owner in the routing page, and that a request without a cache plan is billed without a cached-token discount. - The test guide and a diagram use the current test and symbol names. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(promptcontract): restore the active-set, controller and commit tests The port withheld 32 tests that drove the private active-set policy, the controller's private clock and lock, or the planner's private commit step. They are restored with their names, cases and messages through a production-consumed component and injected dependencies that production leaves unset: - preload.PreloadActiveSet is the selection policy as an exported component (reconcile, demand, attempt begin and completion, conflict retirement, invalidation, snapshot) with its lease and PreloadActiveSetState, the state the controller itself reads. The controller no longer touches private policy fields. - PreloadControllerConfig.PolicyNow and .ActiveSets inject the monotonic clock and the policy; nil gives today's clock and a new policy. - routeplan.PreloadPlanning lets the cache planner read preload state through an interface (nil uses the preloader), so the commit step's second observation can be exercised without exporting it. Lock-discipline checks are black-box (a public controller call from the clock or the registry callback must not return while the lock is held). Bookkeeping with no production reader is asserted through the behaviour it causes. Not expressible without a test-only hook, and stated in the pull request: the two generation-exhaustion assertions of TestPreloadActiveSetMonotonicClockAndGenerationExhaustion, two map-size checks, and a read-held-lock case. With whole-catalog selection substituted inside this API, 18 of the 31 promptcontract tests fail; targeted substitutions each fail on the intended message. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(promptcontract): keep healthy contracts planning while the preload set reloads Every preload attempt, a retry of a failing contract or a change of the selected set, first unpublished every contract, and the sidecar refused every plan while it loaded, so cache planning closed for all models for the length of each reload. This carries the B2 fix from the private cache remediation reviewed on 2026-10-03 (Astra) onto the reorganized coordinator: - The coordinator negotiates /v2/preload with continuity_version=1 (Client.PreloadContinuous). Only an initial, recognised endpoint absence falls back to /v1/preload; negotiation is sticky for that child, and a missing or malformed marker or the loss of the endpoint revokes publication, including for a stale response from the same child. - During a negotiated reload the controller keeps the contracts that are both acknowledged and still desired under the same catalog, child, capacity and verified set (retainPublicationLocked); publication is kept across the attempt, a stale completion and a 409. - The Rust sidecar retains that same set while it loads, plans take resident ownership under the readiness gate, residents plus reservations stay within capacity, and a cancelled load keeps its ownership until it completes without publishing unacknowledged additions. The eight Rust files are the remediation's, unchanged. - A legacy child (no /v2/preload) behaves exactly as before. - Tests: TestIndependentRetryPreservesHealthyContract, TestPreloadContinuityNegotiationNeverSilentlyDowngrades, TestPreloadStaleProtocolFailureWithdrawsSameChildAuthority (through the real protocol), and four Rust continuity tests. Without the Go change the retry test fails ("closed the already-acknowledged healthy contract"); without the Rust retention three of the four Rust tests fail. - Docs: the prompt-contract sidecar page (new section on negotiated continuity), the test guide and the changelog entry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(cache): drop two redundant writes and review wording in the preload code Refactor pass on the ported change, behaviour-preserving: - preload/controller.go: remove a second continuity-loss clear on the current-attempt path (the clear above it has already run for the same child with the same reason) and a `fullyLoaded = false` that both branches before it had already written. - preload_continuity_test.go: TestIndependentRetryPreservesHealthyContract becomes TestPreloadContinuityKeepsHealthyContractReadyDuringRetry; the failure message and comment no longer carry review wording; the fake child sets the report's continuity version directly. Assertions kept. - preload_selection_order_test.go: the "no overtake" wait grows from 100 ms to ten lock-held windows (250 ms). The probing clock holds each of a reconcile's four samples for 25 ms, so an overtaking caller could never finish inside the old window and the check could not fail. - Comments: private labels and a commit hash from outside this repository are replaced by what they refer to. - docs/developer/test.md: the renamed test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: state what survives a failed preload attempt above capacity The continuity section said a transport failure retains the already acknowledged members. Within capacity that holds. Above capacity the selection policy marks every member of the failed attempt as failed and not retained, so from the next reconcile only members with demand in the last five minutes stay selected and published; an idle loaded contract is dropped and reloads on its next request. Found by the refactor pass and reproduced through the real controller and policy; the code is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(preload): reconcile lifecycle fixtures with planner readiness * test(preload): bind lifecycle fixtures to verified active sets * docs: refresh reconciled preload test coverage stamp * fix(cache): preserve negotiated preload incumbents and configured catalogs * fix(cache): retain healthy preloads across control transport failures Distinguish interrupted response bodies from invalid completed reports. Retain only acknowledged, report-successful incumbents when readiness transport fails, preserving rotation metadata without admitting newcomers. Align preload model ID bounds with accepted registration requests so long IDs cannot poison unrelated contracts. --------- Co-authored-by: jonathan308 <5055076+jonathan308@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
) * test(api): add offline OpenRouter conformance and scenario gates * fix(api): omit caller identifiers from provider inference requests * fix(cache): bound retained cache-attempt metadata * fix(cache): bound planner admission and isolate contract readiness * fix(cache): select a bounded tokenizer preload set * fix(cache): preserve durable SSD reuse and bound shorter restores (1/2) * fix(cache): preserve durable SSD reuse and bound shorter restores (2/2) * test(api): group conformance scenarios and verify model alias rewriting * docs: preserve cache guidance across conformance test organization * docs: preserve cache guidance across conformance test organization * test(api): preserve shared seams and current provider contracts * docs: align merge inputs with current upstream * docs: retain qualified conformance guidance after upstream integration * test(api): expose shared fixtures through the conformance package * docs: align merge inputs with current upstream * docs: retain qualified conformance guidance after upstream integration * Prepare upstream integration conflicts for cache stack #1210 * Reconcile cache stack #1210 with current upstream behavior * Prepare upstream integration conflicts for cache stack #1211 * Reconcile cache stack #1211 with current upstream behavior * Prepare upstream integration conflicts for cache stack #1212 * Reconcile cache stack #1212 with current upstream behavior * Prepare upstream integration conflicts for cache stack #1213 * Reconcile cache stack #1213 with current upstream behavior * Prepare upstream integration conflicts for cache stack #1214 * Reconcile cache stack #1214 with current upstream behavior * Prepare upstream integration conflicts for cache stack #1215 * Reconcile cache stack #1215 with current upstream behavior * Synchronize cancellation conformance with completed provider dispatch * Materialize native checkpoint fixture parameters and join donation writers * refactor(tests): simplify the conformance suite's seams after the port Outcome of the required refactor pass on the ported change. Test and documentation code only; the suite runs the same 22 entry points, 216 tests and 197 leaf cases with identical evidence lines. - The support package now lives beside testkit and can call it directly, so the seven pass-through hooks on Suite are removed. NewServer, the one real seam, remains. - Move the service-hold measurement into the support package as OutstandingServiceHold and state its contract: a probe briefly holds the amount it tests, and a reading is exact only while the account's balance and holds are stable. - Resolve the provider private key on the test goroutine instead of failing the test from the provider's reader goroutine. - Remove two unused fixture fields and reword one undefined label. - docs/developer/test.md: cite the new symbol and keep the cancellation fixture paragraph inside this change's own section. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(api): list the removed caller fields in the request table Outcome of the required refactor pass on the ported change: no code change was needed. The pass found one gap this change opens in the reference: the Chat Completions request table says uninterpreted fields pass through and did not list user and metadata, which are now removed before forwarding. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(changelog): give the cache reliability entry its own insertion point The entry sat directly after the newest sections, where other open pull requests also insert theirs, so each merge on master conflicted with it. Move the section below "leaderboard availability". No wording change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: locate the attempt budget's owner and file its changelog entry - Navigation: add the row for cache receipt attempts and their retained-byte budget, now owned by coordinator/internal/registry/cachetracker. - Changelog: the entry had been inserted between unrelated bullets of an older release-candidate section. Move it, unchanged, into this stack's "cache reliability" section. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(registry): let the attempt ledger own its arithmetic Required refactor pass for the ported change, by a dedicated subagent; its outcome is in the pull request description. - AttemptBudget gains replacementTotal (whether an exchange of charges fits, committing nothing) and refund (saturating on an inconsistent ledger). StoreAttemptLocked and RemoveAttemptLocked call them instead of doing the arithmetic inline: same checks, same order, same results. - New TestCacheAttemptBudgetInconsistentLedgerGrantsNoAdmission covers the incumbent guard and the refund saturation, which no test reached. - TestCacheAttemptBudgetCountEvictionRefundsWithoutChangingPublication pins its nonces, so the cap-of-one case evicts the newer record before its owner is published on every run. Under the frozen test clock the victim had been chosen by random nonce. - A comment and one documentation phrase now match the code (re-storing a terminal record; deriving the boundary claims). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(api): also remove caller safety and cache-routing hints from provider bodies The privacy fix removed the caller's top-level user and metadata before a request is sealed for a provider, but two more caller-supplied top-level fields still reached providers: safety_identifier and the caller's prompt_cache_key. Neither is needed for inference; authentication, billing and cache scope come from trusted context. This carries the fix from the private cache remediation reviewed on 2026-10-03 onto the reorganized coordinator: - stripProviderCallerIdentity (coordinator/internal/inference/prelude) deletes both fields. Nested fields of the same name stay semantic input. The coordinator may still append its own protocol-0 cache-bust key after this point. - Tests: TestProviderIdentityRoutingHintsAreNotForwarded (through the real prelude), three new field-shape cases including escaped key names, the direct-encrypted and alias-fallback oracles, and the absence helper in all three test packages that keep a copy of it. - Docs: encryption model, consumer privacy expectations, API contracts (including that a cache scope is a stable account/model pseudonym). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(api): send the new caller fields on the alias-rewrite path too The alias-fallback privacy test's oracle already removed safety_identifier and prompt_cache_key, but its request never sent them, so the alias-rewrite path did not exercise the new minimization. Send both, as the direct-encrypted test does. Found by the refactor pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(registry): reclaim finished cache attempts before refusing a new one When the 64 MiB attempt budget was full, a new record was refused and the request went out with prefix caching off, while records of requests that had already finished kept their bytes through the two-minute late-receipt grace; nothing counted the refusals. Simulated on the real registry code, that sent 30-59% of dispatches uncached at 120 cache-enabled dispatches per second. This carries the B1 fix from the private cache remediation reviewed on 2026-10-03 (Astra) onto the reorganized coordinator: - An attempt is marked terminal once; a repeated terminal call no longer extends its grace. Terminal attempts also sit in a per-generation terminal expiry order. - Admission validates and detaches the candidate first. If it does not fit, it peeks at most 64 earliest-expiring terminal records without changing anything, never the nonce being replaced, and removes them only if their full refund admits the candidate; otherwise it refuses and removes nothing. A record larger than the whole budget is refused. - Each boundary hash is charged once (it is stored once). - attempt_bytes, attempt_budget_refused and attempt_grace_reclaimed in /v1/cache/status, Prometheus and Datadog. - Tests: the remediation's pressure controls and terminal-grace test, plus TestCacheAttemptBudgetReclaimsFinishedRecordsBeforeRefusing and TestCacheAttemptBudgetRefusesWhenInFlightRecordsFillIt. With the previous store path substituted, 11 tests fail. - Docs: cache-aware routing (formula, reclaim policy, gauges), the API contracts, the test guide, navigation and the changelog entry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(telemetry): list the attempt-budget gauges The reclaim change added three exact-cache gauges; the telemetry inventory now names them with the status fields they mirror. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(registry): tidy the reclaim change's tests and wording Refactor pass on the reclaim change, by the dedicated subagent: - The two pressure controls that built the same 65-record terminal setup share one helper; the late-READY control uses the existing charge helper. Every assertion and message is unchanged. - The architecture doc says reclaim never takes the record being replaced, and that the count cap evicts the record that expires first. - The status field comment no longer implies that a refusal reclaims. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(registry): count only grace reclaims that cut a grace short attempt_grace_reclaimed also counted finished records whose two-minute grace had already ended but which the 30-second sweep had not removed yet. Those forfeit nothing, and the status contract and telemetry inventory define the gauge as records reclaimed inside their grace. - reclaimTerminalGraceLocked takes the admission's clock reading and counts a victim only if it was still inside its grace. - TestCacheAttemptPressureCountsOnlyGraceCutShort: a record whose grace ended 10 s before an admission (with the next sweep not yet due) is reclaimed without being counted; a record still inside its grace is counted. The first half fails without this change ("attempt_grace_reclaimed=1 for a record whose grace had ended 10s earlier"). - The telemetry inventory now states when a refusal is counted. Found by the refactor pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(promptcontract): restore the planning-admission and connection-budget tests The port withheld eleven tests because they read the sidecar client's private admission state and connection pools. They are restored with their names, cases and messages through injected dependencies that production leaves unset, the pattern CacheDependencies already uses: - sidecar.PlanAdmission is the client's planning admission as an exported component (constructor, Acquire, read-only counts of workers, active and pending plans and pending bytes, and the two pending limits). NewClient builds it; Client.Plan acquires it on every call. - sidecar.ClientConfig.PlanAdmissions builds the admission and ClientConfig.Transports wraps each of the client's three HTTP pools (planning, health, control); nil gives exactly today's admission and transports. - promptcontract.SupervisorConfig forwards both, and its new Clients factory builds the supervisor's client from its effective configuration (nil uses sidecar.NewClient). Through it, TestPlanningConnectionBudget keeps its "worker capacity changed" and "server connection limit changed" checks. Restored: TestPlanningClientTracksConfiguredWorkers, TestPlanAdmissionBoundsAndRefunds, TestPlanAdmissionCancellationAndDeadline, TestPlanningConnectionBudget, TestControlReconnectsDuringPlanningSaturation, TestPlannerBurstWaitsForWorkersWithoutBlockingHealth, TestQueuedPlanCancellationNeverReachesSidecar, TestCancelledActivePlannerWorkStillFailsColdUntilBackendDrains, TestReviewControlTrafficAtConfiguredWorkerCapacity, and the two real-sidecar preload tests (gated on DARKBLOOM_TEST_PROMPT_SIDECAR). With the pull request's client changes reverted, the admission and connection-budget tests fail. The test guide paragraphs about them are restored, and docs cite the exported names. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(promptcontract): bind real-sidecar admission tests to current identities Carries a test change from the private cache remediation reviewed on 2026-10-03: the real-sidecar admission tests no longer hardcode old normalization and renderer identities. They select existing model metadata, recompute the current contract ID, and reject old versions, mismatched directories and ambiguous models without relabelling any artifact. TestAdmissionFixtureIdentityRejectsStaleAndMismatchedMetadata runs locally; the sidecar pairing test stays gated on the binary. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(promptcontract): one client seam on the supervisor, clearer test names Refactor pass on the ported change and its restored tests, by the dedicated subagent: - SupervisorConfig keeps a single injected dependency, Clients, which builds the supervisor's sidecar client from its effective configuration. PlanAdmissions and Transports were pure forwarding once Clients existed and are removed; tests attach the client's dependencies through Clients. With the field unset NewSupervisor builds the same client as before. - The control-capacity test loses its work-wave label: TestControlTrafficAtConfiguredWorkerCapacity in control_capacity_test.go, with permitListener and permitConn. Its body is unchanged. - planPromptRoute says why its two early returns still call the planner (to record the decision). Every test keeps its cases, assertions and messages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(cache): describe planning decisions and bounds as the code implements them Found by the refactor pass; documentation only. - Planning-decision telemetry: a decision is recorded each time a request's cache plan is computed, once per concrete model and provider-bound body. For a request that takes the public capacity preflight that happens while admission builds its forecast, so a request preflight then rejects is already counted and an alias fallback probe records a further decision. Nothing is recorded when prompt accounting declines first. lowering_unsupported is recorded after admission by the generic handler. - One legacy population grows: a media request to a verified, preload-acknowledged model is now counted once as ineligible in exact_cache_plan_total, because the planner is consulted to record its decision. No routing or billing effect. The changelog bullet says so. - The first-content bound on planning is promptwork.PlanningContext at the handlers; the planner's own bound applies only when its ReceivedAt and FirstContentBudget inputs are set, which production does not do. - With routing off, count-only prompt accounting still calls the sidecar for eligible text requests. - Rows the docs-impact rules ask for: the lowering_unsupported decision in the API contracts, the planner's owner in the routing page, and that a request without a cache plan is billed without a cached-token discount. - The test guide and a diagram use the current test and symbol names. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(promptcontract): restore the active-set, controller and commit tests The port withheld 32 tests that drove the private active-set policy, the controller's private clock and lock, or the planner's private commit step. They are restored with their names, cases and messages through a production-consumed component and injected dependencies that production leaves unset: - preload.PreloadActiveSet is the selection policy as an exported component (reconcile, demand, attempt begin and completion, conflict retirement, invalidation, snapshot) with its lease and PreloadActiveSetState, the state the controller itself reads. The controller no longer touches private policy fields. - PreloadControllerConfig.PolicyNow and .ActiveSets inject the monotonic clock and the policy; nil gives today's clock and a new policy. - routeplan.PreloadPlanning lets the cache planner read preload state through an interface (nil uses the preloader), so the commit step's second observation can be exercised without exporting it. Lock-discipline checks are black-box (a public controller call from the clock or the registry callback must not return while the lock is held). Bookkeeping with no production reader is asserted through the behaviour it causes. Not expressible without a test-only hook, and stated in the pull request: the two generation-exhaustion assertions of TestPreloadActiveSetMonotonicClockAndGenerationExhaustion, two map-size checks, and a read-held-lock case. With whole-catalog selection substituted inside this API, 18 of the 31 promptcontract tests fail; targeted substitutions each fail on the intended message. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(promptcontract): keep healthy contracts planning while the preload set reloads Every preload attempt, a retry of a failing contract or a change of the selected set, first unpublished every contract, and the sidecar refused every plan while it loaded, so cache planning closed for all models for the length of each reload. This carries the B2 fix from the private cache remediation reviewed on 2026-10-03 (Astra) onto the reorganized coordinator: - The coordinator negotiates /v2/preload with continuity_version=1 (Client.PreloadContinuous). Only an initial, recognised endpoint absence falls back to /v1/preload; negotiation is sticky for that child, and a missing or malformed marker or the loss of the endpoint revokes publication, including for a stale response from the same child. - During a negotiated reload the controller keeps the contracts that are both acknowledged and still desired under the same catalog, child, capacity and verified set (retainPublicationLocked); publication is kept across the attempt, a stale completion and a 409. - The Rust sidecar retains that same set while it loads, plans take resident ownership under the readiness gate, residents plus reservations stay within capacity, and a cancelled load keeps its ownership until it completes without publishing unacknowledged additions. The eight Rust files are the remediation's, unchanged. - A legacy child (no /v2/preload) behaves exactly as before. - Tests: TestIndependentRetryPreservesHealthyContract, TestPreloadContinuityNegotiationNeverSilentlyDowngrades, TestPreloadStaleProtocolFailureWithdrawsSameChildAuthority (through the real protocol), and four Rust continuity tests. Without the Go change the retry test fails ("closed the already-acknowledged healthy contract"); without the Rust retention three of the four Rust tests fail. - Docs: the prompt-contract sidecar page (new section on negotiated continuity), the test guide and the changelog entry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: correct the moved diagnostic test's command and tidy the SSD restoration pages Refactor pass on the ported change. Documentation only; no Go, Swift or e2e file changes: - docs/developer/test.md: TestDiagnosticCacheEpochFanout is selected with `go test ./tests/registry`, its package since the coordinator reorganization. - docs/reports/2026-09-24-cache-eviction-publication.md: the recorded commands stay as run; a dated layout note says where the test lives now. - docs/reference/ssd-kv-cache.md: "Bounded shorter complete-checkpoint fallback" moves to the end of "Complete checkpoint payload", so that section's layout table no longer renders under the fallback heading. The text is unchanged. - docs/reports/2026-09-27-cache-connected-qualification.md: seven missing spaces between a word and a number restored. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(cache): drop two redundant writes and review wording in the preload code Refactor pass on the ported change, behaviour-preserving: - preload/controller.go: remove a second continuity-loss clear on the current-attempt path (the clear above it has already run for the same child with the same reason) and a `fullyLoaded = false` that both branches before it had already written. - preload_continuity_test.go: TestIndependentRetryPreservesHealthyContract becomes TestPreloadContinuityKeepsHealthyContractReadyDuringRetry; the failure message and comment no longer carry review wording; the fake child sets the report's continuity version directly. Assertions kept. - preload_selection_order_test.go: the "no overtake" wait grows from 100 ms to ten lock-held windows (250 ms). The probing clock holds each of a reconcile's four samples for 25 ms, so an overtaking caller could never finish inside the old window and the check could not fail. - Comments: private labels and a commit hash from outside this repository are replaced by what they refer to. - docs/developer/test.md: the renamed test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: state what survives a failed preload attempt above capacity The continuity section said a transport failure retains the already acknowledged members. Within capacity that holds. Above capacity the selection policy marks every member of the failed attempt as failed and not retained, so from the next reconcile only members with demand in the last five minutes stay selected and published; an idle loaded contract is dropped and reloads on its next request. Found by the refactor pass and reproduced through the real controller and policy; the code is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(cache): keep SSD cache ownership through a transient epoch-record read failure performOwnedRetirement and performOwnedDestructiveChange re-read the epoch record to confirm the instance still owns the store, through `try? Self.readRecord(...)`. Any thrown read error, including a transient one (EACCES, EIO, EBUSY from openat or read), collapsed to "record gone or changed", set `epoch = nil` and disowned the cache until the process restarted: no checkpoint writes or restores from that store while the model kept serving. Both paths now re-read through one helper, ownedRecordStillCurrentLocked, which separates "read and refuted" from "not read". A record that is missing, undecodable, or carries another epoch, binding or schema still disowns, and so do readRecord's own verdicts (a non-regular entry, an oversized record). Any other thrown error refuses that one owned operation, logs once per failure run, keeps the epoch and the ledger entry, and lets the next owned pass re-read. No change to the on-disk format, the file name, initialisation, sequence issue, lock order, TTL or eviction constants. Tests: SSDCacheEpochStoreRecoveryTests (10 tests, 20 parameterised cases): transient failure then success keeps the epoch for retirement and rotation, also repeated and concurrent; missing record, changed epoch, binding and schema, malformed bytes, a record replaced by a symlink or directory, an oversized record and an empty record all disown, before and after a failure; no resurrection. With the fix removed the two transient tests fail at `store.current == epoch`. `swift test --filter SSDCacheEpochStore`: 21 tests in 2 suites pass. Reviewed independently (one major, applied: the kept class had included readRecord's own verdicts; two minors applied). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * test(preload): reconcile lifecycle fixtures with planner readiness * test(preload): bind lifecycle fixtures to verified active sets * docs: refresh reconciled preload test coverage stamp * fix(cache): preserve negotiated preload incumbents and configured catalogs * fix(cache): retain SSD epoch ownership on uncertain lookups * test(cache): distinguish corrupt blocks from missing paths --------- Co-authored-by: jonathan308 <5055076+jonathan308@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Summary
Provide reusable offline OpenRouter conformance fixtures and scenario gates for the four inference endpoints, including streaming, errors, cancellation, readiness and billing behavior.
Part 1 of the seven-part cache stack, based on master. Now integrated with master
5b7a675c7(2026-10-05), after the coordinator reorganization in #1324; see Ported onto the reorganized coordinator below. Review dependency-first and recheck descendants after any squash merge.Changes
store.ModelPriceAPI and the current half-input cache price.Before — behavior and code flow
flowchart TB A["Separate endpoint fixtures"] --> B["Inconsistent request and scenario assertions"] B --> C["Compatibility regressions escape"] classDef step fill:#eff6ff,stroke:#1d4ed8,color:#172554; classDef result fill:#fff1f2,stroke:#be123c,color:#881337; class A,B step; class C result;After — behavior and code flow
flowchart TB A["Shared conformance fixture"] --> B["Run endpoint and scenario gates"] B --> C["Assert response, usage and cleanup"] classDef step fill:#eff6ff,stroke:#1d4ed8,color:#172554; classDef result fill:#ecfdf5,stroke:#047857,color:#064e3b; class A,B step; class C result;Blue shows processing; red shows the prior failure or coverage gap; green shows the resulting behavior.
Ported onto the reorganized coordinator (2026-10-04)
Merged current master
5b7a675c7(after #1324, #1338, #1340, #1342, #1343 and #1345) with signed merge commits9f729733,08eb4a7band4f457918. This part still adds tests and test support only: no production file differs from master.coordinator/api/conformance/(13 files that importtesting)coordinator/tests/internal/conformance/. Production directories may no longer hold test support; undertests/internal/every coordinator test package can import it and production cannot. Import path:github.com/eigeninference/d-inference/coordinator/tests/internal/conformancecoordinator/api/conformance_test.go(packageapi)coordinator/tests/api/inference/contracts/openrouter_conformance_test.go(packageinference_test). The 22TestOpenRouterConformance*functions, every subtest and every assertion are unchangedNewServerand private fieldsapi.NewRuntime, with one shared ledger and an injected reservation controlleroutstandingmapconformance.OutstandingServiceHoldmeasures the hold at the controller's own admission boundary (ReserveInitial/ReleaseInitial, each probe released at once). See the reviewer note belowValidation command, replacing the one under Validation below:
Refactor pass. A dedicated refactor subagent reviewed the ported change against the structure and clean-code rules in
AGENTS.mdand made behaviour-preserving cleanups, in a separate commit (db28ca6a): the seven hooks onSuitethat only forwarded to the shared test kit are gone (NewServeris the one real seam left); the hold measurement moved into the support package with its contract documented, so the later parts can reuse it; the provider key lookup runs on the test goroutine; two unused fixture fields were removed. It left the exported helpers the later parts use, and the evidence labels, untouched.Validation on the merged head
4f457918(Go 1.25.0, PostgreSQL 16):9f729733), the counts and the evidence lines were compared side by side with the pre-port head and were identical.coordinator/tests/api/inference/contractspackage under-race.gofmtclean,go vet ./coordinator/..., layout guardTestCoordinatorTestsAreIsolated(in the suite below).python3 scripts/run-coordinator-tests.py --jobs 1 ./coordinator/...: 8,376 passed, 0 failed, 5 skipped (the five that skip on master).make docs-check(331 files) andmake docs-impact-check BASE=origin/master.golangci-lint. CI covers them.Reviewer note: the hold measurement is a probe, not a read. Master keeps the per-account hold private and exposes no reader, and the new rules forbid a test-only accessor. The helper binary-searches the largest amount the controller admits and returns balance minus that; it was checked against known holds and never touches the ledger. It is exact only while the account's balance and holds are stable, which holds everywhere this part calls it. If you would rather have a production-consumed reader on the controller, that is a small change and this helper goes away.
No wire-level expectation in the suite had to change: every status code, header, error body and SSE framing rule it asserts holds on current master.
Refreshed onto master
bf3dc6752(2026-10-05). Signed mergeb4022af2, no conflicts. Re-checked at that head:make docs-check,make docs-impact-check BASE=origin/master,gofmt,go build ./coordinator/...,go vet ./coordinator/..., the layout guard, and the wholecoordinator/tests/api/inference/contractspackage under-race: all pass. The complete coordinator suite was not re-run locally at this head (it last ran at4f457918); it is re-run on the refreshed parts above this one (#1214 and #1216), and CI runs it here.Refreshed onto master
dccc9ee03(2026-10-06). Signed mergec30feb22of master; no conflict and no other change. Master brings #1344 (App Attest required for routing outside the legacy cohort), #1328 (coordinator schema as goose migrations; Go 1.25.7), #1352, #1351 and #1355, and moves the engine submodulelibs/mlx-swift-lmfrom1ee8675atoe407e899(an engine fix that retires cancelled waiting requests before removing them, plus formatting). Local checks at this head (Go 1.25.7):go build,go vet,gofmtand the runner guards pass; the complete coordinator suite was run locally on #1215's and #1216's heads and CI runs it on this head. The seven parts are held as one delivery: please do not merge any of them before the owner's review of the final evidence, which is being collected in #1216.Validation (earlier head, pre-reorganization paths)
GOTOOLCHAIN=go1.25.0 go test -race -short ./coordinator/api -run "^TestOpenRouterConformance" -count=1passes.Per-part
make docs-impact-check BASE=<predecessor>andmake docs-checkpass; the final documentation check covers 327 files. Integration headee7731b56296f3f7c6cb6cbbab137df2c7fbbaabhas treeceb0d8b0e03661f2974ab379459c37ef8afde4ecand GitHub-verified commits. Existing history is preserved through fast-forward branch updates.Post-CI fixture verification
The shared cancellation fixture now waits for the existing completed-write stamp before requiring a provider cancel frame; in-flight write aborts remain covered separately. The fixed cancellation test passes 500 race/coverage repetitions, and the full conformance plus writer-boundary regressions pass.
Limits and release gates
Offline fixture coverage is not hosted OpenRouter certification.
Fresh hosted CI/review and required benchmark approval must be evaluated on these updated heads. This integration does not merge or deploy the stack. Existing privacy, authentication, admission and memory protections remain required.
Documentation and tracking
Canonical behavior and test documentation are updated in the stack. Cache routing — high hit rates tracks integration and measured rollout. No issue is auto-closed.