Skip to content

fix(provider_registry): case-insensitive model name lookup for context_limit - #8906

Merged
DOsinga merged 3 commits into
aaif-goose:mainfrom
bzqzheng:fix/context-limit-case-sensitivity
May 12, 2026
Merged

fix(provider_registry): case-insensitive model name lookup for context_limit#8906
DOsinga merged 3 commits into
aaif-goose:mainfrom
bzqzheng:fix/context-limit-case-sensitivity

Conversation

@bzqzheng

Copy link
Copy Markdown
Contributor

Problem

Custom provider model names with case mismatches (e.g. GLM-5.1 in the provider JSON config vs glm-5.1 in GOOSE_MODEL) silently failed the known_models context_limit lookup in normalize_model_config and fell back to the default 128k.

Fixes #8752.

Change

Use eq_ignore_ascii_case instead of strict equality when matching model.model_name against entries in metadata.known_models.

This is the smallest possible fix: it only affects the lookup, does not mutate stored model names, and does not change what gets sent to provider APIs.

Verification

  • Added 3 unit tests covering:
    • Case mismatch (uppercase in registry, lowercase in model config) → context_limit resolved correctly
    • Exact case match → no regression
    • Unknown model → falls back gracefully (context_limit stays None)
  • All 3 tests pass.

Checklist

  • DCO sign-off
  • Tests added
  • No regression for native providers (Anthropic, OpenAI) where case is already lowercase

…t_limit

Custom provider model names with case mismatches (e.g. 'GLM-5.1' in config
vs 'glm-5.1' in GOOSE_MODEL) silently failed the known_models context_limit
lookup and fell back to the default 128k.

Use eq_ignore_ascii_case instead of strict equality in
normalize_model_config so the lookup works regardless of case.

Fixes aaif-goose#8752

Signed-off-by: Bright Zheng <bzqzheng@gmail.com>
@bzqzheng bzqzheng closed this Apr 29, 2026
@bzqzheng bzqzheng reopened this Apr 29, 2026
@bzqzheng
bzqzheng marked this pull request as ready for review April 29, 2026 16:25
Bojun-Vvibe added a commit to Bojun-Vvibe/oss-contributions that referenced this pull request Apr 29, 2026
- aaif-goose/goose#8910 (merge-after-nits): cumulative-tokens display fix
- aaif-goose/goose#8906 (merge-as-is): case-insensitive provider lookup
- INDEX: append drip-179 section, table, and verdict-mix paragraph
Douwe Osinga added 2 commits May 12, 2026 14:21

@DOsinga DOsinga left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Good fix — the case-insensitive lookup is the right call here.

I removed the tests: they were only asserting that eq_ignore_ascii_case works as documented (exact match still matches, non-match still doesn't). The case-mismatch test was the only one that tested the actual bug, and even that is really just testing a standard library function at this point. The one-liner speaks for itself.

One process note: please don't open multiple PRs at the same time — submit one, wait for it to land, then open the next. See the contributing guide.

@DOsinga
DOsinga added this pull request to the merge queue May 12, 2026
Merged via the queue into aaif-goose:main with commit 208fea5 May 12, 2026
22 checks passed
shafqatevo pushed a commit to shafqatevo/goose that referenced this pull request Aug 7, 2026
…t_limit (aaif-goose#8906)

Signed-off-by: Bright Zheng <bzqzheng@gmail.com>
Signed-off-by: Douwe Osinga <douwe@squareup.com>
Co-authored-by: Douwe Osinga <douwe@squareup.com>
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.

Case mismatch in custom provider model name breaks context_limit lookup

2 participants