Repository navigation
feat(catalog): infer custom-provider context windows from model metadata - #7024
Conversation
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configuration
📒 Files selected for processing (51)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
✅ Deterministic PR hygiene checks passed. |
⏳ DRAFT
What to do
Review readiness checklist
0/4 boxes ticked. Automatic draft conversion failed. Please convert this pull request to a draft manually until every box above is ticked. |
42808a8 to
124fca5
Compare
|
Maintainer bundle review (clients/config/tests/catalog): holding this PR; not merged. Exact-head Cross-platform CI on
These are not flaky. They are the behavior change this PR proposes, colliding with the earlier #1073 decision that id-only custom rows stay at the conservative window. Resolving them means either updating those expectations as an explicit reversal of #1073 (note that The source review found nothing else blocking: the exact/normalized tiering, fail-closed conflicts, built-in name exclusion and provenance separation read correctly, and the PR merges cleanly with current |
|
@lidge-jun The original problem was frequent compaction in my setup: a custom provider omitted context metadata, so the catalog used 128k even though the bundled vendor table had a larger window for the model. That metadata is an estimate, not verification of the relay's capacity. I understand that #1073 deliberately keeps id-only custom providers conservative. Would you accept a per-provider opt-in for vendor context inference, disabled by default? With it unset or disabled, the existing fallback and enabled-cap behavior would remain unchanged. When explicitly enabled for a custom provider, reported/configured windows would still take precedence, context caps would still clamp the result, and inferred windows would keep their source provenance separate from verified capacity. Built-in providers would remain excluded. This would preserve the existing #1073 expectations while making the metadata fallback available to users who choose it. Is this direction acceptable, and are there any changes you want to the five decisions in the PR description before implementation? |
Gate the bundled model-ID context estimate behind providers.<name>.inferContextWindow (default off) so id-only custom rows keep the lidge-jun#1073 conservative fallback: an enabled Context cap as the window, else 128k. Built-in names stay excluded even when the flag is set. Docs in all eight locales and the structure note describe the opt-in. Co-authored-by: lcxhh521 <lcxhh521@users.noreply.github.com>
|
Maintainer integration into This resolves the earlier hold: the maintainer decision is to keep the #1073 conservative fallback as the default. Vendor context inference is now a per-provider opt-in ( Exact-head hosted evidence: Cross-platform CI |
Summary
Custom providers whose model list omits context metadata currently fall back to the 128k compatibility window, even when the bundled model metadata has a larger published window for that exact model ID. This adds a model-ID fallback for those missing windows.
~aliases. In the current data,minimax-m3andMiniMax-M3actually have different windows, so a normalized first-match implementation would be unsafe.contextWindowInference. Client catalogs receive the budget, while routing capability provenance keeps the estimate separate from asserted serving-provider capacity. Preserve the marker through custom-row inheritance and recompute window estimates on re-hint.A matching model ID does not establish a relay's actual capacity. Operators whose relay serves less should set
modelContextWindowsor Context cap. This does not enable a cap or send model probes automatically. The shared catalog also feeds Claude context selection and other client exports.Maintainer decisions made explicit in this draft
context_windowrouting provenance.The helper remains in catalog derivation because it projects client budgets without changing static provider or request-admission facts. Its placement can be adjusted if a different shared derivation owner is preferred.
Verification
Base: upstream
devat6da2774369aa32552e318e333902499683d053bc.vendor-contextfocused suite 15 pass, 0 fail; typecheck and structure checks passed. This is supplementary platform evidence, not the repository-pinned Bun 1.4.3 full suite.bun run typecheck,bun run structure:check,bun run privacy:scan,git diff --check: pass.bun install --frozen-lockfileandbun run build; 569 pages / 79,417 internal links validated after the final documentation edits.bun run test:changedwas stopped while queued, before running its suite, because broader fixture network isolation needs separate verification in this environment. No unrelated test-harness changes are included. Full import-connected/cross-platform coverage and exact-head hosted CI remain outstanding.Rebase validation (2026-10-13)
Rebased onto upstream
devat20cd56169f501143f3efd53226c1a11528a748e3; the rebase head was124fca57377703a39fc02e95c8a4036c5c2b0112. The single English provider-documentation conflict preserves both the context-inference wording and the new upstream AzureminMaxOutputTokenssetting. Independent static review checked all ten automatically merged files and both test-layout maps. All six runtime feature files are byte-identical to the previously tested head. The new built-in Modelflare provider is covered by the registry-enumeration exclusion test.Fresh verification on this exact source tree (Bun 1.4.3, disposable configuration homes):
bun test --isolateover the same 14-file focused selection described above: 261 passed, 0 failed / 2,416 assertions.bun run typecheck,bun run structure:check,bun run privacy:scan, andgit diff --check: passed.bun install --frozen-lockfileandbun run build: passed, 569 pages / 79,427 internal links.Isolated compaction fixture follow-up (2026-10-13)
Current head:
cb4f916330ab49daa580a5d7383864d5de47d501. A separate test-only commit addresses the two scenarios reported by Linux shard 3, independently of the context-default policy discussion:tests/responses/responses-compaction-http-isolation.test.ts, preserving all original routing/account assertions and reducing the existing file below its size cap.provider.fetchand explicitly select HTTP/SSE. Add a fixture-owned abort deadline, propagate the replay relay abort signal, and drain state before restoring fetch/configuration homes. A new regression verifies cancellation settles before restoration.20cd5616and feature head124fca57; an additional deny-all guard blocked those attempts. Supplying the fixture transport executor made both cases pass on both revisions. This establishes a fixture-isolation gap; it does not prove the precise cause of the hosted 20-second timeout or every subsequent failure.bun test tests/responses/responses-compaction-http-isolation.test.tswith an additional transport/process-blocking preload: 3 passed, 0 failed / 27 assertions, on both the base-plus-fix and feature-plus-fix trees; no blocked transport/process attempts on the fixed runs. The three layout/tooling/file-size regression files: 28 passed, 0 failed / 643 assertions. Typecheck, structure, privacy and whitespace checks passed; independent final source review found no remaining blocker in this fixture patch.The two #1073 catalog expectations and the default-on inference policy are unchanged. The proposed default-off per-provider opt-in remains a discussion, not an implemented change. The prior full CI failed; full local tests were not rerun, and this new head requires its own hosted CI. This does not mark the PR ready for review.
Maintainer update (2026-10-14): opt-in, conservative default kept
Head
8dc12b84fmakes the vendor estimate a per-provider opt-in.providers.<name>.inferContextWindowdefaults to off. With it unset orfalse, an id-only custom row keeps the #1073 behavior: an enabled Context cap becomes the window, otherwise 128k. Withtrue, the precedence described above applies. Built-in provider names stay excluded even when the flag is set. This resolves the two Linuxtest 2/4failures intests/codex-integration/codex-catalog.test.ts(an id-only model with no configured window keeps the conservative fallback (#1073)andan id-only model with an enabled context cap uses that cap as the window) without changing their expectations.canInferVendorContext(name, providerConfig)gates both call sites (applyProviderConfigHintsand the custom-only gap fill inrouted-gather).OcxProviderConfig, the provider zod schema, the provider field-policy map (auth-cors.ts) and the model-rename field map.vendor-context.test.ts: an unset or false flag yields no inference, keeps the cap/128k fallback, and keeps custom-only gather rows uninferred. Existing inference cases now opt in.structure/catalog-vendor-context.md/structure/catalog.mdsay it is opt-in.Verification on this head:
bun run typecheck,bun run structure:check,bun run privacy:scan,git diff --checkpass.bun test tests/codex-integration/vendor-context.test.ts tests/codex-integration/codex-catalog.test.ts: 354 pass, 0 fail, including both #1073 cases. Local full-suite runs were not practical because several concurrent worktrees on this machine share the test-run lock. Exact-head hosted Cross-platform CI is the full-suite evidence.Co-authored-by: lcxhh521 lcxhh521@users.noreply.github.com
Checklist
This PR is intended to remain a draft pending maintainer decisions and exact-head hosted validation.
Review readiness checklist
This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:
Required local validation passed; commands, results, and any full-suite exception are documented.
I pushed my PR to a recent dev commit (at most 10 behind; a maintainer may still ask for the exact tip before merge).
I resolved all correct Codex and CodeRabbit findings.
My PR is ready for review.