Skip to content

fix(desktop): keep user-pinned model limits across provider enrichment - #1299

Merged
vastsa merged 2 commits into
vastsa:mainfrom
yexisu:fix/preserve-user-model-limits
Oct 2, 2026
Merged

vastsa merged 2 commits into
vastsa:mainfrom
yexisu:fix/preserve-user-model-limits

Conversation

@yexisu

@yexisu yexisu commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Fixes #1176.

Problem

The Pi 0.99.1 migration (b72ff6759) replaced the source-aware limit resolution in enrichProvider's binding mapping with the raw catalogModelConfigFor value. A user who pinned a 1M context window on a relay model then saw the catalog's 128k overwrite it on every read — the report in #1176: same key, context window dropped from 1M to 128k between versions. This also contradicts the rule modelConfigFor itself documents (spec §9.1: a user limit is never replaced; a user pin on a relay hit must not be silently replaced by the published number).

Fix

enrichProvider's binding mapping resolves limits through resolveBindingLimits + modelConfigWithBinding again, so:

  • a user-pinned context window/output cap survives enrichment (the [Bug] #1176 case)
  • a catalog-sourced window keeps following published corrections
  • rows without provenance keep their stored values (legacy user default)

Validation

  • node --test apps/desktop/test/provider-catalog-runtime.test.mjs (Node 22.23.2): 8/8 pass, including a new regression test covering a user pin on a catalog hit, a user pin on an unmatched hand-typed id, and a catalog-sourced window still following the published number
  • tsc --noEmit on apps/desktop: no errors in the touched file (pre-existing unrelated errors elsewhere, unchanged by this diff)
  • Branch contains latest origin/main (merge-base --is-ancestor ok)

The Pi 0.99.1 migration replaced the source-aware limit resolution in
enrichProvider's binding mapping with the raw catalog number, so a user
who pinned a 1M context window on a relay model saw the published 128k
value overwrite it on every read (issue vastsa#1176, spec §9.1: a user limit
is never replaced). resolveBindingLimits + modelConfigWithBinding are
restored for the mapping, while catalog-sourced windows keep following
published corrections.
Resolve catalog and user token limits through the provenance helper while keeping model capability shaping out of provider enrichment. This retains hand-typed model overrides and the existing enrichment boundary.
@vastsa
vastsa merged commit 601d5e5 into vastsa:main Oct 2, 2026
4 checks passed

This branch was previously deployed

1 inactive deployment
Preview — 01840333 Deployed Oct 2, 2026 by vercel[bot]
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.

[Bug]

2 participants