Repository navigation
feat(providers): correlate X-CPA-TRACE-ID auth_index with usage history - #14544
Merged
diegosouzapw merged 4 commits intoSep 22, 2026
Merged
diegosouzapw merged 4 commits into
diegosouzapw merged 4 commits into
Conversation
Persist the opaque auth_index on usage_history and resolve the sanitized account-health label when history is read (#11725).
# Conflicts: # AGENTS.md # README.md # docs/i18n/am/llm.txt # docs/i18n/ar/llm.txt # docs/i18n/az/llm.txt # docs/i18n/bg/llm.txt # docs/i18n/bn/llm.txt # docs/i18n/bs/llm.txt # docs/i18n/cs/llm.txt # docs/i18n/da/llm.txt # docs/i18n/de/llm.txt # docs/i18n/el/llm.txt # docs/i18n/es/llm.txt # docs/i18n/et/llm.txt # docs/i18n/fa/llm.txt # docs/i18n/fi/llm.txt # docs/i18n/fr/llm.txt # docs/i18n/ga/llm.txt # docs/i18n/gu/llm.txt # docs/i18n/ha/llm.txt # docs/i18n/he/llm.txt # docs/i18n/hi/llm.txt # docs/i18n/hr/llm.txt # docs/i18n/hu/llm.txt # docs/i18n/hy/llm.txt # docs/i18n/id/llm.txt # docs/i18n/ig/llm.txt # docs/i18n/it/llm.txt # docs/i18n/ja/llm.txt # docs/i18n/ka/llm.txt # docs/i18n/km/llm.txt # docs/i18n/kn/llm.txt # docs/i18n/ko/llm.txt # docs/i18n/lt/llm.txt # docs/i18n/lv/llm.txt # docs/i18n/ml/llm.txt # docs/i18n/mr/llm.txt # docs/i18n/ms/llm.txt # docs/i18n/mt/llm.txt # docs/i18n/my/llm.txt # docs/i18n/ne/llm.txt # docs/i18n/nl/llm.txt # docs/i18n/no/llm.txt # docs/i18n/or/llm.txt # docs/i18n/pa/llm.txt # docs/i18n/phi/llm.txt # docs/i18n/pl/llm.txt # docs/i18n/pt-BR/llm.txt # docs/i18n/pt/llm.txt # docs/i18n/ro/llm.txt # docs/i18n/ru/llm.txt # docs/i18n/si/llm.txt # docs/i18n/sk/llm.txt # docs/i18n/sl/llm.txt # docs/i18n/sr/llm.txt # docs/i18n/sv/llm.txt # docs/i18n/sw/llm.txt # docs/i18n/ta/llm.txt # docs/i18n/te/llm.txt # docs/i18n/th/llm.txt # docs/i18n/tr/llm.txt # docs/i18n/uk-UA/llm.txt # docs/i18n/ur/llm.txt # docs/i18n/uz/llm.txt # docs/i18n/vi/llm.txt # docs/i18n/yo/llm.txt # docs/i18n/zh-CN/llm.txt # docs/i18n/zh-TW/llm.txt # llm.txt
# Conflicts: # config/quality/file-size-baseline.json
diegosouzapw
merged commit Sep 22, 2026
d7be9fd
into
cheaper-inference:release/v3.8.51
9 of 16 checks passed
5 tasks done
diegosouzapw
added a commit
that referenced
this pull request
Sep 23, 2026
…n from #14544) (#14599) Hoists `let providerResponse` out of handleChatCore's prettier-ignore try block so persistFailureUsage (declared before that try) can read it. #14544 had made every upstream failure throw ReferenceError: providerResponse is not defined out of handleChatCore. Net-zero lines. Adds an end-to-end regression test (red on the tip, green here) and restores 2 failing tests in chatcore-codex-account-pool and 17 in chatcore-translation-paths. check:open-sse-typecheck no longer reports the chatCore.ts TS2304. Refs #14544
5 tasks done
josuerf
pushed a commit
to josuerf/OmniRoute
that referenced
this pull request
Sep 23, 2026
`CLAUDEPROXY`-style env reads are `string | undefined`, so `options.host ?? externalHost` cannot satisfy the `host: string` the ready state declares and `typecheck:core` fails. Falls back to the same loopback address the embedded branch a few lines above already uses. Inherited base-red: upstream d7be9fd (cheaper-inference#14544) introduced it earlier today and it arrived with the sync merge, so it is not this fork's defect.
diegosouzapw
added a commit
that referenced
this pull request
Sep 24, 2026
…enumber migration to 186 (#13973) The stagger added 45 min to the model-sync PERIOD (6h45m), so the two schedulers only drifted and re-collided, and MODEL_SYNC_INTERVAL_HOURS was silently overridden. Arm the recurring interval after a one-shot 45 min phase timer instead, keeping effectiveIntervalMs unchanged, and cancel the pending arm on stop. Migration 185 collided with 185_usage_history_cpa_auth_index.sql on the release tip (#14544), which aborts boot; renumber to 186.
diegosouzapw
added a commit
that referenced
this pull request
Sep 24, 2026
…n only the management key is set #14544 built the probe URL from CLIPROXYAPI_HOST with no fallback, so a key-only (local) setup probed http://undefined:8317 and showed the account as unreachable; it was also the typecheck:core TS2322 on the release tip. Test fails on the old code (actual http://undefined:8317/...). Refs #14496
diegosouzapw
added a commit
that referenced
this pull request
Sep 24, 2026
…irement, extracted failure projection - docs: migration count 182 -> 183 in README, AGENTS.md and llm.txt (+ the 66 llm.txt mirrors), same shape as #14559; migration 185 landed with #14544. - #14468 retired suno: APIKEY_PROVIDERS 242 -> 241 and the translate-path golden loses the suno entry (regenerated; that is the only diff). - #14527 moved the retained provider-failure projection into chatCore/providerFailureRetention.ts; the public-error guard now follows the call and still requires sanitizeErrorMessage() at the projection. Refs #14496
diegosouzapw
added a commit
that referenced
this pull request
Sep 24, 2026
Drains the base-red accumulated on release/v3.8.51 (#14496, #14547). Production fixes: auggie spawn typing, projectCombo type imports, Responses passthrough markers surviving the egress strip (#14252 regression), compression effective-pipeline preview following the runtime lossy policy (#14529 regression, #12063), CLIProxyAPI account-health host default (#14544 regression), DEEP_HEALTH_CHECK_ENABLED env contract. The remaining test guards were realigned to merged design changes, each traced to its commit; the subtitle-runtime fixtures moved to a per-run temp dir; documented file-size/stryker rebaselines absorb the 2026-09-23/24 merge-wave drift.
This was referenced Sep 24, 2026
BenjaminAronsson
added a commit
to BenjaminAronsson/OmniRoute
that referenced
this pull request
Oct 3, 2026
Rebase onto release/v3.8.51 surfaced three problems. Migration 185 collided with 185_usage_history_cpa_auth_index from cheaper-inference#14544, which the migration runner rejects outright. Renumbered to 186; no retroactive isSchemaAlreadyApplied guard is needed because this migration has never shipped under the old number. The SSO branch claimed any RS256 JWT bearer even with SSO switched off, so a client sending its own unrelated JWT — extractBearer already notes VS Code Copilot does this — would hard-401 instead of degrading to anonymous under REQUIRE_API_KEY=false. It is now gated on isEntraSsoEnabled(), which answers false if the settings read throws so an unreadable config falls through to the pre-SSO path rather than 500-ing auth. The new test is RED against the previous commit. The migration count landed off by one: cheaper-inference#14559 had already moved the docs to 181 and the base to 182, and the rebase merged both edits cleanly into a number that no longer matched the 183 files on disk.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
X-CPA-TRACE-ID. This PR stores that opaqueauth_indexonusage_historyfor the success, streaming, and error paths. A later completed attempt backfills the column when the first write missed the header.Related Issues
Validation
Choose the change type and focused loop from the
Contribution Golden Path. The full unit suite,
Vitest, the 60% coverage gate, and the production build all run in CI on this PR (#8329):
node --import tsx/esm --test tests/unit/cpa-trace-auth-index.test.ts tests/unit/cpa-auth-index-usage.test.ts tests/unit/db/migration-185-cpa-auth-index.test.ts tests/unit/chatcore-failure-usage.test.ts(12 passed);npm run check:migration-numbering;npm run check:file-size;npm run check:docs-counts;node scripts/check/check-docs-sync.mjsnpm run lint— ESLint on the touched TypeScript files (the same command lint-staged runs). The fulleslint .suite still runs in CI.release/v3.8.51(9f4d3b0ab8); focused checks rerun afterwardTests Added Or Updated
tests/unit/cpa-trace-auth-index.test.ts— opaque parse, JSON andauth_index=forms, rejection of emails/paths/secrets, header rebuild, sanitized label jointests/unit/cpa-auth-index-usage.test.ts— persist plus dedup backfill on a fresh databasetests/unit/db/migration-185-cpa-auth-index.test.ts— upgrade from a priorusage_historyand idempotent re-run when the column already existstests/unit/chatcore-failure-usage.test.ts— existing failure-usage characterization, still passing with the extra fieldCoverage Notes
open-sse/handlers/chatCore/cpaTraceAuthIndex.ts, the usage-history write/read, and migration 185 are covered by the tests above.open-sse/handlers/chatCore.tsonly threadsreadCpaAuthIndex(providerResponse)into the three existing usage writers (failure, non-streaming, streaming). The parser and the label join live in leaves under the file-size cap. The frozen ceiling moves 6400 → 6402 because Prettier keeps the failure-usage property and the import on their own lines.Reviewer Notes
X-CPA-TRACE-IDin the CLIProxyAPI executor, thread the opaqueauth_indexintousage_history.cpa_auth_index, and resolve the label at read time. It is not a credential-selection input and it does not reimplement session affinity.model_cooldown429s. It does not read this header.185_usage_history_cpa_auth_index.sqlis nullable. The documented migration count moves from 178 to 182 so README, AGENTS.md, andllm.txtmatch the files on this branch (the tip was already ahead of that prose).getUsageDb/getUsageHistoryreturncpaAuthIndexandcpaAccountLabel.