Author SHA1 Message Date
HarvmasterandClaude Opus 5.5 3dc916834f Daemon: a changed default model overrides the saved state (0.6.3)
ci / build (push) Canceled after 0s
In managed mode the extension switches models by rewriting the daemon config's
defaultModel and restarting it, but loadState() preferred the persisted model, so the
daemon came back on the old one every time. State now records the default it was saved
under; a different default wins.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J39imRDT8L7xYbWzsVWd8A
2026-10-04 01:06:31 +00:00
3 changed files with 13 additions and 4 deletions
+6
View File
@@ -2,6 +2,12 @@
Extension versions are released as `vscode-v<version>` on the [Releases](https://git.harvmaster.com/Harvmaster/autocomplete-model/releases) page. Models are versioned by their name in [`models/manifest.json`](models/manifest.json).
## vscode 0.6.3
- **Fix: model choice didn't stick in managed mode.** The daemon's saved state (last model used) overrode both the
model picked in the menu and a new default from a release, so it kept restarting on the old model (e.g.
`stage-c`). A changed default now wins; switching through the daemon API still persists as before.
## vscode 0.6.2
- **Next-edit is ~3–5× faster:** the next-edit server uses n-gram speculative decoding (the rewritten region is mostly
+6 -3
View File
@@ -76,6 +76,8 @@ export interface RuntimeState {
enabled: boolean
model: string
mode: ContextMode
/** config.defaultModel when this state was saved: a changed default (editor model setting, new release) wins. */
defaultModel?: string
}
export function loadConfig(configPath: string): DaemonConfig {
@@ -97,12 +99,13 @@ export function loadConfig(configPath: string): DaemonConfig {
}
export function loadState(config: DaemonConfig): RuntimeState {
const fallback: RuntimeState = { enabled: true, model: config.defaultModel, mode: config.models[config.defaultModel].defaultMode }
const fallback: RuntimeState = { enabled: true, model: config.defaultModel, mode: config.models[config.defaultModel].defaultMode, defaultModel: config.defaultModel }
try {
const s = JSON.parse(fs.readFileSync(config.stateFile, 'utf8')) as Partial<RuntimeState>
const model = s.model && config.models[s.model] ? s.model : fallback.model
const keepModel = s.defaultModel === config.defaultModel && s.model && config.models[s.model]
const model = keepModel ? s.model! : fallback.model
const mode = s.mode && config.models[model].modes.includes(s.mode) ? s.mode : config.models[model].defaultMode
return { enabled: s.enabled ?? true, model, mode }
return { enabled: s.enabled ?? true, model, mode, defaultModel: config.defaultModel }
} catch {
return fallback
}
+1 -1
View File
@@ -3,7 +3,7 @@
"displayName": "Local Autocomplete",
"description": "Inline code completion from a local fine-tuned model via the acd daemon",
"publisher": "harvmaster",
"version": "0.6.2",
"version": "0.6.3",
"license": "MIT",
"engines": {
"vscode": "^1.90.0"