Skip to content

feat: consolidate response handling and native API features - #542

Merged
tylerslaton merged 27 commits into
mainfrom
blitz/response-consolidation/final-history
Oct 18, 2026
Merged

tylerslaton merged 27 commits into
mainfrom
blitz/response-consolidation/final-history

Conversation

@jpr5

@jpr5 jpr5 commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Centralizes duplicated response construction in shared usage/policy/error owners; allocated bytes/journals/transports/native exceptions stay intact. Preserves Anthropic cache usage through serving/recording conversions, completes native model/count/auth routes, and adds opt-in required-header policy.

  1. Preserve Anthropic cache usage in responses and recordings, including Bedrock deltas and nested TTL cache input.
  2. Add native model catalogs, deterministic token count routes and provider-native inbound authentication errors.
  3. Add opt-in required-header policy, config/CLI/header resolution, local policy-header egress exclusion, package/API compatibility, native drift observations and required-header request-ID correlation.

Required-header policy defaults off. Config/JS/CLI --policy requiredHeaders=enforce/request policy header share resolver; local policy headers stay local. Native error serialization and four enforced missing-version envelopes’ correlated IDs are preserved. Owners cover allocated usage/common body/policy; provider envelopes, fixture/raw bytes and state-machine errors retain their contracts.

Local proof and what it establishes

Literal outputs use real servers/installed SDKs/recording-loaders/local upstreams/built binaries. Adoption RED lacks import-bound ownership while behavior/captures pass; GREEN closes ownership. Skips/additions disclosed. Multicell claims retain pre/post values for≥3affected cells, not just matched errors. No vendor/dashboard-cell counts.

Proof group Observed result / limit
Cache serving/recording Actual HTTP/SSE/AWS-event-stream and recorded/replayed fixture values retain the supplied cache fields; numeric/no-cache and misbehavior controls preserved.
Catalog/count/auth Native HTTP/SDK paging/lifecycle/encoded-ID cases PASS; deterministic local counts, not vendor tokenizer/billing parity. Mock inbound-auth preserved; historical vendor Gemini auth differs.
Required headers Real default/off, enforce, direct route, config, built CLI and precedence cases; missing-header bodies/status and ordinary controls retained.
Request-ID correction Four fresh local HTTP envelopes correlate request IDs against the same frozen authenticated receipts. Comparisons pass with no quarantine; exact matched:false remains for distinct IDs. No fresh vendor call or published-candidate parity claim.
Observation completeness Each independent producer omission preserved 20 native test passes but lost two required persisted IDs (17→15 records). New maintained real-collector test rejects both same omissions; restored output has 17 records, four exact policy400 values and thirteen unchanged original controls.
CI native activation HEAD collector opts into full native matrix. Authenticated local4receipt activation; request-ID comparisons fixed separately. BASE/global/manual/default unchanged; published same-HEAD full matrix required.
Adoption Actual HTTP/SSE/WS/recording/body/journal values retained before/after, with import/symbol-bound shared ownership checked separately. Final inventory has zero unclassified allocated common assemblies.

Tracked proofs are in src/__tests__: response cache/model/count/auth/header/CLI/egress/adoption and drift tests. Public artifact links require actual final refs; workstation evidence is not a public link.

Retained safety-foundation corrections

Historical golden/real-HTTP/API foundation:178snapshots/14export conditions. Excerpts qualify unchanged inputs only, including intended rejection GREEN and ordinary pass GREEN.

Freshness bypass: export an interface and regenerate reports without committing them; run the workflow's comparison step as a labeled pull request.

CASE RED-stale-labeled-incorrectly-accepted
EXIT 0
API report changes accepted (public-api-addition label); compatibility review required. Breaking changes are not allowed.

CASE GREEN-stale-rejected-pull_request-true
EXIT 1
::error::Generated API reports differ from committed reports. Run 'pnpm build && pnpm api:report' and commit etc/. Labels cannot bypass report freshness.

Committed-change authorization: export an interface, build, regenerate and commit the changed reports; run the workflow comparison against the same recorded PR base with no label.

real-committed-report-diff: exit 1
CASE RED-changed-committed-unlabeled-incorrectly-accepted
EXIT 0

IDENTICAL REAL GENERATED REPORT SNAPSHOT: RED == GREEN
CASE GREEN-changed-committed-unlabeled-rejected
EXIT 1
::error::Committed API reports differ from the pull request base. Add the public-api-addition label for intended changes and manual compatibility review. Breaking changes are not allowed.

Controls passed: fresh unchanged unlabeled PR, fresh labeled report changes, and fresh push; label removal, missing/invalid base, stale labeled reports and stale push reject. Comment-only report changes pass. Retained independent workflow verification repeated the relevant event/label matrix.

Late handler rejection: the real mounted handler returned HTTP 200 while its invocation remained pending, then rejected 100 ms after capture. Both runs used the identical temporary reproduction and this command:

pnpm exec vitest run src/__tests__/handlers-direct-call.test.ts --maxWorkers=1 --minWorkers=1 --fileParallelism=false --silent=false -t 'handler completion readiness proof'
RED (exit 0 — bug incorrectly accepted):
READINESS: unreported errors after teardown: [ 'Error: readiness late rejection after teardown' ]
 Test Files  1 passed (1)
      Tests  3 passed | 62 skipped (65)

GREEN (exit 1 — deliberately faulty handler correctly rejected):
READINESS: unreported errors after teardown: []
Error: direct-call handler threw: Error: readiness late rejection after teardown
 Test Files  1 failed (1)
      Tests  1 failed | 2 passed | 62 skipped (65)

The diagnostic failure is expected GREEN for error detection; its completed-handler control passes. The foundation proof recorded the permanent direct-call suite passing 65/65, including real HTTP completion, late rejection and bounded unfinished-handler cleanup cases.

Feature and consumer proof excerpts

1. Cache serving and recording. Original 43-case pre-edit run; expanded final 49-case suite retains the original requests and adds delta/no-cache controls.

RED (retained local output):
 Test Files  2 failed (2)
      Tests  23 failed | 20 passed (43)
GREEN (retained local output):
 Test Files  2 passed (2)
      Tests  49 passed (49)

2. Bedrock cache deltas, same expanded repro. Actual AWS event-stream delta requests; six missing-cache failures before the private delta correction.

RED (retained local output):
 Test Files  2 failed (2)
      Tests  6 failed | 43 passed (49)
GREEN (retained local output):
 Test Files  2 passed (2)
      Tests  49 passed (49)

3. Cache sanitizer. Retained cache-value correction proof; controls remain passing.

RED (retained local output):
 Test Files  1 failed | 1 passed (2)
      Tests  5 failed | 48 passed (53)
GREEN (retained local output):
 Test Files  2 passed (2)
      Tests  53 passed (53)

4. Own-key cache values. Retained own-key contract correction; complements actual serving/recording proof.

RED (retained local output):
 Test Files  1 failed (1)
      Tests  4 failed | 13 passed (17)
GREEN (retained local output):
 Test Files  1 passed (1)
      Tests  17 passed (17)

5. Native model catalogs, final same-suite repro. Actual source HTTP and installed SDK consumers; exact final suite rerun on baseline/candidate sources.

RED (retained local output):
 Test Files  1 failed (1)
      Tests  63 failed | 6 passed (69)
GREEN (retained local output):
 Test Files  1 passed (1)
      Tests  69 passed (69)

6. Catalog colon IDs. Focused pre-edit ID repro is retained inside the broader final suite; counts and filtered skips differ.

RED (retained local output):
 Test Files  1 failed (1)
      Tests  2 failed | 1 passed | 66 skipped (69)
GREEN (retained local output):
 Test Files  2 passed (2)
      Tests  101 passed | 4 skipped (105)

7. Token counts and native auth, same 42-case repro. Actual HTTP/SDK requests; count routes returned 404 and native auth used the legacy body before correction.

RED (retained local output):
 Test Files  2 failed (2)
      Tests  40 failed | 2 passed (42)
GREEN (retained local output):
 Test Files  2 passed (2)
      Tests  42 passed (42)

8. Actual drift artifact transport. Same collector/request/case values; final suite adds transport/parser controls.

RED (retained local output):
 Test Files  1 failed (1)
      Tests  1 failed | 2 skipped (3)
GREEN (retained local output):
 Test Files  1 passed (1)
      Tests  10 passed | 2 skipped (12)

9. Native drift workflow coverage. Real collector artifacts; outer exit1 retains the deliberately unavailable AG-UI leg.

RED (retained local output):
actual collector exit=1; entries=0; quarantine=0; observations=0
required missing=["local:anthropic-limit-zero","local:anthropic-after-unknown","local:anthropic-lifecycle-invalid","local:gemini-page-size-negative","local:gemini-page-token-invalid","local:anthropic-auth","local:anthropic-missing-version","local:gemini-auth"]
{
  "schemaVersion": 1,
  "generatedAt": "2026-10-13T17:22:14.393Z",
  "observations": []
}
GREEN (retained local output):
actual collector exit=1; entries=0; quarantine=0; observations=16
required missing=[]
{
  "schemaVersion": 1,
  "generatedAt": "2026-10-13T17:39:05.234Z",
  "observations": [
    {

10. Public policy warnings. Real LLMock/createServer surfaces; filtered real-entry-point repro, not fake handlers.

RED (retained local output):
 Test Files  1 failed (1)
      Tests  5 failed | 2 passed | 6 skipped (13)
GREEN (retained local output):
 Test Files  1 passed (1)
      Tests  7 passed | 6 skipped (13)

11. Required-header enforcement. Real source/direct-route requests; thirteen failing checks and seven passing controls before enforcement.

RED (retained local output):
 Test Files  1 failed (1)
      Tests  13 failed | 7 passed (20)
GREEN (retained local output):
 Test Files  1 passed (1)
      Tests  20 passed (20)

12. Config and built CLI policy. Same filtered config/actual rebuilt-bin repro; separate full 48-case policy suite is retained.

RED (retained local output):
 Test Files  1 failed (1)
      Tests  5 failed | 7 passed | 36 skipped (48)
GREEN (retained local output):
 Test Files  1 passed (1)
      Tests  12 passed | 36 skipped (48)

13. Actual upstream policy-header exclusion. Record-mode HTTP against a controlled real local upstream; ordinary forwarding and strict exclusion preserved.

RED (retained local output):
 Test Files  1 failed (1)
      Tests  1 failed (1)
GREEN (retained local output):
 Test Files  1 passed (1)
      Tests  1 passed (1)

14. Packed ESM/CJS policy compatibility. Actual npm pack/tar and tsc consumers; old-contract compiler passes in both phases, policy compiler changes exit2 to exit0.

RED (retained local output):
policy.cts(7,8): error TS2305: Module '"@copilotkit/aimock"' has no exported member 'AimockPolicy'.
policy.ts(7,8): error TS2305: Module '"@copilotkit/aimock"' has no exported member 'AimockPolicy'.
EXIT 2
GREEN (retained local output):
EXIT 0
EXIT 0

15. API-report optional policy contract. Same artifact assertions on actual generated API reports; generator freshness and compatibility remain separate.

RED (retained local output):
FAIL etc/aimock-index.import.api.md: AimockPolicy.requiredHeaders optional off/enforce
FAIL etc/aimock-index.import.api.md: MockServerOptions optional policy
GREEN (retained local output):
PASS etc/aimock-index.import.api.md: AimockPolicy.requiredHeaders optional off/enforce
PASS etc/aimock-index.import.api.md: MockServerOptions optional policy

16. CI native activation. Authenticated receipts activated; comparisons still failed on request_id before the separately measured correction. This is activation GREEN, not parity/CI GREEN.

RED (retained local output):
actual collector exit=1; entries=0; quarantine=0; observations=4
workflow-derived native flag=UNSET; cached Anthropic credential available=true
required vendor missing=["vendor:anthropic-messages-missing-version-enforce","vendor:anthropic-count-missing-version-enforce","vendor:anthropic-models-missing-version-enforce","vendor:anthropic-model-detail-missing-version-enforce"]
selected comparison dispositions={"skipped":4}
RED: actual old head-step environment skips all four authenticated vendor cases; required receipt artifact absent
GREEN (retained local output):
actual collector exit=1; entries=4; quarantine=0; observations=8
workflow-derived native flag=1; cached Anthropic credential available=true
required vendor missing=[]
selected comparison dispositions={"failed":4}
GREEN: actual new head-step environment emits all four authenticated vendor receipts; activation proven; parity classified separately

17. Required-header request-ID correlation. Same four fresh source HTTP cases replay the same frozen authenticated receipts, with zero vendor calls; exact matched=false retained.

RED (retained local output):
fresh source HTTP cells=4; missing local request_id=4; frozen vendor request_id strings=4; exact matched=false=4
actual collector exit=1; native exit=1; entries=4; quarantine=0; comparison dispositions={"failed":4}; vendor calls=0 (frozen receipt replay)
RED: all four fresh actual local policy400 envelopes omit measured request_id; unchanged comparisons fail with four persisted presence warnings
GREEN (retained local output):
fresh source HTTP cells=4; missing local request_id=0; frozen vendor request_id strings=4; exact matched=false=4
actual collector exit=1; native exit=0; entries=0; quarantine=0; comparison dispositions={"passed":4}; vendor calls=0 (frozen receipt replay)
GREEN: all four fresh actual local policy400 envelopes correlate safe request_id; unchanged comparisons pass; exact matched=false retained for distinct vendor IDs

18. Chat/Anthropic/Bedrock usage ownership. 150 actual baseline comparisons pass in both phases; two owner gaps close.

RED (retained local output):
 Test Files  1 failed (1)
      Tests  2 failed | 150 passed (152)
GREEN (retained local output):
 Test Files  1 passed (1)
      Tests  152 passed (152)

19. Responses usage/finish ownership. Same final 195-case suite; 192 actual capture/value cases remain unchanged.

RED (retained local output):
 Test Files  1 failed (1)
      Tests  2 failed | 193 passed (195)
GREEN (retained local output):
 Test Files  1 passed (1)
      Tests  195 passed (195)

20. Gemini/Interactions usage ownership. 366 actual HTTP/SSE cases and saved captures remain byte-identical.

RED (retained local output):
 Test Files  1 failed (1)
      Tests  3 failed | 366 passed (369)
GREEN (retained local output):
 Test Files  1 passed (1)
      Tests  369 passed (369)

21. Other HTTP/event-stream usage ownership. 288 real-surface preservation cases remain passing.

RED (retained local output):
 Test Files  1 failed (1)
      Tests  3 failed | 288 passed (291)
GREEN (retained local output):
 Test Files  1 passed (1)
      Tests  291 passed (291)

22. Recorder usage collapse ownership. Real recording/collapse preservation plus import-bound ownership.

RED (retained local output):
 Test Files  1 failed (1)
      Tests  1 failed | 36 passed (37)
GREEN (retained local output):
 Test Files  1 passed (1)
      Tests  37 passed (37)

23. Realtime WS usage ownership. 44 actual GA WebSocket cases remain passing; retired beta-shape behavior remains unchanged.

RED (retained local output):
 Test Files  1 failed (1)
      Tests  1 failed | 44 passed (45)
GREEN (retained local output):
 Test Files  1 passed (1)
      Tests  45 passed (45)

24. Common chat policy/error ownership. 192 real-surface checks remain passing; two owner gaps close.

RED (retained local output):
 Test Files  1 failed (1)
      Tests  2 failed | 192 passed (194)
GREEN (retained local output):
 Test Files  1 passed (1)
      Tests  194 passed (194)

25. Messages policy/error ownership. 60 actual runtime checks remain passing.

RED (retained local output):
 Test Files  1 failed (1)
      Tests  3 failed | 60 passed (63)
GREEN (retained local output):
 Test Files  1 passed (1)
      Tests  63 passed (63)

26. Responses HTTP/WS policy/error ownership. 24 actual runtime cases and 63 saved captures remain identical.

RED (retained local output):
 Test Files  1 failed (1)
      Tests  6 failed | 24 passed (30)
GREEN (retained local output):
 Test Files  1 passed (1)
      Tests  30 passed (30)

27. Converse/Cohere/Ollama policy/error ownership. The accepted original pre-edit RED has three bound-owner failures and128 actual runtime passes. Five additional pre-edit native501 cases form133 runtime cases/141 retained captures. The final same136-case command closes the remaining serializer-owner counts. Journal Host is replaced with a placeholder under a bounded accepted transport-evidence exception: these captures do not prove Host value/presence preservation. Actual response status/headers/body/frames, strict overrides and other target journal fields remain qualified. The fixed-Host experiment is rejected and contributes no accepted proof.

ORIGINAL PRE-EDIT RED (accepted local output):
 Test Files  1 failed (1)
      Tests  3 failed | 128 passed (131)
ADDITIONAL PRE-EDIT NATIVE501 CAPTURES (filtered subset):
 Test Files  1 passed (1)
      Tests  5 passed | 131 skipped (136)
FINAL SAME-SUITE RED — before five serializer adoptions:
 Test Files  1 failed (1)
      Tests  3 failed | 133 passed (136)
GREEN — identical final command after adoption:
 Test Files  1 passed (1)
      Tests  136 passed (136)

28. Media/video policy/error ownership. One actual HTTP matrix plus nine structural owner obligations; ownership failures are not nine vendor-cell failures.

RED (retained local output):
 Test Files  1 failed (1)
      Tests  9 failed | 1 passed (10)
GREEN (retained local output):
 Test Files  1 passed (1)
      Tests  10 passed (10)

29. Audio policy/error ownership. 125 actual runtime controls remain passing; six owner gaps close after the shared error prerequisite.

RED (retained local output):
 Test Files  1 failed (1)
      Tests  6 failed | 125 passed (131)
GREEN (retained local output):
 Test Files  1 passed (1)
      Tests  131 passed (131)

30. Additional common error ownership. Six owner assertions cover twenty allocated sites; real baseline was already passing.

RED (retained local output):
 Test Files  1 failed (1)
      Tests  6 failed | 1 skipped (7)
GREEN (retained local output):
 Test Files  1 passed (1)
      Tests  7 passed (7)

31. Optional error metadata owner, real HTTP. Focused actual server proof; filtered skips are explicit.

RED (retained local output):
 Test Files  1 failed (1)
      Tests  1 failed | 6 skipped (7)
GREEN (retained local output):
 Test Files  1 passed (1)
      Tests  1 passed | 6 skipped (7)

32. Typed shared error owner, real HTTP. Focused actual server proof; typed pure-contract and capability confirmations are additional proof, not vendor cells.

RED (retained local output):
 Test Files  1 failed (1)
      Tests  1 failed | 13 skipped (14)
GREEN (retained local output):
 Test Files  1 passed (1)
      Tests  1 passed | 13 skipped (14)

33. Nine common-body consumer adoptions. Same unfiltered test and eighteen actual source HTTP captures; nine owner assertions close.

RED (retained local output):
 Test Files  1 failed (1)
      Tests  9 failed | 14 passed (23)
GREEN (retained local output):
 Test Files  1 passed (1)
      Tests  23 passed (23)

34. Veo/OpenRouter video body ownership. Seven actual cases in one equivalence test plus five owner checks; journal Host/source and proxy/native controls preserved.

RED (retained local output):
 Test Files  1 failed (1)
      Tests  5 failed | 1 passed (6)
GREEN (retained local output):
 Test Files  1 passed (1)
      Tests  6 passed (6)

35. Fal body ownership. Final typed same-suite counterfactual supplements genuine original pre-edit RED; thirteen actual cases pass in both phases.

RED (retained local output):
 Test Files  1 failed (1)
      Tests  5 failed | 1 passed (6)
GREEN (retained local output):
 Test Files  1 passed (1)
      Tests  6 passed (6)

36. Video wrapper body ownership. Final typed same-suite counterfactual supplements original pre-edit RED; actual journal/body controls preserved.

RED (retained local output):
 Test Files  1 failed (1)
      Tests  2 failed | 1 passed (3)
GREEN (retained local output):
 Test Files  1 passed (1)
      Tests  3 passed (3)

37. Chaos body ownership. Three real cells retain values; two exact owner gaps close. Unwritable behavior uses retained source/existing-suite proof.

RED (retained local output):
 Test Files  1 failed (1)
      Tests  2 failed | 2 passed (4)
GREEN (retained local output):
 Test Files  1 passed (1)
      Tests  4 passed (4)

38. Vector body ownership, final same-input test. Two owner assertions close; five actual/control tests pass before and after. Ten actual matrix cells and existing controls are separately retained.

RED (retained local output):
 Test Files  1 failed (1)
      Tests  2 failed | 5 passed (7)
GREEN (retained local output):
 Test Files  1 passed (1)
      Tests  7 passed (7)

39. Vector test cleanup preserves primary failure. Controlled actual null400 with injected teardown failure: GREEN deliberately still exits1 while preserving the primary failure and awaiting both closes.

RED (retained local output):
RED mounted: real null400; original cleanup replaces primary with teardown error (exit1)
RED standalone: real null400; original cleanup replaces primary with teardown error (exit1)
PASS ensure restored exact original frozen test; production/oracle untouched
GREEN (retained local output):
GREEN mounted: real null400; fixed cleanup retains primary despite teardown error (expected injected-failure exit1)
GREEN standalone: real null400; fixed cleanup retains primary despite teardown error (expected injected-failure exit1)
PASS ensure restored exact original frozen test; production/oracle untouched

40. WS drift routing destinations. Same three actual exported-collector inputs; only builderFile/functions change, all other serialized fields identical. Ordinary usage mappings preserved.

RED (retained local output):
 Test Files  1 failed (1)
      Tests  3 failed | 332 skipped (335)
GREEN (retained local output):
 Test Files  1 passed (1)
      Tests  3 passed | 332 skipped (335)

41. Final registry metadata ownership. Three metadata assertions change RED to GREEN; 260 passing controls include 119 actual HTTP controls. No three-API-cell improvement claim.

RED (retained local output):
 Test Files  1 failed | 2 passed (3)
      Tests  3 failed | 260 passed (263)
GREEN (retained local output):
 Test Files  3 passed (3)
      Tests  263 passed (263)

Observation-completeness sensitivity

Before adding the maintained check, removing either new producer emit call left its real native cohort passing but persisted only fifteen records. On the changed test, the same effective omission is rejected, and restoration passes. These literal changed-test result lines are sensitivity evidence; deliberately faulty mutants are expected failures, not release failures:

ANTHROPIC OMISSION — maintained test correctly rejects:
 Test Files  1 failed (1)
      Tests  1 failed | 36 skipped (37)
MODELS OMISSION — maintained test correctly rejects:
 Test Files  1 failed (1)
      Tests  1 failed | 36 skipped (37)
BYTE-EXACT RESTORED PRODUCERS:
 Test Files  1 passed (1)
      Tests  1 passed | 36 skipped (37)
PASS both identical omission mutants killed; restored17 records;13 previous controls unchanged

Checkpoint validation and remaining holds

Feature-one checkpoint cc37b030ec09db87004114ea382c38150f5e8ba4 passed the full local suite: 399 files, 15,122 passing tests and three disclosed skips. Build/types/exports/API/LSP gates are retained. Its six corpus suites/298 cases are bound to that same full run, with all 178 capture files unchanged; no duplicate runtime is claimed.

Historical feature2 a7cbb835/tree0ab0d3d includes accepted discovery correction.403files/15,340PASS/9skip; API/3types/exports/configuredLSP29PASS. Inferred ES2020 vs actual ES2022 LSP mismatch resolved, no product change.

Observation discovery correction. The ordinary producer uses real createServer/fetch instead of the golden import, preserving native404 and matched/mismatch observations. Intentional filters no longer narrow golden discovery. Scanner/guard/harness/observation gates are unchanged; this accepted one-file leaf is folded.

Own pre-edit RED on signed feature-two parent 293b03635b3f40c68e4bf009549ab9d674c6c0a6; SAME actual two-test command GREEN on signed one-file candidate 1711488dea982a1cb64edb916b27963442cc5df6 (tree 0ab0d3d0cef068033e2c92af35ee05058a20b082). Only output destinations differ:

env -u GOLDEN_WRITE -u GOLDEN_CAPTURE_RUN -u GOLDEN_WRITE_LOG pnpm exec vitest run src/__tests__/capture-golden.test.ts src/__tests__/drift/live-observations.test.ts --maxWorkers=1 --fileParallelism=false --silent=false

RED — before the edit:
 Test Files  1 failed | 1 passed (2)
      Tests  1 failed | 58 passed | 6 skipped (65)
Exit: 1
GREEN — same repro after the edit:
 Test Files  2 passed (2)
      Tests  59 passed | 6 skipped (65)
Exit: 0

All180 capture hashes/files stay unchanged; read-only corpus21files/1,025checks passes. Seven persisted HTTP observations match pre/post except generatedAt; the unchanged oracle is404 / {error:{message:"Not found",type:"not_found"}}. No route change, vendor call, provider-cell improvement or strict-guard relaxation is claimed. Independent zero-mandatory local proof was accepted and folded into passing feature two, without aggregate/final readiness.

Locally accepted test corrections on the third feature checkpoint

CLI envelope correction. Five config/fresh-built CLI checks retain complete policy400 status/body/message and require correlated body request_id and response x-request-id. Requests/precedence/default-off/strict/production/four binary hashes are unchanged. Own RED5db728ab→same real GREENfd53de2a:

pnpm exec vitest run src/__tests__/response-policy-cli.test.ts --maxWorkers=1 --fileParallelism=false --silent=false
RED — before the test correction:
 Test Files  1 failed (1)
      Tests  5 failed | 43 passed (48)
Exit: 1
GREEN — same repro after the correction:
 Test Files  1 passed (1)
      Tests  48 passed (48)
Exit: 0

Five real cases preserve status/body/request headers and add correlation without stripping fields;49 raw-ID controls pass. Test-only local source/probe zero; no serving fix/provider-cell claim. Aggregate qualification separate.

Executable samples. Six policy snippets join the prior nine registry entries without changing the universal guard. Four real cases execute all six via exported API/config/both built CLIs, checking enforce/off/precedence/full errors/ID correlation. Localized imports/ports/fixtures retain displayed policy arguments. Same-parent guard RED→af88c5b4 GREEN:

pnpm exec vitest run src/__tests__/mcp-fakes-doc-samples.test.ts --maxWorkers=1 --no-file-parallelism --silent=false
RED — original seventeen-test suite:
 Test Files  1 failed (1)
      Tests  1 failed | 16 passed (17)
GREEN — preserved old checks plus four added real-surface cases:
 Test Files  1 passed (1)
      Tests  21 passed (21)

One registry/guard defect closed; six snippets exercised, not six failed cells.17→21 adds4 real cases. Production/docs/old registry/guard unchanged; test-only local source/probe zero. Aggregate gate separate.

Two-leaf RED6/59→GREEN69 adds4 docs tests. e8c95301/tree2697471b preserves1,111inputs/180captures/787outputs/JS-CJS-maps/4CLI hashes; declaration/setup faults excluded.68733c72 left idle failure:406filesPASS/1FAIL;15456PASS/1FAIL/9skip. Unchanged case twice/file43; identical full retry407files/15457PASS/9skip. Failed run retained; no causal/timing/concurrency fix. Tree104aaaf7 is historical, not final CI.

Bounded DRY preparation

The scoped DRY sweep classifies44message envelopes/158nonobject error flows/8message-free objects, zero unclassified; all130frozen hashes,33registry rows/import-reference obligations match. Compatibility wrappers forward to owners; native/protocol and raw/data flows retain their obligations. No exact callable-body duplicate touches an owner. This narrow fingerprint is not semantic equivalence or full P0.

Historical tree104aaaf7 DRY: production diff empty vs accepted freeze;130/130 production hashes/33-row registry unchanged. Five whole-tree deltas:2 inherited workflows+3 accepted test fixes. Pre-adoption limitation retained; not aggregate/final P0 proof.

Title-only019091c5→73758c8c retains tree104aaaf7/authorship/tests/runtime; featurescc37b030/a7cbb835/68733c72 unchanged. No final R2 code credit.

Historical full checkpoints: cache399files/15,122PASS/3skip; catalog403/15,340/9; headers407/15,457/9 on disclosed unchanged retry. Guard/observer/collector396PASS/6opt-in skips;3types/build/exports/LSP140PASS. API reports unchanged. Corpus coverage reuses those full-suite logs.

Pre-review packed consumers report zero findings and 3/3 PASS over 823 unchanged emitted files and 530 capture hashes. Nine inherited runtime grants retain their limits. Later isolated proof acceptance is separate from final combined code confirmation and quality.

Recorded review corrections

Tier3 Round1 is fully received: 101 packets across seven roles. Its seven corrections were composed in the immutable review candidate. Round2 retains unchanged valid reviews and identifies four mandatory groups: filesystem identity, retry ordering, required native strings and array coverage.

Messages correction — composed, final confirmation pending. Signed950f265d/two files stores the chosen ID in request/response headers before journaling. Five real controls cover supplied/trimmed/absent/invalid/empty input; native status/body/error/default paths stay unchanged.

The own real public-handler Node HTTP proof precedes production edits and uses the same eight actual inputs/assertions after the change (only the artifact directory relocates):

RED — candidate pre-edit actual HTTP:
 Test Files  1 failed (1)
      Tests  4 failed | 4 passed (8)
Exit: 1
GREEN — same actual candidate repro:
 Test Files  1 passed (1)
      Tests  8 passed (8)
Exit: 0

Actual absent/invalid/empty cases gain correlated body/response/journal IDs; supplied input gains its response header. Minted IDs may differ while native core values and input IDs stay preserved. Four server controls and 237 scoped checks, three types, fresh build/LSP/format/lint/hooks qualify the isolated proof. It is composed in the review candidate; final serving and hosted CI remain separate.

R1 corrections composed in the review candidate

Historical isolated candidates descend from immutable review HEAD; independent HTTP/API/collector/native audits accepted seven evidence packets. Later composition/review/CI are separate.

46. Malformed count text. Actual source-CLI HTTP original16+supplemental10: five malformed500→native400,21controls preserved. Same55-case suite5FAIL/50PASS→55PASS; header49/530capture hashes retained. Numeric/coercible primitives/tool-history formula unchanged; no broad schema claim. Two files; types/build/LSP/hooks qualify the candidate, not final composition.

RED — own actual candidate repro:
 Test Files  1 failed (1)
      Tests  5 failed | 50 passed (55)
GREEN — same actual surface:
 Test Files  1 passed (1)
      Tests  55 passed (55)

47. Historical output-alias candidate. Same frozen collector writes: default/explicit/normalized aliases overwrite/delete critical report;3RED→3GREEN,338PASS/0skip. Reject before either leg/stale cleanup; report bytes conserved. Collector+test only; no vendor/provider-cell claim.

RED — own actual candidate repro:
Actual collector alias preservation: 0 PASS / 3 FAIL
GREEN — same actual surface:
Actual collector alias preservation: 3 PASS / 0 FAIL

48. Historical stale-sidecar candidate. Same control/startup-failure driver creates real prior sidecar; remove it before early failure, retaining primary exit1, ShapeDiff bytes/both invocation receipts. Maintained3RED→3GREEN;336PASS. Alias validation precedes cleanup;2files/no broader hardening/conformance.

RED — own actual candidate repro:
CONTROL exit=0 actual_sidecar_created=true
EARLY_FAILURE exit=1 primary_failure_preserved=true
OBSOLETE_SIDECAR present=true unchanged=true
SHAPEDIFF_REPORT unchanged=true invocation_evidence_count=2
PROOF RED
GREEN — same actual surface:
CONTROL exit=0 actual_sidecar_created=true
EARLY_FAILURE exit=1 primary_failure_preserved=true
OBSOLETE_SIDECAR present=false unchanged=false
SHAPEDIFF_REPORT unchanged=true invocation_evidence_count=2
PROOF GREEN

49. API deletion freshness. Real build/API Extractor removes two stale Jest reports after the same temporary export removal. One-line HEAD operand changes false0→expected1/existing diagnostic. Clean14pass; changed/new reports reject. Package/index/report/dist mutations restore; label/compatibility policy unchanged. One workflow file; hostedCI unmeasured.

RED — own actual candidate repro:
build-deleted-export EXIT=0
generator-deleted-export EXIT=0
workflow-deleted-export EXIT=0
RED: actual workflow falsely passes real generated stale deletions
restore-index-and-reports EXIT=0
PROOF EXIT=1
GREEN — same actual surface:
build-deleted-export EXIT=0
generator-deleted-export EXIT=0
workflow-deleted-export EXIT=1
GREEN: actual workflow rejects real generated stale deletions
restore-index-and-reports EXIT=0
PROOF EXIT=0

The registry correction attributes parsed nonusage differences while preserving raw values. Numeric/coercible primitives and tool-history counts keep their approved contract. Internal wording and legacy own-key retention remain separate debt. Alternate Google count versions and inherited conversion limitations do not expand this implementation scope.

50. Remediation routing. Signed1a0f9eb9/two files: actual collector parses the standing SDK refusal (choices[0].message.refusal, null versus absent) and routes to completion/message owners rather than usage codec. Full input/scenario/provider/count/quarantine/timeout/other fields stay conserved. Own RED→same frozen-selector GREEN:

RED — before the candidate:
 Test Files  1 failed (1)
      Tests  29 failed | 27 passed | 335 skipped (391)
GREEN — identical candidate surface:
 Test Files  1 passed (1)
      Tests  56 passed | 335 skipped (391)

335skips are selection only. Isolated collector535/remediation119/types/hooksPASS; strict-private replay retains56records. Metadata/report value, not provider cells/vendor acquisition. Historical review HEAD; later joint gates separate.

Composed review candidate and current boundary

All seven R1 proofs are accepted and composed at signed 5c64063b106a27e8fcdb81349384d8a6c5d5cdb1, tree 4ead6290b08a73c257286c5e3124c739d3b88b39. Bounded P0 measured 767 tests plus three packed consumers, three types/build/API14/exports/navigation. Collector order retains resolved output paths → collision rejection → stale sidecar cleanup → test legs. These pre-R2 gates do not qualify the later union or establish convergence.

Isolated R1 estimated767 was not combinedPASS; sealed native identity/controls/evidence and joint8-file source/control/types/build/API/exports/output qualification remained separate from hostedCI/convergence.

The routing proof uses a retained historical reporter-format input through the actual exported collector. Original acquisition files are unavailable, so it does not independently authenticate vendor acquisition/current parity. Its other55 cases are generated supplementary controls, not real provider discrepancies; mixed entries may legitimately name functions across files. These limits survive proof acceptance and composition preparation.

51.Native CIed2a02d3/workflow032aea36:test-drift.yml only. Schedule/freshBASE/cacheactivation checked; strict receipts allow only approved default missing-version divergence. Raw reports/observations, enforced warnings and unexpected critical/infra failures retained. Current confirmation below.

Actual original RED precedes the workflow edit, using unchanged producers and frozen authenticated receipts through real local aimock/TLS replay, with zero vendor calls:

phase=red; actual delta exit=1; vendor calls=0; unchanged native producer receipts recorded
RED: actual old workflow activation asymmetry blocks approved default divergence; setup validated

A later frozen job-isolated wrapper restages the ORIGINAL pre-edit packets and only their own HEAD invocation. The exact original workflow is rerun RED; final workflow GREEN uses the SAME four input hashes and wrapper. Actual consumer exits1→0; the verifier wrapper exits0 in BOTH phases because it checks each expected disposition. Its exit0 alone is not delivery GREEN.

RED — actual original consumer exit1; verifier wrapper exit0:
::error::Drift gate BLOCKED: 6 new-in-head failure(s) introduced by this diff: Anthropic native authentication and version type, Anthropic native authentication and version error, Anthropic native authentication and version request_id, Anthropic native authentication and version input_tokens, Anthropic native authentication and version status, Anthropic native authentication and version error.type
RED: same isolated real pre-edit producer packets blocked by exact original workflow
GREEN — actual final consumer exit0; verifier wrapper exit0:
::notice title=intentional native policy::6 validated default-policy keys retained in raw artifacts
Drift gate PASSED: 6 advisory (pre-existing) finding(s) surfaced, none new-in-head.
GREEN: identical real producer packets and frozen wrapper; only actual workflow changed

Six keys are not cells. All24final controls retain intentional raw2/effective0 and blocking unexpected critical/enforced-warning/quarantine/timeout/AG-UI/raw1/5/6. Missing/duplicate/extra-field/wrong-body/status receipts reject. Cache Node/named-step guards run locally; numeric run-ID sensitivity is not authenticated remote-run/cache success. Packets without selected-run ID reject; raw hashes unchanged.

Historical formatter/Bash19/DELTA types/actionlint(no shellcheck/pyflakes)PASS; full SC2086 retained. Hooks keep tested bytes; superseded commits excluded. Processes/listeners/configs/TLS/aliases removed; inert configs archived. Cleanup/YAML/mixed-invocation/cache-loader/heredoc faults nonqualifying. Current AG-UI16assertions, not historical pin. No freshvendor/completepreflight/authenticatedremote-cache/whole-shellfallback/wholeworkflow/pairedCI proof.

PR542/APIlabel present;27commits at43bdb/161881 retain original19prefix/3features and citation20th a0abb. At9a72:P0/audit/177harnessPASS/0skip each20/26;3types81PASS reused(676TS unchanged); historical1f2fourfile388 retained. Public/3consumers/models unchanged;workflow/docs policy changed; generic literals strict. Historical UNIT_PENDING_CI/notCLEAN/noA9GREEN and48FAIL/17,171PASS/220SKIP retained. Historical9a72CI:33SUCCESS/1FAIL/2SKIP; Node20/22/24/26 units each427files/17,430PASS/15SKIP. Drift38655633414 blocked:4passed contexts unavailable, observations absent;4enforced comparisons passed but rawHTTP/nativeidentity/conformance UNVERIFIABLE. 43P0/prepush/8roles0mandatory;CI34SUCCESS/2expectedSKIP. Units427files/17430PASS/15skip each:20/22attempt2,24/26carried1. Attempt1:20cancelled/22failed after same totals+unhandledonTaskUpdateRPC;ONE --failed rerun,same source. No merge.

API manualPASS(base68;148inputs unchanged);labelpresent.43DriftPASS:4native400/strings;29advisory/0block.

Historical unavailableAG-UI outer1/native proof differs from current realAG-UI. Frozen authenticated replay checks local shape/correlation, not freshconformance; vendorIDs differ despite accepted policy shape. Non-native auth drift retained. Unwritablevector:source/existing-suite, not newwire. Deferred [object Object] cleanup diagnostic:both closes awaited, primary rethrown, cleanupfailure stillfails; no leak/falseGREEN observed. No blanket zero findings.

Historical joint:5files/783PASS/0skip;5retained-packet consumer cases pass raw/effective/shell oracles. Shipping holds above.

R2 corrections — accepted isolated evidence, final composition held

All four mandatory groups have accepted isolated evidence. The new proofs below do not establish final combined code acceptance or CI.

52. Count array rejection coverage. Unchanged production already rejects arrays. The old suite survived the exact mutant; new cases kill it and pass against restored production. The old109 totals below are literal reporter JSON fields, not invented stdout. Four actual200/400 witness pairs cover both direct routes and strict modes; ten named failures cover all five inner paths in both modes. This is coverage value, not ten production cells flipped.

pre-edit-clean-http: exit=0
pre-edit-mutant-maintained: exit=0
pre-edit-mutant-http: exit=0
OWN_PRE_EDIT_COVERAGE_RED witnessed; scratch production restored SHA256=ed0c6c030b4c0941ad1be4e8a0d5f4a33614ac0d1b3dd8fdf3869c7bca9c4f66
"numTotalTests":109,"numPassedTests":109,"numFailedTests":0{"cell":"anthropic-message-array","strict":false,"path":"/v1/messages/count_tokens","request":{"messages":[{"role":"user","content":[{"type":"text","text":["abcdefgh"]}]}]},"status":200,"body":"{\"input_tokens\":2}","expected":200,"oracle":{"type":"error","error":{"type":"invalid_request_error","message":"content text must not be an object or array"}},"passed":true}
{"cell":"gemini-message-array","strict":false,"path":"/v1beta/models/gemini-test:countTokens","request":{"contents":[{"parts":[{"text":["abcdefgh"]}]}]},"status":200,"body":"{\"totalTokens\":2}","expected":200,"oracle":{"error":{"code":400,"status":"INVALID_ARGUMENT","message":"content text must not be an object or array"}},"passed":true}
{"cell":"anthropic-message-array","strict":true,"path":"/v1/messages/count_tokens","request":{"messages":[{"role":"user","content":[{"type":"text","text":["abcdefgh"]}]}]},"status":200,"body":"{\"input_tokens\":2}","expected":200,"oracle":{"type":"error","error":{"type":"invalid_request_error","message":"content text must not be an object or array"}},"passed":true}
{"cell":"gemini-message-array","strict":true,"path":"/v1beta/models/gemini-test:countTokens","request":{"contents":[{"parts":[{"text":["abcdefgh"]}]}]},"status":200,"body":"{\"totalTokens\":2}","expected":200,"oracle":{"error":{"code":400,"status":"INVALID_ARGUMENT","message":"content text must not be an object or array"}},"passed":true}
 × src/__tests__/response-count-features.test.ts > count array text rejection (strict=false) > 'anthropic-message-array' is a dialect400 5ms
   → expected 200 to be 400 // Object.is equality
 × src/__tests__/response-count-features.test.ts > count array text rejection (strict=false) > 'anthropic-system-array' is a dialect400 1ms
   → expected 200 to be 400 // Object.is equality
 × src/__tests__/response-count-features.test.ts > count array text rejection (strict=false) > 'anthropic-tool-result-array' is a dialect400 2ms
   → expected 200 to be 400 // Object.is equality
 × src/__tests__/response-count-features.test.ts > count array text rejection (strict=false) > 'gemini-message-array' is a dialect400 2ms
   → expected 200 to be 400 // Object.is equality
 × src/__tests__/response-count-features.test.ts > count array text rejection (strict=false) > 'gemini-system-array' is a dialect400 2ms
   → expected 200 to be 400 // Object.is equality
 × src/__tests__/response-count-features.test.ts > count array text rejection (strict=true) > 'anthropic-message-array' is a dialect400 1ms
   → expected 200 to be 400 // Object.is equality
 × src/__tests__/response-count-features.test.ts > count array text rejection (strict=true) > 'anthropic-system-array' is a dialect400 1ms
   → expected 200 to be 400 // Object.is equality
 × src/__tests__/response-count-features.test.ts > count array text rejection (strict=true) > 'anthropic-tool-result-array' is a dialect400 2ms
   → expected 200 to be 400 // Object.is equality
 × src/__tests__/response-count-features.test.ts > count array text rejection (strict=true) > 'gemini-message-array' is a dialect400 2ms
   → expected 200 to be 400 // Object.is equality
 × src/__tests__/response-count-features.test.ts > count array text rejection (strict=true) > 'gemini-system-array' is a dialect400 2ms
   → expected 200 to be 400 // Object.is equality
 Test Files  1 failed | 1 passed (2)
      Tests  10 failed | 109 passed (119)
 Test Files  2 passed (2)
      Tests  119 passed (119)
{"cell":"anthropic-message-array","strict":false,"path":"/v1/messages/count_tokens","request":{"messages":[{"role":"user","content":[{"type":"text","text":["abcdefgh"]}]}]},"status":400,"body":"{\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"content text must not be an object or array\"}}","expected":400,"oracle":{"type":"error","error":{"type":"invalid_request_error","message":"content text must not be an object or array"}},"passed":true}
{"cell":"gemini-message-array","strict":false,"path":"/v1beta/models/gemini-test:countTokens","request":{"contents":[{"parts":[{"text":["abcdefgh"]}]}]},"status":400,"body":"{\"error\":{\"code\":400,\"message\":\"content text must not be an object or array\",\"status\":\"INVALID_ARGUMENT\"}}","expected":400,"oracle":{"error":{"code":400,"status":"INVALID_ARGUMENT","message":"content text must not be an object or array"}},"passed":true}
{"cell":"anthropic-message-array","strict":true,"path":"/v1/messages/count_tokens","request":{"messages":[{"role":"user","content":[{"type":"text","text":["abcdefgh"]}]}]},"status":400,"body":"{\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"content text must not be an object or array\"}}","expected":400,"oracle":{"type":"error","error":{"type":"invalid_request_error","message":"content text must not be an object or array"}},"passed":true}
{"cell":"gemini-message-array","strict":true,"path":"/v1beta/models/gemini-test:countTokens","request":{"contents":[{"parts":[{"text":["abcdefgh"]}]}]},"status":400,"body":"{\"error\":{\"code\":400,\"message\":\"content text must not be an object or array\",\"status\":\"INVALID_ARGUMENT\"}}","expected":400,"oracle":{"error":{"code":400,"status":"INVALID_ARGUMENT","message":"content text must not be an object or array"}},"passed":true}

53.Physical artifact aliases resolved before cleanup/tests.3frozen real cases:output symlink,parent symlink/startup,absent outputs under parent aliases. One artifact-channel defect,not provider cells. Contiguous result fields omit private argv/cwd without output rewrite; original navigation-retention limits remain.

"control_exit":2,"alias_exit":2,"prior_report_expected":true,"report_exists":true,"report_preserved":false,"after_keys":["schemaVersion","generatedAt","observations"],"alias_rejected":false,"test_legs_started":true,"frozen_input_sha256":"4842f111aff0b004777e47090262c6ed7bff3bc3da31ab05fe87c490c5e30f2a","pass":false}
"control_exit":2,"alias_exit":1,"prior_report_expected":true,"report_exists":false,"report_preserved":false,"after_keys":[],"alias_rejected":false,"test_legs_started":true,"frozen_input_sha256":"3148a4005d0d473bc26189037824abda79262583aca068e7d39f9252e503dfeb","pass":false}
"control_exit":2,"alias_exit":2,"prior_report_expected":false,"report_exists":true,"report_preserved":false,"after_keys":["schemaVersion","generatedAt","observations"],"alias_rejected":false,"test_legs_started":true,"frozen_input_sha256":"2d2d93ec944be356d5c33ad6be3d436755776fcbefe614f26947dceece9c8c44","pass":false}
"control_exit":2,"alias_exit":1,"prior_report_expected":true,"report_exists":true,"report_preserved":true,"after_keys":["timestamp","generatedAt","conclusion","entries","unverifiedSurfaces"],"alias_rejected":true,"test_legs_started":false,"frozen_input_sha256":"4842f111aff0b004777e47090262c6ed7bff3bc3da31ab05fe87c490c5e30f2a","pass":true}
"control_exit":2,"alias_exit":1,"prior_report_expected":true,"report_exists":true,"report_preserved":true,"after_keys":["timestamp","generatedAt","conclusion","entries","unverifiedSurfaces"],"alias_rejected":true,"test_legs_started":false,"frozen_input_sha256":"3148a4005d0d473bc26189037824abda79262583aca068e7d39f9252e503dfeb","pass":true}
"control_exit":2,"alias_exit":1,"prior_report_expected":false,"report_exists":false,"report_preserved":true,"after_keys":[],"alias_rejected":true,"test_legs_started":false,"frozen_input_sha256":"2d2d93ec944be356d5c33ad6be3d436755776fcbefe614f26947dceece9c8c44","pass":true}
Actual filesystem alias preservation: 0 PASS / 3 FAIL
Actual filesystem alias preservation: 3 PASS / 0 FAIL

54. Physical parent alias. Same-basename casefolded parents are compared without listing. Original3GREEN and real0300 nonlisting/distinct-hardlink controls are retained. Maintained1FAIL+2PASS→3PASS; full401/zero skips, three types/fresh navigation/format/lint/signed hooks qualify the leaf. No general basename/race/security claim.

"control_exit":2,"alias_exit":2,"prior_report_expected":true,"report_exists":true,"report_preserved":false,"after_keys":["schemaVersion","generatedAt","observations"],"alias_rejected":false,"test_legs_started":true,"frozen_input_sha256":"e14699eec36105714a579cecc9c89213ca7f3042ac206ab51fe23e98454e86d2","pass":false}
"control_exit":2,"alias_exit":1,"prior_report_expected":true,"report_exists":true,"report_preserved":true,"after_keys":["timestamp","generatedAt","conclusion","entries","unverifiedSurfaces"],"alias_rejected":true,"test_legs_started":false,"frozen_input_sha256":"e14699eec36105714a579cecc9c89213ca7f3042ac206ab51fe23e98454e86d2","pass":true}
Actual filesystem alias preservation: 0 PASS / 1 FAIL
Actual filesystem alias preservation: 1 PASS / 0 FAIL

55. Required native strings. Enforced receipts require message and applicable request-ID strings; differing valid strings retain matched:false. Classifier0 maps invalid fields to effective1/unchanged consumer1. Frozen packets/fresh same-inputHTTP/legitimate positives qualify. No production handler was observed returning null; this is latent consumer validation, not a production-cell flip.

REAL control=null-message; HTTP400 collected; matched=false; authentic enforced comparisons=4 passed; default=failed; AG-UI=0; raw collector=2
red-gate-null-message: classifier=0; raw=2; effective=0; actual scheduled consumer=0
REAL control=null-id; HTTP400 collected; matched=false; authentic enforced comparisons=4 passed; default=failed; AG-UI=0; raw collector=2
red-gate-null-id: classifier=0; raw=2; effective=0; actual scheduled consumer=0
REAL control=different-strings; HTTP400 collected; matched=false; authentic enforced comparisons=4 passed; default=failed; AG-UI=0; raw collector=2
red-gate-different-strings: classifier=0; raw=2; effective=0; actual scheduled consumer=0
RED: actual HTTP null-message and null-ID falsely accepted by unchanged classifier0/effective0 and actual scheduled consumer0; different-string control passes honestly
green-frozen-gate-null-message: classifier=0; raw=2; effective=1; actual scheduled consumer=1
green-live-gate-null-message: classifier=0; raw=2; effective=1; actual scheduled consumer=1
green-frozen-gate-null-id: classifier=0; raw=2; effective=1; actual scheduled consumer=1
green-live-gate-null-id: classifier=0; raw=2; effective=1; actual scheduled consumer=1
green-frozen-gate-different-strings: classifier=0; raw=2; effective=0; actual scheduled consumer=0
green-live-gate-different-strings: classifier=0; raw=2; effective=0; actual scheduled consumer=0
GREEN: same frozen real null packets and repeated identical HTTP controls rejected classifier0/effective1/actual consumer1; different diagnostic and ID strings retain matched:false and consumer0
green-original-legitimate: classifier=0; raw=2; effective=0; actual scheduled consumer=0

56. Native retry. Disposition precedes retry within each actual attempt. Conditional offline C1 replay uses retained authenticated receipts/unchanged producers/currentAG-UI; freshvendor0, no wholeCI/hostedcache/finalpairedCI. Only930b5refrozen calibration qualifies; earlier locale/filter/UTF8setup failures remain excluded. REDwaits45.522/45.521s; unexpected-critical45.351/45.352s. Verifier/collector/consumer exits differ; attempts/requests are not cells/parity.

captured actual invocation 930b5d32-1640-42ac-999b-ca12651f6513 / raw conclusion critical
control-calibrate: actual attempts=1; actual45s backoffs=0; raw2 retained; effective=2; vendor replay requests=5; fresh vendor calls=0
[drift-retry] Critical drift on attempt 1; re-running collector (attempt 2/3) after 45000ms backoff to confirm it is not a transient API hiccup...
[drift-retry] Critical drift on attempt 2; re-running collector (attempt 3/3) after 45000ms backoff to confirm it is not a transient API hiccup...
[drift-retry] Critical drift persisted across all 3 attempts — treating as real drift and alerting.
captured actual invocation 62abc8d1-7f86-4bef-bb78-8518f62c9329 / raw conclusion critical
captured actual invocation 42c80101-4659-49f1-8f5b-1d1e1b5218ec / raw conclusion critical
captured actual invocation 753c591b-c0e4-428a-8ada-2660c176f2c6 / raw conclusion critical
red: actual attempts=3; actual45s backoffs=2; raw2 retained; effective=0; vendor replay requests=15; fresh vendor calls=0
[drift-retry] Collector raw exit 2; strict native effective exit 0.
captured actual invocation 83fd57b6-e5bb-4ac5-ac1b-e8c86f5b4761 / raw conclusion critical
green: actual attempts=1; actual45s backoffs=0; raw2 retained; effective=0; vendor replay requests=5; fresh vendor calls=0
[drift-retry] Collector raw exit 2; strict native effective exit 2.
[drift-retry] Critical drift on attempt 1; re-running collector (attempt 2/3) after 45000ms backoff to confirm it is not a transient API hiccup...
[drift-retry] Collector raw exit 2; strict native effective exit 2.
[drift-retry] Critical drift on attempt 2; re-running collector (attempt 3/3) after 45000ms backoff to confirm it is not a transient API hiccup...
[drift-retry] Collector raw exit 2; strict native effective exit 2.
[drift-retry] Critical drift persisted across all 3 attempts — treating as real drift and alerting.
captured actual invocation 828f74be-6360-4734-a144-e1ab976d07c4 / raw conclusion critical
captured actual invocation 65b38f64-94d2-40a8-9fbe-e6134f65a7d3 / raw conclusion critical
captured actual invocation 38bf8d4f-a37f-4d08-980d-b31a534042ea / raw conclusion critical
unexpected-critical: actual attempts=3; actual45s backoffs=2; raw2 retained; effective=2; vendor replay requests=15; fresh vendor calls=0

Shipping holds above; no merge.

R3 permission-premise correction — accepted evidence, code confirmation held

57. Permission capability. Only the existing test row changes. Own UID0 RED precedes edits; the identical Docker image/argv/environment returns an explicit unsupported-premise SKIP after the fix. SKIP is not permissionPASS;400other name-filtered tests remain excluded. Selected verbatim output lines:

 × src/__tests__/drift-collector.test.ts > collector invocation evidence > retains ordinary distinct artifact destinations: nonlisting 1541ms
      Tests  1 failed | 400 skipped (401)
AssertionError: expected +0 not to be +0 // Object.is equality
 ↓ src/__tests__/drift-collector.test.ts > collector invocation evidence > retains ordinary distinct artifact destinations: nonlisting 1587ms [Nonlisting control requires available non-root UID/EUID APIs]
      Tests  401 skipped (401)
 ✓ src/__tests__/drift-collector.test.ts > collector invocation evidence > retains ordinary distinct artifact destinations: hardlinks 3218ms
      Tests  1 passed | 400 skipped (401)
 ✓ src/__tests__/drift-collector.test.ts > collector invocation evidence > retains ordinary distinct artifact destinations: nonlisting 2337ms
 ✓ src/__tests__/drift-collector.test.ts > collector invocation evidence > retains ordinary distinct artifact destinations: hardlinks 2166ms
 Test Files  1 passed (1)
      Tests  2 passed | 399 skipped (401)
 Test Files  1 passed (1)
      Tests  401 passed (401)

UID0 hardlinks stay active; UID501 retains EACCES/known-name/schema/separate-inode checks, hardlinks and zero-skip401. Linux22/native26 are local, notCI.359f/tree078f keeps tested bytes;fb51 gets no hookcredit, recovered359f normalhooks. Evidence is not source/R4/HEAD/P0/CI acceptance; no futureleafproof was invented.

Description/evidence validation, before → after (same local document check; serving evidence reused):

DOC1 body/response-header correlation: FAIL
DOC2 enforced/observed-production scope: FAIL
Real document/evidence check: FAIL (2 discrepancies)
DOC1 body/response-header correlation: PASS
DOC2 enforced/observed-production scope: PASS
Real document/evidence check: PASS (0 discrepancies)

Accepted leaf-alias evidence — code/CI confirmation held

59. Case-variant leaves. One artifact defect/four existing-absent short/255-byte states, not provider cells. Own4RED preceded edits;4regressionRED preceded production fix. Same frozenCLI/fixture/seed/environment and measured physicalparents:

State Actual RED exit Actual GREEN exit
existing-short 2 1
absent-short 2 1
existing-long 2 1
absent-long 2 1

Actual RED, aliasdiagnostic GREEN and preserved existing-report summary:

Running HTTP API drift tests...
Exiting with code 2 (critical diffs found).
(no drift detail available)
Fatal error: Error: --out and --observations-out must resolve to different paths
*Classification:* real-drift
• *OpenAI Chat* — 1 critical: `fixture` — _fixture mismatch_ (src/helpers.ts)

Regression RED/GREEN/full405 (401filtered exclusions; full zero skips):

 Test Files  1 failed (1)
      Tests  4 failed | 401 skipped (405)
 Test Files  1 passed (1)
      Tests  4 passed | 401 skipped (405)
 Test Files  1 passed (1)
      Tests  405 passed (405)

Actual same-parent UID501 nonlisting values (mode192=0300):

"permission": {
        "uid": 501,
        "euid": 501,
        "mode": 192,
        "listing_error": "EACCES",
        "known_name_read_write_unlink": true
      }

Seeds/absent pairs unchanged; no startup/probe residue.5controls keep collector2/schemas/criticaldetail:ordinary,case-sensitive short/255byte,hardlinks,UID501/0300/EACCES. Absent Slack0:not-found/empty,not detailPASS. Prior source/symlink/parent proofs reused.3types/scopedquality/LSP/hooks/chronology/cleanup qualify bce51/69b/e355 bytes; no wholeCI/newvendor. Current gates above.

  1. LDOC1 RED→GREEN.
LDOC1 exact raw selector: FAIL
Range 118944..119108: selected 165 characters; recorded 166 characters
LDOC1 exact raw selector: PASS
Range 118944..119108: selected 165 characters; recorded 165 characters
  1. UUID random-byte probe, RED1→GREEN2.
Fatal error: Error: Could not acquire a temporary entry to compare artifact case aliases
Exiting with code 2 (critical diffs found).
  1. Symlink entry lookup, RED1→GREEN2.
Fatal error: Error: --out and --observations-out must resolve to different paths
Exiting with code 2 (critical diffs found).

Both real consumers exit0:

*Classification:* real-drift
• *OpenAI Chat* — 1 critical: `fixture` — _fixture mismatch_ (src/helpers.ts)

Same frozen CLI/physical parents; critical schemas. Symlink row: shorter TMPDIR, same volume. UUID row: reporter-only change;405PASS+1capabilitySKIP+separate rowPASS. R4/R5 qualified above; shipping holds remain.

  1. C5 shared-prefix alias: RED2→GREEN1.
    RED main output was overwritten by observations; Slack lost detail:
  Critical diffs: 1
Exiting with code 2 (critical diffs found).
{
  "schemaVersion": 1,
  "generatedAt": "2026-10-14T20:01:44.501Z",
  "observations": []
}
(no drift detail available)

Same held CLI/parent GREEN rejects before collection:

Fatal error: Error: --out and --observations-out must resolve to different paths
  "destinations_remain_absent": true,

Shared non-ASCII prefix/ASCII-case alias; ordinary/case-sensitive schema and critical-detail controls conserved. Offline; Bounded R6/P3 zero; finalquality/pre-push/history/HEAD/CI pending.

64.Required-header snapshots — local confirmation accepted.
Only2 snapshots add correlated response-header IDs; production unchanged. Same real HTTP compare before/after supported2-file native capture:

 Test Files  1 failed (1)
      Tests  2 failed | 192 skipped (194)
 Test Files  1 passed (1)
      Tests  2 passed | 192 skipped (194)

192 are name-filtered, not executed. Preservation248PASS/0skip. No behavior-cell, combined-quality or CI claim.

65.Workflow checkout fixtures — local confirmation accepted.
One test file stages real workflow bytes and expects the observations upload. Same real Ruby/Bash command, existing non-LLM external-command fixtures:

 Test Files  1 failed (1)
      Tests  6 failed | 19 passed (25)
 Test Files  1 passed (1)
      Tests  25 passed (25)

GREEN25PASS/0skip; no production-cell, vendor or whole-CI claim.

  1. Mechanical history repair — not product cells. Git apply RED1:
Applied patch to 'scripts/drift-report-collector.ts' with conflicts.
Applied patch to 'src/__tests__/drift-collector.test.ts' with conflicts.

Own Ruby encoding RED1:

STOP: incompatible character encodings: ASCII-8BIT and UTF-8

Same preserved campaign GREEN0:

ACTUAL HISTORY GREEN19 G feature5-7 8ebfe99c6b0c48eaf38e9ef11be9cc7a4ee0da77 / bab16a5e96f060dd626ddafc83945780657c88cf; empty4b diff; clean; UNIT_PENDING_CI

19 purposes; messages/authors/dates/normal hooks retained,14valid commits preserved. Final CI must pass at the eventual pushed HEAD, including the actual citation commit.

  1. Actual PR citation, docs-only commit20:
Required-header CHANGELOG citation: FAIL
Required-header CHANGELOG citation: PASS

Actual #542; unchanged technical wording/1491other files/original19SHAs. FinalHEADCI pending.

  1. Sentinel local RED exit1: Total: 1 findings (0 critical, 1 high); same-action GREEN exit0: Total: 0 findings (0 critical, 0 high). Real producer→gate: four enforced pass; old-title packet rejected; raw2/effective0.
    Joint3typesPASS; final-HEADCI pending.

  2. Node20, local:

Tests  10 failed | 201 skipped (211)
Tests  10 passed | 201 skipped (211)
Tests  3 failed | 171 skipped (174)
Tests  3 passed | 171 skipped (174)

385PASS/0skip each on Node20/26;201/171 name-filtered. FinalCI pending.

  1. Artifact selection RED1:actual_invocation_metadata_selected=false→same GREEN0:actual_invocation_metadata_selected=true; frozen real JSONs. Selection only, not hosted/native/producer success.

  2. Fixture literal repair, local:

Tests  2 failed (2)
Tests  2 passed (2)
Tests  388 passed (388)
Tests  388 passed (388)

Same realHTTP RED→GREEN; native3wire values unchanged, no serving flip. Finalsource/CI pending.

  1. Repeated native-path selection; same realHTTP:
Tests  2 failed | 1 passed (3)
Tests  3 passed (3)

No serving flip.

  1. Bound contexts:4flips/2controls; same6PASS. Selected JSON (RED/GREEN labels added):
RED
        "availability": "unavailable",
  "observation_exists": false,
GREEN
        "availability": "available",
  "observation_exists": true,

AG-UI unavailable/collector1 both; no fullcollector/vendorGREEN.

  1. Same genuine native-policy gate:
    Four retained HTTP policies:22 new keys qualify;6 prior keys remain. Raw gate output:
::error title=drift-block (new-in-head)::Gemini native authentication status
Drift gate PASSED: 28 advisory (base-present or validated documented policy) finding(s) surfaced, none blocking.

Local1→0;5rawentries/12critical unchanged;13controlsPASS. Not hosted/final43CI.

@pkg-pr-new

pkg-pr-new Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@copilotkit/aimock@542

commit: 43bdb55

@jpr5 jpr5 added the public-api-addition Intended public API report changes reviewed for compatibility; freshness remains required label Oct 14, 2026
@jpr5
jpr5 marked this pull request as ready for review October 15, 2026 00:45
@jpr5

jpr5 commented Oct 15, 2026

Copy link
Copy Markdown
Contributor Author

@tombeckenham Hey Tom, this one is kind of a lot of work, and I'd love someone else to validate it works... can you give it a whirl before I merge/release?

@contextablemark contextablemark left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick P1-focused review: no P1 blockers found. Current-head CI checks are green.

@tylerslaton
tylerslaton merged commit c1ed203 into main Oct 18, 2026
38 of 40 checks passed
@tylerslaton
tylerslaton deleted the blitz/response-consolidation/final-history branch October 18, 2026 02:20
jpr5 added a commit that referenced this pull request Oct 20, 2026
…#551)

## Problem

Unknown `after_id` and `before_id` values returned successful empty
Anthropic model pages. Authentication docs missed the new native
error-body migration details. The CI drift rule also required the old
cursor behavior and rejected the corrected response.

## Why

SDK callers need an error for an invalid cursor. Apps reading the old
string `error.code` need to know that Anthropic omits it and
Gemini/Vertex return numeric `401`. CI must check the new response while
retaining its known missing-request-ID warning and the historical base
comparison.

## Fix

Reject unknown Anthropic cursors with HTTP 400, including with lifecycle
filters. Keep valid paging and empty filtered pages working. Update
README, changelog, provider docs, cursor tests and the drift grading
rule. Header enforcement stays opt-in.

The grading rule requires the exact status, error type, message and
single known warning. It accepts the old empty-page policy only for
cached base evidence. Regression tests mutate receipts, assertions and
diffs to verify the gate still rejects mismatches. A saved actual CI
receipt replay passes with 11 advisories and no blocks; this does not
claim full response-body parity or fresh authenticated calls.

Validation: format, lint, typecheck, all 428 test files (17,456 passed;
11 existing skips), build, package exports, all 14 unchanged API
reports, and actionlint with ShellCheck passed. The earlier free-RAM
test failure passed unchanged. Separate Node/Bun consumers passed 48
cursor checks each plus the original 38 each.

Stacked above #542 using GitHub's native stack #552. The provider
compatibility follow-up is #553, based on this PR. Merge only after
required checks pass, in stack order.
jpr5 added a commit that referenced this pull request Oct 20, 2026
## Problem

The current Ollama SDK could not read `/api/embed` responses, and
recorded batches collapsed to one vector. Recordings also flattened
different input shapes and reused responses across dimensions and
embedding operations. AG-UI convenience helpers replaced caller IDs.
Bedrock examples omitted the HTTP/1 handler required by current AWS SDK
versions.

## Why

SDK clients need the right response shape and request identity. A saved
batch must not answer a different width or operation. Concurrent AG-UI
requests need their own IDs, and Bedrock clients need the transport
aimock supports.

## Fix

- Return Ollama's ordered `embeddings` matrix, preserve distinct vectors
and metadata through record/replay, and honor fallback dimensions. New
Ollama and OpenAI-compatible recordings persist `match.embeddingRequest`
with the operation, original input and requested dimensions, plus the
model. Keep fixture sequence counters separate for those criteria.
Handwritten generic fixtures keep broad matching; re-record older
captures to add the new match keys.
- Build AG-UI text/tool/state/reasoning convenience events per request
with caller thread/run/parent IDs and fresh content IDs. Explicit event
fixtures keep their authored IDs.
- Correct Bedrock setup docs and test Invoke, Converse, and both binary
streams with `NodeHttpHandler`. **Default HTTP/2 remains unsupported.**

Python’s `add_fixture(..., embeddingRequest=...)` routes the field under
`match`, so width, input shape and operation constraints reach the
server. Three public HTTP regressions cover both Ollama operations and
OpenAI; the full Python suite passes 251 tests on Python 3.13.9 with
Node 24.

Matching metadata stays private: predicates and request journals retain
their old request shape. The A7 test checks the exact new saved fields,
then compares all prior fields with its unchanged frozen baseline.

CLI test helpers await child processes so slow commands leave the Vitest
worker free to report results. The controlled 104-test suite reproduces
the reporting timeout before this change and passes under the identical
slowdown afterward. That suite keeps its assertions, test count, child
limits and test deadlines. Two validate CLI checks now distinguish a
success status from `OK` inside a file path; filenames containing `OK`
make that regression deterministic.

Validation on Node 24.21.0: 17,483 tests passed across 430 files, with
11 existing skips. Format, lint, typecheck, build, package exports and
workflow lint passed. All 14 generated API reports match the new
optional fixture field; `public-api-addition` marks that change for
review. The unchanged memory guard passed after freeing RAM.

The added regressions cover successive batch/string/width/model
requests, reverse cache hits, offline reload, both legacy/OpenAI
recording orders, changed widths after another operation's recording,
strict misses and independent fixture sequences. Focused suites passed
776 tests. Independent Node 24.11.0 and Bun 1.4.3 consumers each passed
235 expanded checks and nine review-specific checks, plus 12
transform/privacy checks. These use local fixtures, not fresh
authenticated all-provider calls; counts overlap.

Native stack #552: #542 → #551 → #553. Header enforcement stays opt-in.
Merge after required checks pass, in stack order.
jpr5 added a commit that referenced this pull request Oct 20, 2026
…ive (#556)

## What drifted

The nightly HTTP API drift run has failed on `main` every night since
#542 merged (runs 39103216353, 39209123306, 39379129945: Oct 17, 18 and
19, about 11:15 PM PDT each). The Slack alert lists 12 criticals outside
model-family classification:

- Anthropic native catalog: 6 (`anthropic-after-unknown` /
`anthropic-before-unknown`: real `400` + `type`/`error.type`, mock
`200`)
- Anthropic native authentication and version: 3 (`intentional default
divergence`: real `400`, mock `200`)
- Gemini native authentication: 3 (`inbound policy divergence`: real
`403 PERMISSION_DENIED`, mock `401 UNAUTHENTICATED`)

The Slack text labels the first two groups "PROVIDER ADDED FIELD". That
is the summary picking the first diff issue. The criticals themselves
are `Native response value differs`.

## Root cause: a #542 harness regression, not a provider change

- These 12 diffs are the documented native-policy differences that
#542's native gate (`DELTAGATE` in `test-drift.yml`, `classifyNative`)
checks and retains by name: default missing-version, inbound auth
contracts, and empty pages for unknown cursors. None of them is a new
provider shape. The vendor bodies match the exact values the gate
expects.
- The gate needs `drift-observations.json`. On all three scheduled runs
the collector printed `Live observation evidence unavailable;
observation artifact was not written.`, then `Native disposition
unavailable: ENOENT ... drift-observations.json` and `strict native
effective exit 1`.
- The CI evidence sidecar shows one unbound assertion every night:
`bedrock-misbehavior-live.drift.ts › native AWS misbehavior › invoke K9
stream=true` (passed, `consoleContext.availability: "unavailable"`).
- Cause: that live cell logs a 474,767-byte diagnostic line. `sdkEvents`
is 314,319 bytes because `Uint8Array` chunk bytes serialize as
`{"0":123,"1":34,...}`, and `rawWire` base64 is 123,216 bytes. The
evidence reporter turns any record over 256 KiB into
`console-unavailable`. That taints the test, and since de36209 (#542) a
tainted assertion makes the collector withhold the whole observation
artifact.
- Why it only fails nightly: the live AWS leg runs only on
`refs/heads/main` (`AIMOCK_AWS_MISBEHAVIOR_LIVE`), so #542's PR-scoped
live leg never exercised it. The pre-#542 run (39009028844, Oct 16 11:12
PM PDT) already had the same oversized record, but nothing depended on
it then. That run's only critical was `gemini-4-argon`.

## Fix

`src/__tests__/drift/bounded-diagnostic.ts` serializes the AWS
diagnostic line within the reporter limit:

- SDK byte arrays are written as base64. This is lossless and about 10x
smaller.
- Only if the line still does not fit: the raw wire, and after that the
SDK events, are replaced by `{omitted, byteLength, sha256}`.
- Decoded events and all other fields are kept.

`bedrock-misbehavior-live.drift.ts` uses it on the success and error
paths. The existing local `diagnosticWire: "summary"` path is unchanged.
No response builder changes: the mock's documented policies stay as they
are.

Regression tests in `bounded-diagnostic.test.ts` (unit lane) check each
stage against the reporter's real `MAX_EVIDENCE_RECORD_BYTES`. Mutation
checks: disabling the base64 replacer fails 3 of 5 tests, and always
returning the full line fails 2 of 5.

## Red-green (same command as CI)

The CI `Run drift tests` step runs locally: the `DELTAGATE` script is
extracted from `test-drift.yml` and run with
`NATIVE_DISPOSITION_MODE=scheduled-retry`,
`AIMOCK_NATIVE_PROVIDER_DRIFT=1`, live Anthropic/Google/OpenAI keys, and
the main-branch AWS export block (`AIMOCK_AWS_MISBEHAVIOR_LIVE=1`,
`copilotkit-admin`, `us-west-2`,
`us.anthropic.claude-sonnet-4-5-20250929-v1:0`). Ollama, Vertex, fal,
Cohere and ElevenLabs were not configured locally.

RED, unmodified `main` (c1ed203):

```
Critical diffs: 13
Live observation evidence unavailable; observation artifact was not written.
Exiting with code 2 (critical diffs found).
Native disposition unavailable: Error: ENOENT: no such file or directory, open 'drift-observations.json'
[drift-retry] Collector raw exit 2; strict native effective exit 1.
[drift-retry] Collector exited 1 (not drift) — propagating without retry.
unbound assertion: bedrock-misbehavior-live.drift.ts "invoke K9 stream=true" (passed)
```

Live record sizes for that cell before the fix: line 474,767 B,
`sdkEvents` 314,319 B, `rawWire` 123,216 B.

GREEN, this branch:

```
Critical diffs: 13   (same raw diffs; no observation-unavailable line)
[drift-retry] Collector raw exit 2; strict native effective exit 2.
unbound assertions: 0; drift-observations.json written (36 observations)
```

The remaining effective exit 2 is only the out-of-scope `gemini-4-argon`
family canary (#541). Grading the same reports with only that one entry
removed (`NATIVE_DISPOSITION_MODE=scheduled`, `NATIVE_RAW_EXIT_CODE=2`):

```
GREEN artifacts: {"rawExit":2,"effectiveExit":0,"policy":"validated documented native policy differences"}
RED artifacts:   Native disposition unavailable: ENOENT ... drift-observations.json
                 {"rawExit":2,"effectiveExit":1}
```

So all 12 in-scope criticals are validated as documented native policy
once the artifact exists.

## Notes

- #551 (open) changes Anthropic unknown-cursor behavior to `400` and
updates the gate rule for it. This PR does not touch that policy or the
gate, and does not conflict with it.
- The Oct 17 quarantined OpenAI Live "access unavailable" failure did
not reproduce. There was no quarantine on the Oct 18 or Oct 19 nightly
runs. Locally, `client lifecycle` and `managed lifecycle` passed in the
final RED and GREEN attempts, with one transient `managed lifecycle`
failure that cleared on retry.

## Local gate

`format:check`, `lint`, `typecheck` and `build` pass. `test`: 428/428
files and 17,439 tests pass. Vitest also reported one worker RPC timeout
(`Timeout calling "onTaskUpdate"`) under local machine load, which made
the run exit 1.


## Review round 1: never return an oversized line

A reviewer found a gap. After the raw wire and SDK events were digested,
the last step returned without a size check. A large
`decoded`/`decodedEvents`, `sdkResponse` or `error.message` could still
go over the cap. With empty `sdkEvents` and 3,000 decoded deltas, the
line was 449,172 bytes. The fix (61e941c) now does this:

1. It also digests `decoded`/`decodedEvents` (byte length + SHA-256).
2. If the line still does not fit, it falls back to `{cell, omitted:
[...], byteLength, sha256}` for the full line.

Every candidate goes through `fitsEvidenceRecord`, and the `sdkEvents`
digest keeps its `count`.

RED, head 0dfac24 with the new tests:

```
× digests decoded events when they alone exceed the record limit      → expected false to be true
× digests decodedEvents on the error path the same way                → expected false to be true
× falls back to a minimal line when other fields still exceed the limit → expected false to be true
Tests  3 failed | 5 passed (8)
```

GREEN, 61e941c:

```
✓ src/__tests__/drift/bounded-diagnostic.test.ts (8 tests)
Tests  8 passed (8)
```

`format:check`, `lint` and `typecheck` pass. Drift unit tests
(`src/__tests__/drift/`): 20 files, 245 passed, 6 skipped. The live gate
was not re-run: this change only alters lines that would otherwise
exceed the cap; lines that already fit, including the live GREEN run
above, are returned unchanged.
contextablemark pushed a commit to abhiaiyer91/aimock that referenced this pull request Oct 20, 2026
The live invoke K9 stream=true cell logged a ~475KB diagnostic line:
SDK chunk bytes serialized as index-keyed objects (~314KB) plus the
base64 raw wire (~123KB). The evidence reporter replaces any record over
256KiB with console-unavailable, which leaves that passed assertion
unbound, so the collector withholds drift-observations.json. The native
policy gate added in CopilotKit#542 then cannot validate the documented native
policy differences and the scheduled run fails with strict exit 1.

Write SDK byte arrays as base64 and, only when the line still exceeds the
reporter limit, replace the raw wire and then the SDK events with their
size and SHA-256. Decoded events are always kept.
jpr5 added a commit that referenced this pull request Oct 20, 2026
…nects (#560)

Docs-only fill-in for gaps left by unreleased changes since v1.45.1.
Each gap and its fix:

| Change | Gap | Fix |
| --- | --- | --- |
| #542 required-header policy | README feature list did not mention it |
README feature bullet linking `aimock-cli#required-header-policy`
(scope: `/v1/messages`, `count_tokens`, Anthropic-flavored `/v1/models`)
|
| #542 native catalogs + token counts | README feature list did not
mention them | README feature bullet linking
`claude-messages#model-catalog` |
| #542 Anthropic cache usage | `docs/fixtures` `usage` override row
listed only OpenAI/Anthropic/Gemini token names | Added
`cache_read_input_tokens`, `cache_creation_input_tokens`,
`cache_creation`, linked to a new `#cache-usage` anchor on Claude
Messages |
| #542 routes | `skills/write-fixtures` endpoint table had no
count/catalog routes, and listed `/v1/models` as OpenAI-only | Added
`count_tokens`, `/v1/models/{id}`, Gemini `/v1beta/models[/{model}]`,
plus a note on Anthropic catalog selection (`anthropic-version`, or
`x-api-key` without `Authorization`) |
| #542 cache usage (skill) | Skill override table had no cache fields |
Note under the override table |
| #553 Ollama embed | Skill match table had no `embeddingRequest`; route
table had no `/api/embed` | Added both |
| #557 client disconnect | No user doc said a disconnected Messages
stream journals `interruptReason: "client aborted"` | Paragraph under
Claude Messages "SSE Event Sequence"; bullet in Error Injection
"Interruption Behavior" |
| #545 `streamingProfile` on `stream: false` | Streaming Physics and the
skill described stream timing only, and did not say that `latency` never
delays non-streaming replies | New "Non-Streaming Responses" section on
Streaming Physics (OpenAI Chat Completions only: text, tool calls,
combined content and tool calls, and `blocks` replies, per #545 and
#561; summed per-chunk delays at the same `chunkSize`), a `latency`
bullet saying bare `latency` / `--latency` never delays `stream: false`,
and the same rule in skill gotchas #3/#4. Matches #545 head `054a5ebb` |

Already covered by their own PRs (no change): #551 cursors/auth, #553
AG-UI IDs, Bedrock `NodeHttpHandler`, Ollama page, #531 phase, #533
`resources/read`.

## Checks

- `prettier --check .`: pass
- `pnpm lint`: pass
- `pnpm build` then the doc-sample suites `mcp-fakes-doc-samples`,
`aimock-cli`, `example-fixtures-loadable` and
`unreleased-check-workflow`: 84/84 pass
- I took local Playwright screenshots of the edited sections
(claude-messages, error-injection, fixtures, streaming-physics) at
375x667, 430x932 and 1440x900. The new text renders correctly. The
fixtures override table scrolls sideways at phone width, but main does
the same.
jpr5 added a commit that referenced this pull request Oct 20, 2026
## Problem

#542 (documented in #551) changed the inbound-auth 401 body on Anthropic
and Gemini/Vertex HTTP routes. With `auth.apiKeys` / `AIMOCK_API_KEYS`
configured, a failed key used to return `error.code: "invalid_api_key"`
on every route. On main, Anthropic Messages/count_tokens omit
`error.code`, and Gemini/Vertex return numeric `error.code: 401`.
Clients and tests that read the old string break. aimock releases must
not contain breaking changes, so v1.46.0 cannot ship this.

## Fix

The 1.45 body is the default again on every HTTP route. The
provider-native bodies stay available behind a new, additive policy key:

- `policy.authErrors: "legacy" | "native"`. The default is `"legacy"`.
- You can set it with the programmatic option, `llm.policy`, `--policy
authErrors=native` (both CLIs), or the `X-AIMock-Policy:
authErrors=native` request header. It uses the same parser, precedence
and invalid-entry rules as `requiredHeaders`.

An additive `code` field was not an option. Google's native `error.code`
is the number 401, so a string `"invalid_api_key"` cannot also live
there. Making native bodies opt-in is the smallest change that restores
the old contract and keeps native fidelity.

The drift gate is unchanged. The local auth servers in
`anthropic.drift.ts` and `gemini.drift.ts` now opt into `authErrors:
"native"`, so they emit the same native receipts as before. The
`test-drift.yml` retained-policy rules (`localContract` / `retain`) are
not edited.

## Body comparison (HTTP 401, inbound auth configured, wrong key)

| Route | v1.45.1 | main (2127e9e) | this PR, default | this PR,
`authErrors=native` |
| --- | --- | --- | --- | --- |
| `/v1/messages`, `/v1/messages/count_tokens` | legacy |
`{"type":"error","error":{"type":"authentication_error","message":"Invalid
API key"}}` + `request-id` header | legacy | same as main |
| `/v1beta/*` (generate, countTokens, models, interactions), Vertex
`publishers/google` | legacy | `{"error":{"code":401,"message":"Invalid
API key","status":"UNAUTHENTICATED"}}` | legacy | same as main |
| OpenAI, shared `/v1/models`, Bedrock, others | legacy | legacy |
legacy | legacy |
| WebSocket upgrade | legacy | legacy | legacy | legacy |

legacy = `{"error":{"message":"Invalid API
key","type":"authentication_error","code":"invalid_api_key"}}`. The
response headers on the default path match v1.45.1 exactly:
`WWW-Authenticate`, CORS, `Content-Length: 94`, and no `request-id`.

## Local red-green (real `dist/cli.js`, `AIMOCK_API_KEYS=good-key`,
wrong key)

RED, origin/main 2127e9e:
```
OpenAI chat              401 error.code="invalid_api_key"
Anthropic messages       401 request-id=req_<random> error.code=nil
Anthropic count_tokens   401 request-id=req_<random> error.code=nil
Anthropic models         401 error.code="invalid_api_key"
Gemini generateContent   401 error.code=401
Gemini countTokens       401 error.code=401
Gemini models            401 error.code=401
Vertex generateContent   401 error.code=401
Bedrock invoke           401 error.code="invalid_api_key"
WebSocket upgrade        HTTP/1.1 401 Unauthorized  (legacy body)
```
Baseline, `npm i @copilotkit/[email protected]`: all 10 routes return `401
error.code="invalid_api_key"` with the legacy body.

GREEN, this branch, default:
```
all 10 routes: 401 error.code="invalid_api_key", legacy body
diff vs v1.45.1 capture: DEFAULT == v1.45.1 byte-for-byte (10 routes)
```
GREEN, this branch, `--policy authErrors=native`:
```
diff vs origin/main capture: NATIVE opt-in == origin/main native bodies
```
Per-request header on the real CLI: `X-AIMock-Policy: authErrors=native`
on `/v1beta/models` returns the Google native body. The same request
without the header returns the legacy body.

## Regression tests

- `response-auth-features.test.ts`: new "default inbound auth keeps the
1.45 legacy body" block covers 8 Anthropic/Gemini/Vertex paths × 3
header variants, the per-request header opt-in, and the installed
Anthropic and Gemini SDKs. The existing native block now opts in.
- `response-errors-routes.test.ts`: "actual legacy auth bytes" again
expects the legacy bytes on every route. A sibling test covers native
with the opt-in.
- `golden/auth401`: the six `replaced-*` goldens are restored to their
pre-#542 legacy bytes.
- `response-policy-cli.test.ts`: all 4 built binaries (`cli.js`,
`aimock-cli.js`, and `.cjs`) return legacy by default and native with
`--policy authErrors=native`. Invalid `authErrors` entries exit 1.
- `response-policy-feature.test.ts`: covers authErrors parsing, the
default, and precedence.

Mutation check: I reverted only the default (dialect always
path-selected) and rebuilt. 18 tests failed across the three suites,
then passed again after restoring it.

## Gates

format:check, lint, typecheck, build: pass. `pnpm api:report`: the only
change is the additive `authErrors?: "legacy" | "native"` on
`AimockPolicy`. `AimockPolicy` is new in the unreleased 1.46.0. This
needs the `public-api-addition` label.

Full unit suite: 432 files, 17,580 passed. One failure was a 5 s
CLI-spawn timeout in `misbehavior-loading.test.ts` under full-suite
load. It passed in the first full run and passes 104/104 when run alone.
The offline drift suite (`pnpm test:drift`) passes: 29 files, 564
passed, 131 skipped.

Docs: README, CHANGELOG `[Unreleased]` (the breaking "Changed" entry is
replaced by an additive "Added" entry), plus the auth sections of
`claude-messages`, `gemini` and `aimock-cli`.
jpr5 added a commit that referenced this pull request Oct 20, 2026
## [1.46.0] - 2026-10-20

### Added

- Native Anthropic and Gemini model list/detail routes and token-count routes (#542, #551)
- Opt-in policies: required headers, native auth 401 bodies (`authErrors: "native"`) (#542, #566)
- Opt-in fixture `nonStreamingTiming: true` delays non-streaming OpenAI chat replies (#545, #567)
- Anthropic/Bedrock cache usage kept in replay and record; Responses `phase` override (#531, #542)

### Fixed

- Anthropic stream disconnects, Ollama embed batches, AG-UI IDs, empty MCP reads (#533, #553, #557)
jpr5 added a commit that referenced this pull request Oct 20, 2026
Pre-release compatibility fix for v1.46.0: no default behavior may
change versus v1.45.1.

#542 made `GET /v1/models` return the Anthropic catalog whenever a
request carried `anthropic-version` (every Anthropic SDK request) or an
`x-api-key` without `Authorization`. v1.45.1 returned the OpenAI-format
list for every header set and ignored list query params, so
`client.models.list()` changed shape and Anthropic-header list queries
could newly 400.

**Fix:** new `policy.modelCatalog: "legacy" | "native"`, default
`"legacy"` (byte-identical to v1.45.1). `native` restores the Anthropic
catalog selection on the list route. Set via the programmatic option,
`llm.policy`, `--policy modelCatalog=native`, or the `X-AIMock-Policy`
header (same parser and precedence as `authErrors` from #566). The new
`/v1/models/{id}` and Gemini `/v1beta/models` routes are unchanged.

| `GET /v1/models` headers | v1.45.1 | main | this PR (default) | this
PR (native) |
|---|---|---|---|---|
| x-api-key | OpenAI | Anthropic | OpenAI | Anthropic |
| x-api-key + anthropic-version | OpenAI | Anthropic | OpenAI |
Anthropic |
| Bearer | OpenAI | OpenAI | OpenAI | OpenAI |
| none | OpenAI | OpenAI | OpenAI | OpenAI |
| anthropic-version only | OpenAI | Anthropic | OpenAI | Anthropic |
| Anthropic headers + `?limit=0&after_id=missing` | 200 OpenAI | 400 |
200 OpenAI | 400 |

**Red-green:** a header-matrix test runs against all four built CLI
binaries. Golden snapshots are restored to the pre-#542 bytes, plus
native-opt-in goldens. 8 tests fail with the fix reverted.

**Drift:** `models.drift.ts` local servers opt into `modelCatalog:
"native"`, so receipts are unchanged and `test-drift.yml` is untouched.

**Public API:** additive `modelCatalog?` on `AimockPolicy`.
jpr5 added a commit that referenced this pull request Oct 20, 2026
## [1.46.0] - 2026-10-20

### Added

- Gemini model list/detail, Anthropic model detail, and token-count routes (#542, #551)
- Opt-in policies: `requiredHeaders`, native `authErrors`, native `modelCatalog` (#542, #566, #568)
- Opt-in fixture `nonStreamingTiming: true` delays non-streaming OpenAI chat replies (#545, #567)
- Anthropic/Bedrock cache usage kept in replay and record; Responses `phase` override (#531, #542)

### Fixed

- Ollama embed batches, AG-UI thread/run IDs, empty MCP reads, Anthropic aborts (#533, #553, #557)
jpr5 added a commit that referenced this pull request Oct 21, 2026
Website check before v1.46.0 ships. One gap found: the **Fixture
Options** reference table on `/fixtures` did not list the new
`nonStreamingTiming` fixture field (#545, #561, #567). This PR adds that
row. It states the `false` default and links to
`/streaming-physics#non-streaming`.

The rest of the site needed no change:
- The homepage feature cards and comparison matrix make no per-endpoint
claims that 1.46.0 changes. The matrix has no models-endpoint row on
purpose (`isRowlessRule` in `scripts/update-competitive-matrix.ts`), and
no row compares token counting.
- #542, #551, #553, #560, #566, #567 and #568 already updated the auth,
model-catalog, token-count, cache-usage, Ollama, AG-UI and
streaming-physics pages. Their default statements match the shipped
defaults.
- Every new section is reachable from the per-page "On this page" TOC.
- #562 bumps the homepage version banner. This PR does not touch it.

Checks: `prettier --check`, `eslint .`, `tsdown` build, and the
docs-clean-urls, docs-matrix-legend and mcp-fakes-doc-samples tests
(188/188) all pass. I captured local Playwright screenshots of the
edited table at 375x667, 430x932 and 1440x900, and the row renders
correctly at all three. At narrow widths, the `/fixtures` page is wider
than the viewport. The page on main is the same width, so this PR did
not cause it.
jpr5 added a commit that referenced this pull request Oct 21, 2026
Refreshes the docs overview "What's New" cards for the last month of
work, and adds three verified rows to the comparison matrix (homepage
and the four scanned migration pages).

## What's New (`docs/docs/index.html`)

The cards were last updated in May. The 5 old cards are replaced with 8
cards (two full rows of the 4-column grid). They cover CHANGELOG 1.43.0
(2026-09-22) through `[Unreleased]` (1.46.0, #562):

| Card | Covers | Links to |
| --- | --- | --- |
| Model Catalogs & Token Counts | Native Anthropic/Gemini model list and
detail routes. The Anthropic list on shared `/v1/models` is opt-in
(`modelCatalog`). Anthropic `count_tokens` and Gemini `countTokens`
estimates (#542, #551, #568) | `/claude-messages#model-catalog` |
| Native Auth Errors | Opt-in provider-native 401 bodies (`authErrors`)
and the opt-in required-header policy (`requiredHeaders`) (#542, #566) |
`/claude-messages#authentication-errors` |
| Model Misbehavior | Opt-in misbehavior faults (#508, #518) |
`/model-misbehavior` |
| MCP Record & Replay | MCP recording/replay, scenario-scoped tool
fakes, per-test fake reports (#490, #509, #517) |
`/mcp-mock#recorded-fakes` |
| Stream Realism | Anthropic streams stop and journal on client
disconnect (#557). Opt-in `nonStreamingTiming` for OpenAI non-streaming
replies (#545, #561, #567) | `/streaming-physics#non-streaming` |
| Responses API Tools | Opt-in (`responsesTools: "extended"`) namespaced
and custom tool calls, plus message phases (#511, #513, #531) |
`/responses-api#namespaced-and-custom-tool-calls` |
| OpenAI Platform APIs | Files, Batches, Fine-tuning jobs, Vector Stores
(#445, #446, #447, #497) | `/vector-stores` |
| GPT-Live Sessions | GPT-Live mock, record and replay (#468) |
`/websocket#openai-live` |

The Model Catalogs & Token Counts, Native Auth Errors and Stream Realism
cards carry a "New in 1.46.0" label, and the Responses API Tools card
marks its message phases "(new in 1.46.0)". Every opt-in is called out
on its card: `requiredHeaders`, `authErrors`, `modelCatalog` (the
Anthropic shared list), `nonStreamingTiming`, misbehavior and extended
Responses tools. The version banner is not touched.

## Comparison matrix

### New rows

Homepage (`docs/index.html`), inserted before "Dependencies":

| Row | aimock | MSW | VidaiMock | mock-llm | piyook/llm-mock |
mokksy/ai-mocks | MockServer | WireMock |
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
| Native model catalogs (Anthropic, Gemini) | Built-in ✓ | ✗ | OpenAI
format only | OpenAI format only | ✗ | ✗ | ✗ | ND |
| Token-count endpoints | Built-in ✓ | ✗ | Gemini only (fixed count) | ✗
| ✗ | ✗ | ✗ | ND |
| Native 401 auth errors | Opt-in ✓ | manual | ✓ | manual | partial |
manual | partial | manual |

The migration pages for VidaiMock, mock-llm, piyook and Mokksy get the
same three rows, in each page's own style: VidaiMock uses text cells,
and the other three use the ✓/✗ glyphs with text for partial or manual
values. No new legend marks are needed. The MSW, Python-mocks and
openai-responses pages have different columns, so they are unchanged.

Every aimock ✓ cell on the three new rows carries a muted "1.46.0+"
label, on the homepage and on the four migration pages. The label uses a
`.version-note` class in the muted style of the existing "Requires
1.45.0+" table note.

### Rows considered and not added

- Already on the matrix: record & replay, drift detection, MCP / A2A /
AG-UI, streaming physics, chaos testing, model misbehavior, provider
count.
- Client-disconnect handling: dropped. Most competitors' source and docs
say nothing about it, so the row would be mostly ND. A server that drops
a closed stream is normal framework behavior, not something a
competitor's docs state.
- Recorded timing replay: dropped. I could not verify the MockServer and
WireMock cells from their docs, and Streaming physics already covers
timing.

### Per-cell evidence (checked 2026-10-20)

Competitor sources are the repos listed in
`scripts/update-competitive-matrix.ts`, at the default-branch HEAD on
that date: VidaiMock `e61b8ba`, mock-llm `aeb04d6`, piyook/llm-mock
`9e7a3ce`, mokksy/ai-mocks `fc70777`, MockServer `c892f58`. The homepage
table has an HTML comment on each new row with a short evidence note.

**Native model catalogs**
- aimock: Gemini `GET /v1beta/models` list and detail are native by
default. Anthropic `/v1/models/{id}` detail is native by default. The
Anthropic list on shared `/v1/models` needs `modelCatalog: "native"`.
See `/claude-messages#model-catalog` and `/gemini#model-catalog`.
- MSW: has no LLM endpoints. It is marked ✗, the same as the Embeddings
and Image rows.
- VidaiMock: `src/server.rs` registers `GET /v1/models`,
`/v1beta/models` and `/v1beta/openai/models` on `models_handler`. (Its
Anthropic `GET /v1/models/{model_action}` route is never registered,
because the Gemini `POST /v1/models/{model_action}` route claims the
path first.) In `src/handlers.rs`, `models_handler` always returns the
OpenAI list shape:
`{"object":"list","data":[{"id","object":"model","created","owned_by":"vidai"}]}`.
So its Gemini catalog route is not in native format, and there is no
Anthropic catalog.
- mock-llm: the README's default config ships one OpenAI-format
`/v1/models` rule (`{"object":"list","data":[{"id":"gpt-5.2",...}]}`).
There is no Anthropic or Gemini catalog.
- piyook/llm-mock: the README's "Available endpoints" lists only chat
completions, `/v1/messages` and `/v1/embeddings`. `src/api/` has only
`completions` and `embeddings`.
- mokksy/ai-mocks: `MockAnthropic` exposes only `messages()` (`POST
/v1/messages`), and `MockGemini` exposes only `generateContent` and
`generateContentStream`. The repo has no models route (code search for
`v1/models` finds nothing).
- MockServer: the `httpLlmResponse` supported-provider path table
(mock-server.com `llm_response_mocking.html`) has no models route.
`docs/code/llm-mocking.md` names `GET /v1/models` only as proxied
traffic that gets no telemetry.
- WireMock: has no LLM-specific docs (`wiremock.org/docs/solutions/ai/`
is about using AI to write stubs). It is ND, the same as WireMock's
other LLM-endpoint cells.

**Token-count endpoints**
- aimock: Anthropic `POST /v1/messages/count_tokens` and Gemini
`:countTokens` estimate tokens from the translated request. See
`/claude-messages#token-counts` and `/gemini#token-counts`.
- VidaiMock: `config/providers/gemini_count_tokens.yaml` matches
`^/v1(beta)?/models/[^:]+:countTokens$`. Its template
`config/templates/gemini/count_tokens.json.j2` always returns
`"totalTokens": 9`. There is no Anthropic `count_tokens` provider
config.
- mock-llm and mokksy/ai-mocks: GitHub code search for `count_tokens`
(mock-llm) and `countTokens` (mokksy) finds nothing. Neither README or
API has a count route.
- piyook/llm-mock: `src/api/` has only `completions` and `embeddings`,
and the endpoint list has no count route.
- MockServer: `docs/code/llm-mocking.md` names Anthropic
`/v1/messages/count_tokens` only as unaccounted proxied traffic. There
is no `httpLlmResponse` for it.
- MSW ✗ and WireMock ND, for the same reasons as the catalog row.

**Native 401 auth errors**
- aimock: opt-in `policy.authErrors: "native"` returns Anthropic
`authentication_error` and Gemini `UNAUTHENTICATED` bodies. See
`/claude-messages#authentication-errors` and
`/gemini#authentication-errors`.
- VidaiMock ✓: the README lists `X-Mock-Status` and `?chaos_status=`
overrides that return "real provider error envelopes".
`config/templates/anthropic/error.json.j2` maps 401 to
`authentication_error`. `config/templates/gemini/error.json.j2` maps 401
to `UNAUTHENTICATED`.
- piyook/llm-mock partial: chaos `status` accepts any status from 400 to
599. `src/utilities/chaos.ts` types every status except 429/529 (Claude)
or 429/503 (Gemini) as `api_error` or `INTERNAL`. So a 401 is not typed
`authentication_error` or `UNAUTHENTICATED`. The README also says
"LLMock has no authentication".
- mock-llm manual: the README example is a hand-written rule that
returns an OpenAI `invalid_api_key` 401.
- mokksy/ai-mocks manual: `AbstractBuildingStep.respondsError` lets you
set any status and body.
- MockServer partial: the LLM chaos `errorStatus` accepts 401. With no
`errorKind`, `LlmErrorBodies.kindForStatus`
(`mockserver-core/src/main/java/org/mockserver/llm/LlmErrorBodies.java`)
maps every status except 429 and 529 to `SERVER_ERROR`. So a 401 gets
the provider envelope typed `api_error` or `INTERNAL`, not
`authentication_error` or `UNAUTHENTICATED`. This is the same behavior
as piyook.
- MSW and WireMock manual: both are generic HTTP stubs with any status
and body.

### Weekly scanner compatibility

No `FEATURE_RULES` entry or migration variant names the new rows, so the
Monday scan never reads or writes them. The `GET /v1/models` rule stays
row-less. Its keyword (`/v1/models`) would match any OpenAI models
endpoint, which is not what the catalog row compares.

A new test, `hand-reviewed homepage rows with no scan rule` in
`competitive-matrix-homepage.test.ts`, checks four things:
- every new label is on the homepage;
- no rule or migration variant names a new label;
- when every competitor matches every rule, the homepage keeps every
new-row cell;
- when every rule matches, each scanned migration page keeps its new
rows.

I mutation-tested it: adding `"Token-count endpoints"` as a migration
variant fails 4 of its tests.

`docs-matrix-legend.test.ts`: the homepage ND count goes from 45 to 47,
because of the two WireMock ND cells.

Dry run (`npx tsx scripts/update-competitive-matrix.ts --dry-run`, with
a GitHub token), before and after the change:

```
before: Parsed 41 capability rows, 8 competitor columns.
after:  Parsed 44 capability rows, 8 competitor columns.
both:   No homepage matrix changes detected.
        1 migration page row(s) to check by hand: mock-llm / Azure OpenAI (combined-row)   [pre-existing]
        12 row-less detection(s) to check by hand                                        [identical list]
```

The only difference is the row count. No change is proposed to the new
rows or anywhere else.

## Checks

- `prettier --check .`, `eslint .` and `tsdown` build: pass.
- The docs and competitive-matrix tests (`docs-*`,
`competitive-matrix*`, `mcp-fakes-doc-samples`): 13 files, 530 tests,
all pass.
- Full `vitest run`: 17610 passed. One test failed: a timing assertion
in `chaos-fal-single-roll.test.ts`. That file only measures chaos
latency, and this PR does not change it. It passes when run alone (4/4).
- Local Playwright CLI screenshots, at 375x667, 430x932 and 1440x900:
  - What's New, on this branch and on main.
  - The homepage matrix, on this branch and on main.
  - The four edited migration pages.
- On phones, the homepage matrix scrolls sideways inside its wrapper, as
it does on main. The new rows add no width.
- What's New now fills two full grid rows. On main, the fifth card sat
alone in a second row.
- The "On this page" panel overlaps the quick-start card at 1440 wide.
Main does the same.
jpr5 added a commit that referenced this pull request Oct 21, 2026
> **DO NOT MERGE until Jordan says ship — merging publishes to npm.**
>
> `publish-release.yml` runs on every push to `main`. Merging this PR
publishes npm
> `@copilotkit/[email protected]`, the `v1.46.0` tag, the `v1` major-tag
move, the GitHub Release,
> the Docker images and the Slack announcement.

Minor release npm/plugin **1.46.0** from `main` at 02c72c8 (#568
merged). Rebuilt on top of
#563–#568. aimock-pytest keeps its own version (`pyproject.toml`
unchanged); only its default
aimock pin moves to 1.46.0, because this release adds server routes the
pytest client can call.

Every new behavior is additive or opt-in. The CHANGELOG has no `Changed`
section. Defaults match
v1.45.1: inbound-auth 401 bodies stay legacy (#566), non-streaming
replies stay instant (#567), and
shared `GET /v1/models` returns the OpenAI-format list for every header
set (#568). The only
default output changes are the bug fixes under Fixed.

## CHANGELOG

## [1.46.0] - 2026-10-20

### Added

- Gemini model list/detail, Anthropic model detail, and token-count
routes (#542, #551)
- Opt-in policies: `requiredHeaders`, native `authErrors`, native
`modelCatalog` (#542, #566, #568)
- Opt-in fixture `nonStreamingTiming: true` delays non-streaming OpenAI
chat replies (#545, #567)
- Anthropic/Bedrock cache usage kept in replay and record; Responses
`phase` override (#531, #542)

### Fixed

- Ollama embed batches, AG-UI thread/run IDs, empty MCP reads, Anthropic
aborts (#533, #553, #557)

## What the bullets cover

The `[Unreleased]` section had 16 entries, grouped into the 5
Slack-bound bullets above:

- **Model routes (#542, #551):** Gemini `GET /v1beta/models` list/detail
and the new
`GET /v1/models/{id}` detail route, with provider paging and synthetic
metadata;
`count_tokens` / `:countTokens` estimates that never proxy or record.
Anthropic
`after_id`/`before_id` cursor validation applies only to the opt-in
Anthropic list.
- **Opt-in policies (#542, #566, #568):** all are off by default. Set
them with the `policy`
  option, `llm.policy`, `--policy`, or the `X-AIMock-Policy` header.
- `requiredHeaders: "enforce"` rejects Anthropic requests without
`anthropic-version`.
- `authErrors: "native"` returns provider-native 401 bodies on Anthropic
Messages/count and
Gemini/Vertex HTTP paths. The default `"legacy"` keeps `error.code:
"invalid_api_key"`.
- `modelCatalog: "native"` returns the Anthropic-format paged list on
shared `GET /v1/models`
for `anthropic-version` or `x-api-key`-only requests. The default
`"legacy"` returns the
1.45 OpenAI-format list for every request. Anthropic SDK `models.list()`
users must opt in.
- **Opt-in non-streaming timing (#545, #561, #567):** OpenAI chat
completions with `stream: false`
only. A fixture with `nonStreamingTiming: true` plus a
`streamingProfile` or `recordedTimings`
delays the JSON reply by about its streamed duration (text, tool-call,
combined content+tool-call
and `blocks`). Without the field, `stream: false` replies return
immediately, as in 1.45.1.
- **Cache usage, phase (#531, #542):** Anthropic Messages and Bedrock
Claude preserve fixture cache
usage (with the TTL breakdown) in replay and record; Responses `phase`
override
  (`commentary` | `final_answer`) on HTTP, SSE and WebSocket.
- **Fixes (#533, #553, #557):** these are the only default output
changes. Each one corrects
  output that real clients mishandled before.
- Ollama `/api/embed` returns `embeddings: [[...]]` with one vector per
input, and its errors are
plain strings. Recorded embedding fixtures get optional
`match.embeddingRequest` criteria.
    `/api/embeddings` keeps its legacy single-vector response.
- AG-UI convenience builders echo the request's thread/run IDs and mint
fresh message/tool-call
    IDs. Explicit event fixtures keep their authored IDs.
- MCP `resources/read` for a resource with no content returns `"text":
""` and falls back to the
    definition's `mimeType`, so the response passes the MCP schema.
- Anthropic Messages streaming stops on client disconnect. The journal
records
    `interrupted: true` / `interruptReason: "client aborted"`.

Left out of the bullets: the Bedrock SDK `NodeHttpHandler` example fix
(#553, docs only).

Not in the CHANGELOG: drift-sync, drift diagnostics, competitor-scan,
adoption-wall, dependency and
docs PRs (#532, #534, #535, #536, #541, #543, #546, #554, #555, #556,
#558, #559, #560, #563, #564,
#565). They do not change the published package.

## Versions

| Surface | Before | After |
|---|---|---|
| `package.json` `version` | 1.45.1 | 1.46.0 |
| `.claude-plugin/plugin.json` `version` | 1.45.1 | 1.46.0 |
| `.claude-plugin/marketplace.json` `plugins[0].source.version` |
^1.45.1 | ^1.46.0 |
| `charts/aimock/Chart.yaml` `appVersion` (chart `version` unchanged) |
1.45.1 | 1.46.0 |
| `docs/index.html` CLI banner | aimock v1.45.1 | aimock v1.46.0 |
| `packages/aimock-pytest/src/aimock_pytest/_version.py`
`AIMOCK_VERSION` | 1.45.1 | 1.46.0 |
| `packages/aimock-pytest/README.md` `--aimock-version` default | 1.45.1
| 1.46.0 |

Left at 1.45.1 on purpose: CHANGELOG history;
`src/__tests__/package-types-compat.test.ts`, which
compiles a consumer against the published 1.45.1 types; and the
`server.test.ts` comment that names
the 1.45.1 default timing. `packages/aimock-pytest/pyproject.toml` keeps
its own version.

`CHANGELOG.md`: `[Unreleased]` became `[1.46.0] - 2026-10-20` with an
empty `[Unreleased]` kept
above it, as in prior releases.

`package.json` `description` matches the README subtitle exactly
(`publish-release.yml` re-syncs it
on merge anyway).

## Local gates

Run on the release commit tree (origin/main 02c72c8 + this commit):

- `pnpm install --frozen-lockfile`: pass
- `pnpm format:check`: pass
- `pnpm lint`: pass
- `pnpm typecheck`: pass
- `pnpm build`: pass
- `pnpm test`: pass (432 files; 17605 passed, 11 skipped), including
`npm-publish-verify-workflow`,
`unreleased-check-workflow`, `release-workflows`,
`publish-pin-workflow`, `version` and
  `package-types-compat`
- `pnpm test:exports` (publint + attw): pass
- `pnpm api:report`: pass, 14 entries, `etc/` unchanged
- `commitlint` on the release commit: pass
- `unreleased-check.yml`: no `v1.46.0` tag exists, so the release push
skips the check (by design)
AmaoLearning pushed a commit to AmaoLearning/aimock that referenced this pull request Oct 21, 2026
CopilotKit#542 made the shared GET /v1/models list return the Anthropic catalog
when a request sends anthropic-version, or x-api-key without
Authorization. v1.45.1 returned the OpenAI list for every header set and
ignored list query parameters. Anthropic SDK clients, and any client that
authenticates with x-api-key alone, got a different body shape, and
Anthropic cursor/limit validation could return 400.

The list route now returns the 1.45 OpenAI list by default. The Anthropic
list is opt-in with the new policy key modelCatalog=legacy|native
(programmatic policy, llm.policy, --policy on both CLIs, or the
X-AIMock-Policy header), with the same parser and precedence as
authErrors. The new GET /v1/models/{id} detail route and the Gemini
catalog routes keep their request-based selection.

The legacy anthropic-signal-* goldens return to their pre-CopilotKit#542 bytes, and
anthropic-native-* goldens keep the opted-in bytes. The models drift
servers opt in to native, so the drift receipts do not change.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

public-api-addition Intended public API report changes reviewed for compatibility; freshness remains required

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants