Skip to content

fix: derive the pending-session current model from the enabled provider - #47

Merged
william0wang merged 4 commits into
william0wang:mainfrom
lianxin255:fix/pending-current-model
Aug 16, 2026
Merged

fix: derive the pending-session current model from the enabled provider#47
william0wang merged 4 commits into
william0wang:mainfrom
lianxin255:fix/pending-current-model

Conversation

@lianxin255

Copy link
Copy Markdown
Contributor

Follow-up to #44, branched on top of it (the pending-session branch it fixes was introduced there).

While testing the adapter from Paseo I asked for --model GLM-5.2 and the agent quietly ran GLM-5.3 instead. Root cause: the lazy session's configOptions advertised a hardcoded currentValue: "GLM-5.2", which can disagree with the model the runtime actually starts with (the enabled provider's leading model). Clients reasonably skip a requested switch when it equals the advertised current value — ACP's "the agent reports its state" contract — so whenever the requested id happened to match the fiction, the switch was silently dropped. That's a self-report bug, not a client quirk; anything trusting currentValue is affected.

Fix: derive the pending currentValue from loadAllModels()[0] — the dropdown's leading entry — instead of the hardcoded string. Falls back consistently with loadAllModels' own fallback when config is unreadable.

Fail-before / pass-after: new regression test fails on the parent (advertises GLM-5.2 vs the derived leading entry), passes with the fix; asserts the current value is also selectable in the dropdown. Suite on this branch: 464 green.

End-to-end on the real backend (zcode CLI 0.16.3): after the fix, model switching verified working across the whole discovered list — builtin (GLM-5.3 / GLM-5.2 / GLM-5-Turbo) and third-party provider models — with the agent self-reporting the requested model.

The thought option carried category "thought", which no client recognises
as the reasoning-effort selector — the ACP ecosystem keys on id/category
"effort" / "thought_level" (CodeBuddy, jcode, reasonix all use
thought_level). Multica's shared matcher is representative: it selects the
effort option by those tokens, so the zcode thinking toggle was invisible
to effort pickers and a per-agent reasoning level had nowhere to land.

The id stays "thought" (that is what session/set_config_option addresses);
only the category changes, which is display/marking metadata. Editors that
group config options by category now file it with the other thinking
controls instead of a bespoke group.

Verified through Multica: with the category aligned, the per-agent
thinking picker appears (values enabled/disabled verbatim from the
advertised options) and set_config_option dispatches to the runtime's
session/setThoughtLevel.
…easoning.variants

The lazy session/new advertised a hardcoded max/high/nothink list, which
was fiction on both ends for the default coding-plan model: the runtime's
own session/read for GLM-5.3 offers low/high/max (default max), and it
REJECTS nothink with 'Unsupported reasoning effort'. Clients that relay
the advertised options into a picker (Multica's effort selector) then
offered tokens the runtime refuses and hid ones it accepts.

The pending-session path now reads the enabled provider's
models[].reasoning.variants for the default model — the same source the
runtime itself resolves — with the static fallback corrected to the
verified low/high/max. The value advertised for a live session was and
remains the backend's session/read.

Verified end-to-end through Multica: the per-agent picker now mirrors
the real vocabulary (low/high/max for GLM-5.3) and dispatches tokens the
runtime accepts; a behavioural A/B on the same task produced 3 reasoning
chunks at low vs 18 at max.
- pending-session buildConfigOptions must advertise the thought option
  under the spec's thought_level category (the regression the category
  fix addresses: a bare "thought" category is not one of the reserved
  SessionConfigOptionCategory names, so effort pickers never found it)
- orderThoughtVariants unit tests: canonical ordering with unknown
  tokens preserved at the end (exported for testability)

461 → 463 tests, all green.
The pending (lazy) session advertised a hardcoded currentValue GLM-5.2,
which can disagree with the model the runtime actually starts with.
ACP clients skip a requested switch when it matches the advertised
current value, so the fiction silently pinned the wrong model whenever
the requested id happened to equal it (observed with Paseo --model
GLM-5.2). Follow the dropdown's leading entry instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants