Skip to content

fix bug to use model context length - #1070

Open
Selena Yang (selenayang888) wants to merge 1 commit into
mainfrom
syang/fix-use-model-context-length
Open

fix bug to use model context length#1070
Selena Yang (selenayang888) wants to merge 1 commit into
mainfrom
syang/fix-use-model-context-length

Conversation

@selenayang888

Copy link
Copy Markdown
Contributor

Fixes #1067.

Request validation incorrectly used search.max_length as the model’s total context limit. Some models, including Gemma, define a generation default of 4,096 while supporting a context length of 131,072.

Copilot AI balanced review requested due to automatic review settings September 3, 2026 01:29
@vercel

vercel Bot commented Sep 3, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
foundry-local Ready Ready Preview Sep 3, 2026 1:29am UTC

Request Review

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The focused fix matches the reported configuration semantics and includes appropriate regression coverage.

Pull request overview

Fixes context-budget validation to use the model’s actual context window while retaining legacy configuration support.

Changes:

  • Prioritizes model.context_length over search.max_length.
  • Adds precedence and fallback tests.
  • Updates API documentation and error messaging.
File summaries
File Description
search_options.cc Corrects context-length resolution.
search_options.h Documents the updated behavior.
search_options_test.cc Tests precedence and legacy fallback.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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] Foundry Local v2.0.1 uses max_length config instead of model context_length

2 participants