fix(local): inherit conversation context_window_limit from model_settings#3235
Open
abhay-codes07 wants to merge 1 commit into
Open
fix(local): inherit conversation context_window_limit from model_settings#3235abhay-codes07 wants to merge 1 commit into
abhay-codes07 wants to merge 1 commit into
Conversation
…ings New conversations created against the local backend only honored a top-level context_window_limit field, but the desktop draft flow sends the limit nested inside model_settings. The stored record ended up without a limit and every consumer fell back to the 128000 default, even when the agent was explicitly configured with a larger window. Lift the nested value to the record's top-level field at creation via conversationContextWindowLimitFromBody (placed in local-model- normalization.ts next to supportedConversationModelSettingsFromBody). An explicit top-level value still wins, and conversations without any configured limit keep the field unset. Fixes letta-ai#3132
abhay-codes07
force-pushed
the
fix/local-conversation-context-window
branch
from
July 15, 2026 08:52
aa75987 to
5932946
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
context_window_limit: the desktop draft flow (and other callers) send the limit nested insidemodel_settings, butcreateLocalConversationRecordonly read the top-levelcontext_window_limitfield. The stored record ended up without a limit, so every new conversation fell back to the hardcoded 128000 default even when the agent was configured with a much larger window.model_settings.context_window_limitto the conversation record's top-level field at creation when no explicit top-level value is provided. An explicit top-level value still wins, and conversations with no configured limit keep the field unset.Fixes #3132.
Test plan
bun test src/backend/local-backend.test.ts— adds a repro test (fails without the fix) plus guards for top-level precedence and the no-limit casebun run checkmainbaseline on the same machineAI disclosure
Following the policy proposed in #3139: this PR was developed with AI assistance (Claude Code) — the investigation, patch, and tests were AI-assisted. I directed the work, reviewed the change, and ran the validation above locally; the repro test was mutation-checked (it fails with the fix reverted).
cc @cpacker — this sits right next to the record-normalization work in #3136, happy to adjust if you'd rather fold it in there.