Skip to content

feat(models): auto-aliases and token limits from synced Antigravity discovery - #11689

Closed
MumuTW wants to merge 1 commit into
cheaper-inference:mainfrom
MumuTW:feat/synced-auto-aliases
Closed

MumuTW wants to merge 1 commit into
cheaper-inference:mainfrom
MumuTW:feat/synced-auto-aliases

Conversation

@MumuTW

@MumuTW MumuTW commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Second slice of the accepted direction in #2979 (pairs with #11685 autoSync default and #11688 reactive discovery trigger). Two gaps closed:

  1. Bare-name resolution no longer needs hand-written aliases for new Antigravity-family models. The backend advertises tiered ids (gemini-3.7-flash-high/medium/low) while users naturally call the bare base name; Gemini 3.7 Flash shipped with no alias, so bare names mis-routed until the catalog was re-frozen by hand. New src/lib/providerModels/syncedAutoAliases.ts derives bare-base → default-tier (high > medium > low) aliases from the synced discovery catalog — in memory, no persistence, always consistent with the latest sync. Merged at the LOWEST precedence in getCombinedModelAliases: explicit DB/settings/wildcard aliases always win. A base that is itself callable gets no alias; agy wins over antigravity for the same base.
  2. Discovery-advertised token windows now survive to the enforcement chain. The [BUG] OMNIROUTE_DISABLE_CREDENTIAL_HEALTH_CHECK still logs scheduler started #11016 reconcile already trusts synced inputTokenLimit at request time, but the Antigravity discovery normalizer dropped every field except id/name — so nothing ever carried limits. The normalizer (and the client mapper) now forward inputTokenLimit/outputTokenLimit (also probing contextWindow/maxOutputTokens spellings). Extraction is defensive: absent/non-numeric fields yield nothing, so payloads without limits change zero behavior.

Related Issues

Validation

  • Change type: provider
  • Focused tests: node --import tsx/esm --test tests/unit/synced-auto-aliases.test.ts → 10/10 pass (pure derivation rules, limits extraction edge cases, live synced-catalog integration with a real temp-DATA_DIR sqlite + active connection fixture)
  • Regression: antigravity-model-aliases, 8958-alias-backed-node-prefix, 9034-alias-backed-prefix-id-repro → pass
  • npx eslint: no NEW issues on touched files (model.ts carries two pre-existing localDb no-restricted-imports errors from the frozen CI error set — untouched by this PR)
  • node scripts/check/check-file-size.mjs → OK
  • Reconciled with current main (v3.8.50)
  • Production-code changes include new automated tests in this PR

Tests Added Or Updated

  • tests/unit/synced-auto-aliases.test.ts (new, 10 tests): tier grouping + high-tier default; medium/low fallback; callable-base skip; non-tiered ignore; provider precedence; empty inputs; limits extraction (numeric, alternate spellings, junk rejection); client-mapper passthrough; live synced-catalog read via real sqlite fixture.

Coverage Notes

syncedAutoAliases.ts fully covered. normalizers.ts changes covered by the extraction tests (both payload shapes exercised). model.ts merge order covered indirectly by the alias regression suite (explicit aliases still resolve) plus the derivation tests.

Reviewer Notes

  • Alias precedence: auto < DB-namespace < settings exact < settings wildcard. Worst case for a bogus auto-alias is a shadowed bare name; explicit aliases override it immediately.
  • No DB writes, no schema change, no new settings — derivation is read-only over the existing synced store.
  • If the Antigravity payload field names differ from the probed spellings, limits simply stay absent (no-op) — extend extractDiscoveryTokenLimits when the real shape is confirmed.

…iscovery

Bare model names only resolved through hand-written aliases, so every new
upstream model launched blind: Gemini 3.7 Flash shipped as tiered ids
(...-high/-medium/-low) with no alias for the bare base name, mis-routing
bare requests until the catalog was re-frozen by hand.

- new src/lib/providerModels/syncedAutoAliases.ts derives bare-base ->
  default-tier aliases (high > medium > low, mirroring the backend's High
  default) from the synced discovery catalog, in memory (no persistence,
  always consistent with the latest sync). A base that is itself callable
  gets no alias; agy wins over antigravity for the same base.
- getCombinedModelAliases merges them at LOWEST precedence — explicit
  DB/settings/wildcard aliases always win.
- Antigravity discovery normalizer now forwards token windows
  (inputTokenLimit/outputTokenLimit, or contextWindow/maxOutputTokens
  spellings) when the upstream payload carries them; the existing
  import/reconcile chain (cheaper-inference#11016) already enforces them at request time —
  nothing consumed them before because the normalizer dropped them.
- field extraction is defensive: absent/non-numeric fields yield nothing,
  so payloads without limits change zero behavior.

Second slice of the accepted direction in cheaper-inference#2979; pairs with the reactive
discovery trigger (cheaper-inference#11688) and the autoSync default (cheaper-inference#11685).
@MumuTW
MumuTW requested a review from diegosouzapw as a code owner August 26, 2026 18:27
diegosouzapw added a commit that referenced this pull request Aug 28, 2026
…iscovery (#11889)

Recreated from #11689 (MumuTW) onto the active release/v3.8.51 — commit cherry-picked cleanly
with author preserved (auto-merged onto the just-boarded #11888); 10/10 focused tests +
file-size all green on this tip. Thanks for the fix!
@diegosouzapw

Copy link
Copy Markdown
Collaborator

Thanks for this! Its base (main) had diverged too far from the active release/v3.8.51 for a
clean retarget, and this fork rejects maintainer pushes, so a direct rebase-and-merge wasn't
possible. Recreated your commit (author preserved via cherry-pick) onto the current tip and
merged as #11889 — thank you for closing out the synced auto-aliases + token-limits slice.

@MumuTW
MumuTW deleted the feat/synced-auto-aliases branch September 5, 2026 10:19
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…iscovery (cheaper-inference#11889)

Recreated from cheaper-inference#11689 (MumuTW) onto the active release/v3.8.51 — commit cherry-picked cleanly
with author preserved (auto-merged onto the just-boarded cheaper-inference#11888); 10/10 focused tests +
file-size all green on this tip. Thanks for the fix!
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.

2 participants