Skip to content

fix(server): return effective context limit from /model-info - #10165

Merged
DOsinga merged 1 commit into
aaif-goose:mainfrom
piyushbag:fix/10163-model-info-context-limit
Jul 6, 2026
Merged

fix(server): return effective context limit from /model-info#10165
DOsinga merged 1 commit into
aaif-goose:mainfrom
piyushbag:fix/10163-model-info-context-limit

Conversation

@piyushbag

Copy link
Copy Markdown
Contributor

Summary

  • Resolve the effective context limit in /config/providers/{name}/model-info using ProviderEntry::normalize_model_config, the same path the session layer uses.
  • On the primary fetch_model_info success path, override context_limit with the normalized value so GOOSE_CONTEXT_LIMIT, declarative provider limits, and canonical registry precedence are honored.
  • Add unit coverage for GOOSE_CONTEXT_LIMIT overriding both unknown-model defaults and declarative provider known-model limits.

Test plan

  • cargo fmt
  • cargo test -p goose test_goose_context_limit
  • cargo test -p goose-server
  • cargo clippy -p goose-server -p goose --all-targets -- -D warnings

Fixes #10163

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0b477d7039

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/goose-server/src/routes/config_management.rs Outdated
@piyushbag

piyushbag commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

Noted. Updated the success path to override only when model_config.context_limit is explicitly set (GOOSE_CONTEXT_LIMIT, declarative provider known_models, or canonical registry). When normalization leaves context_limit as None, the provider-fetched value is preserved (Databricks upstream resolution, etc.).

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a381f03472

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +509 to +510
if let Some(limit) = model_config.context_limit {
info.context_limit = limit;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve fetched Databricks endpoint limits

For Databricks endpoints whose name canonically parses differently from the resolved upstream model, fetch_model_info has already looked up the endpoint and computed info.context_limit from resolved_model, but this branch overwrites it with the locally normalized endpoint-name limit. For example, an endpoint named like kgoose-gpt-4o that actually points at a larger Claude/GPT model will be reported with the gpt-4o limit instead of the upstream model's limit. Fresh evidence: this version avoids the old default fallback case, but line 505 still populates model_config.context_limit from canonical/known metadata rather than only from an explicit user override.

Useful? React with 👍 / 👎.

@piyushbag
piyushbag force-pushed the fix/10163-model-info-context-limit branch 3 times, most recently from 73a1647 to e101bd3 Compare July 1, 2026 17:33
@piyushbag

Copy link
Copy Markdown
Contributor Author

CI is green on batched commit e101bd3 (rust fix + EnvVarConfig schema sync). Ready for maintainer review.

@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.

LGTM. Clean, minimal fix that does exactly what #10163 asked for: routing /model-info through normalize_model_config and only overriding the fetched context_limit when an explicit override is resolved, so provider-resolved limits (e.g. Databricks) are preserved. Both codex comments are correctly addressed. Thanks!

Use ProviderEntry::normalize_model_config for the effective limit.
On fetch_model_info success, override context_limit only when
model_config.context_limit is explicitly set (GOOSE_CONTEXT_LIMIT,
declarative provider, or canonical registry) so provider-fetched
limits (e.g. Databricks upstream resolution) are preserved.

Update EnvVarConfig OpenAPI descriptions to match generated schema.

Fixes aaif-goose#10163
@piyushbag
piyushbag force-pushed the fix/10163-model-info-context-limit branch from e101bd3 to ee1cdb5 Compare July 3, 2026 16:39
@piyushbag

Copy link
Copy Markdown
Contributor Author

@DOsinga Thanks again for the review and approval.

Rebased onto latest main (ee1cdb56f); conflicts are resolved and CI is green on the post-rebase run: https://github.com/aaif-goose/goose/actions/runs/28673123907

Whenever you have a moment, this should be ready to merge. Happy to follow up on anything else.

@DOsinga
DOsinga added this pull request to the merge queue Jul 6, 2026
Merged via the queue into aaif-goose:main with commit 8694a8d Jul 6, 2026
23 checks passed
ellenblaine added a commit to ellenblaine/goose that referenced this pull request Jul 7, 2026
…mestamp-timezone

* origin/main: (34 commits)
  feat: askai bot hints for followups (aaif-goose#10291)
  feat(desktop): per-message usage stats UI (tokens, cost, TTFT, tok/s) (aaif-goose#10210)
  fix(server): return effective context limit from /model-info (aaif-goose#10165)
  fix(deps): gate rcgen aws_lc_rs feature behind rustls-tls (aaif-goose#10116)
  Disable thinking preservation for Groq (aaif-goose#10284)
  Bound code-mode execution with timeout and cancellation (aaif-goose#10214)
  chore(deps): bump docker/setup-buildx-action from 4.1.0 to 4.2.0 (aaif-goose#10232)
  chore(deps): bump docker/build-push-action from 7.2.0 to 7.3.0 (aaif-goose#10233)
  chore(deps): bump docker/metadata-action from 6.1.0 to 6.2.0 (aaif-goose#10235)
  chore(deps): bump mockall from 0.14.0 to 0.15.0 (aaif-goose#10240)
  chore(deps): bump uniffi from 0.31.1 to 0.32.0 (aaif-goose#10247)
  chore(deps): bump sigstore-verify from 0.9.0 to 0.10.0 (aaif-goose#10250)
  chore(deps): bump cmov from 0.5.3 to 0.5.4 (aaif-goose#10282)
  chore(deps): bump candle-transformers from 0.10.2 to 0.11.0 (aaif-goose#10242)
  chore(deps): bump candle-core from 0.10.2 to 0.11.0 (aaif-goose#10241)
  fix: recover malformed tool calls from GLM/Minimax models instead of rejecting them (aaif-goose#10230)
  chore(deps): bump jsonschema from 0.30.0 to 0.46.9 (aaif-goose#10244)
  move google provider into goose-providers (aaif-goose#10216)
  chore(deps): bump umya-spreadsheet from 2.3.3 to 3.0.0 (aaif-goose#10248)
  add provider bindings MVP to goose-sdk, and add python wheel publishing (aaif-goose#10208)
  ...
lifeizhou-ap added a commit that referenced this pull request Jul 7, 2026
* main:
  Update Rust toolchain and raise recursion limit (#10303)
  Switch the local inference provider MLX backend to use the safemlx crate (#10304)
  feat: askai bot hints for followups (#10291)
  feat(desktop): per-message usage stats UI (tokens, cost, TTFT, tok/s) (#10210)
  fix(server): return effective context limit from /model-info (#10165)
  fix(deps): gate rcgen aws_lc_rs feature behind rustls-tls (#10116)
leanzero-srl pushed a commit to leanzero-srl/goose-local-edition that referenced this pull request Jul 15, 2026
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.

/model-info does not return the effective context limit for models without a canonical registry entry

2 participants