Repository navigation
Conversation
…icked (#542) buildPersistedChatModel let hydrated catalogue metadata win over the stored contextWindow. hydrateChatModel always fills that field (128000 when the provider reports nothing), so once Ollama was reachable any re-pick of the same model replaced a user-tuned window. Re-picking the stored provider+model now keeps the stored value; a different model still takes the catalogue value. Also adds a Context window field under the chat model in the Agent editor so the value no longer has to be edited by hand in data.json. Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
|
Co-Authored-By: Claude <noreply@anthropic.com>
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.
What
Re-picking the same chat model no longer overwrites its stored context window with provider metadata or the 128000 fallback.
hydrateChatModelalways fillscontextWindow(falling back to 128000 when the provider reports nothing), andbuildPersistedChatModellet that win, so a tuned window (e.g. an Ollamanum_ctxsized to the machine) was lost as soon as the model was re-selected after Ollama came up. Now: same provider+model → stored value wins; different model → catalogue value as before.Also adds a Context window number field under "Chat model" in the Agent editor, so the value can be set without hand-editing
data.json. Shown only when a chat model is set; rejects non-positive values with a Notice and invalidates the agent runnable so the new value applies.Fixes #542
Not in this PR (follow-ups):
onExternalSettingsChange, so edits todata.jsonwhile Obsidian runs are picked up.getSummarizationTriggerTokens), so windows below about 15k can fill up before history is summarized. This predates the PR.HydratedChatModelMetadata.contextWindowoptional, which ripples into the picker's "ctx" labels, so I left it out.How I tested it
test/utils/persistedChatModel.test.tscover the precedence: same model keeps the stored window; a different model, or the same model name on another provider, takes the catalogue value; missing stored value falls back to the catalogue; vision follows the catalogue and temperature is kept.bun run check,format,lint,testpass locally (1995 tests).S2B WT1vault), not yet live-tested in Obsidian; Leo will test the editor field and the Ollama re-pick there.AI assistance: Claude Code (Opus) wrote the fix, tests and editor field from Leo's triage brief for #542; Leo reviews and live-tests before merge.
Checklist
bun run check,bun run format,bun run lint, andbun run testpass locallymanifest.json: I noted that the docs site needs updating (see "Documentation" in CONTRIBUTING.md) — n/a