model: a stale session selector falls back to the config

A session started with the old picker had <session>.model = "main". The
restore accepted any selector sp_provider_choose() could not resolve and
pasted it onto the running endpoint as a model name, so the sidebar read
"junction / main" and /model showed no current row.

An unresolvable selector is now ignored and the config default / -m is used;
the session log says why. Verified with a temp session: sidecar "main" ->
-model qwen3.6-35b-judged, and the picker marks it. The real stale sidecar was
moved out of ~/.splinter.

test_engine, test_gateway, test_compactor pass; test_ui passed on rerun (its
PgDn scroll check is timing-sensitive).
This commit is contained in:
lotherk committed 2026-11-18 13:31:18 +00:00
1 parent 80154055f1
commit a0f47762f0
1 file changed
+6 -4
+6 -4
View File
@@ -2886,11 +2886,13 @@ sp_engine_open(struct sp_engine **out, const struct sp_engine_opts *o,
local.kind = ch.d->kind;
local.key_env = ch.d->key_env;
sp_usage_set_active(ch.d->id);
} else if (strchr(saved, '/') == NULL) {
/* a model of the endpoint the run was configured with */
snprintf(saved_model, sizeof(saved_model), "%s", saved);
local.model = saved_model;
} else {
/*
* A selector that no longer resolves (a legacy bare
* "main", a model the config dropped) must not be
* pasted onto the running endpoint as a model name.
* Fall back to the config default instead.
*/
sp_logf("session", "saved model '%s' is gone; "
"using the default", saved);
saved[0] = '\0';