fix(cli): separate model reload and make foreground restart actually restart #287
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/model-catalog-reload"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
User-visible failures
/reload-skills incidentally invalidated the model catalog while existing sessions kept stale same-ID API/protocol objects. /restart exited 75 and left a native foreground user in the shell.
Fix
Explicit admin-only /reload-models refreshes the shared SDK catalog locally without model requests or network discovery. Existing model IDs/reasoning and conversation history are preserved; same-ID metadata is reapplied at the next turn. Skills/MCP reload does not alter the catalog. Active prompts/compaction refuse mutation; new prompts wait for reload. Invalid configuration blocks inference until corrected/reloaded without silent fallback. Successful reload releases only queued topic metadata via a durable save.
The installed npm executable is a foreground launcher: wait for old process and IPC closure, restart only on 75, preserve arguments, forward graceful signals, resume the selected TUI conversation from bounded IPC metadata. Normal quit/failure does not restart. Direct CLI/container entrypoints retain external-supervisor semantics.
Verification
Final exact candidate typecheck/build and 1559/1559 full tests passed, no skips. Real SDK test changes the API for the SAME model ID and confirms old sessions refresh only after explicit model reload, keeping thinking/history. Invalid catalog blocks inference and can recover after repair. Commands test admin isolation and no skill/resource side effects. Queued topic retries respect the persistence barrier. Subprocess tests cover signals, no overlapping writer, normal exits and retained arguments.
Actual pseudoterminal smoke test twice: /restart replaces the runtime PID, same conversation metadata, /quit exits foreground launcher with 0, no model requests. Independent tool-free review found no remaining concrete regressions after the IPC handoff ordering was fixed.
The local Claude 400 was separately reproduced and corrected through per-model openai-completions (user model/role selections unchanged). Recovery notice fix #286 is already merged and included. Existing running processes must restart to import the new code.