mirror of
https://github.com/turnstonelabs/turnstone.git
synced 2026-08-23 12:24:46 -06:00
23fed785c4
* feat: auto-detect model changes when LLM backend swaps models The BackendHealthMonitor already probes /v1/models every 30s but discarded the response. Now compares the detected model against the last known one and triggers a registry reload when it changes. - Extract _extract_context_window() helper for reuse across detect_model, probe_model_endpoint, and the health monitor - BackendHealthMonitor: new provider/initial_model/on_model_changed params; _check_model_change() fires callback on model swap - Server: wire _handle_model_change callback that updates cli_model_args and calls registry.reload(); guarded by _user_specified_model flag so --model overrides are never auto-replaced - Session: _refresh_model_from_registry() called at top of send(); two string compares when nothing changed, full re-resolve on swap - 7 new tests for _extract_context_window and model change detection * fix: address Copilot review on model re-detection - server: update cli_model_args only after successful reload (not before), add finally block for new_reg.shutdown(), guard against cli_model_args not yet initialized - session: wrap registry lookup in try/except for concurrent reload race, reset judge on model change, recompute tool_truncation when context_window changes in auto mode