fix(native-chat): narrow the model branch to a string session-option value

SessionOptionValue widened to string | boolean for fast mode, so the model
branch could index valuesByModel with a boolean and pass one to the persist
callback. A boolean there is a malformed command, not a model id.
This commit is contained in:
Brennan Benson
2026-08-20 17:32:39 -07:00
parent 633e4f369a
commit 72500a6506
@@ -121,6 +121,12 @@ function recordCommandApply(args: {
}
const previousModelId = effectiveModelId
if (optionId === 'model') {
// Why: SessionOptionValue widened to string | boolean for fast mode, but a
// model id is always a string - a boolean here is a malformed command, not a
// model, and must not index valuesByModel or reach the persist callback.
if (typeof value !== 'string') {
return false
}
if (previousModelId !== value) {
// Why: a model command can reset model-scoped state, so an older value
// from a prior visit is no longer evidence about this live session.