Skip to content

fix: preserve active model tuning across context-window reloads (#6200) - #6209

Merged
atomantic merged 2 commits into
mainfrom
claim/issue-6200
Sep 4, 2026
Merged

fix: preserve active model tuning across context-window reloads (#6200)#6209
atomantic merged 2 commits into
mainfrom
claim/issue-6200

Conversation

@atomantic

Copy link
Copy Markdown
Owner

Summary

Fixes ensureContextWindow in server/services/ollamaManager.js so that a context-window reload composes on top of the currently applied launch environment (appliedLaunchEnvValues) instead of replacing it with {}. This ensures active model tuning knobs (such as OLLAMA_FLASH_ATTENTION, OLLAMA_KV_CACHE_TYPE) survive context-window reloads triggered by agent spawns (e.g. claude-ollama requiring 128K context).

Additionally, preserves the tuning's undo bookkeeping (preTuningEnv) across non-tuning reloads and updates the baseline's context window, so that when a tuning sweep later completes and calls clearLaunchEnv(), it cleanly restores the untuned daemon with the updated context window rather than reverting it or stranding the tuning.

Test plan

  • Verified that all 72 tests in server/services/ollamaManager.test.js pass with Vitest.
  • Added regression tests in server/services/ollamaManager.test.js:
    • preserves an active tuning across ensureContextWindow on a spawned process
    • preserves an active tuning and its undo bookkeeping across a service context-window reload
    • preserves an active tuning when ensureContextWindow starts an offline daemon
  • Ran related test suites: server/lib/ollamaContext.test.js, server/lib/localModelTuning.test.js, server/services/ollamaAgentContext.test.js, server/services/localModelAssessments.test.js (all passing).

Closes #6200

@atomantic

Copy link
Copy Markdown
Owner Author

Required code review was not completed before publication. This PR is intentionally left open and will not be merged until the required review completes.

@atomantic
atomantic merged commit 401b6f1 into main Sep 4, 2026
7 checks passed
@atomantic
atomantic deleted the claim/issue-6200 branch September 4, 2026 05:52
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.

a context-window reload clears an active local-model tuning's launch env

1 participant