Skip to content

fix(provider): normalize cached Chat Completions usage - #1312

Merged
TheGreatAxios merged 1 commit into
mainfrom
cl-7328-normalize-openai-chat-completions-tokenusage-to-exclusive
Oct 3, 2026
Merged

TheGreatAxios merged 1 commit into
mainfrom
cl-7328-normalize-openai-chat-completions-tokenusage-to-exclusive

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Collaborator

Summary

  • Normalize Chat Completions input to the uncached remainder in the shared vendored conversion, preserving cache/output/reasoning counters and vendor patch provenance.
  • Count cached prompt tokens once in occupancy and prevent false post-fold nonconvergence; mark normalized Chat Completions telemetry exclusive to preserve PostHog cost accounting.
  • Isolate the scope-guard test from the subject working tree so legitimate vendor patches can run the full gate without changing the guard itself.

Verification

  • bun run check passes: 8,190 tests, zero failures.
  • Adapter, post-fold governor, telemetry, and scope-guard regressions pass: 91 focused tests.
  • Independent review and follow-up review report no remaining findings. No upstream Interchange changes or live custom-vLLM probes.

Fixes CL-7328

@linear-code

linear-code Bot commented Oct 3, 2026

Copy link
Copy Markdown

CL-7328

@TheGreatAxios TheGreatAxios left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Independent review covers the shared usage normalization, vendor ledger, adapter/post-fold tests, telemetry boundary, and scope-test fixture. The original PostHog cost regression is resolved by an allowlisted exclusive-reporting flag for the normalized Chat Completions adapters; other adapter flags remain unchanged. The scope test uses a temporary repo without weakening its guard. Final review has no remaining actionable findings. Full bun run check passes (8,190 tests), plus 91 focused checks. No upstream Interchange modifications or live custom-vLLM requests.

@TheGreatAxios
TheGreatAxios merged commit e3c90f1 into main Oct 3, 2026
24 of 25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant