Repository navigation
fix(acp): pick thought levels from the session's own menu, and honor graded levels - #39
Merged
Merged
Conversation
…graded levels
Three fixes that only work together.
Graded levels: reasoningValueForThoughtLevel mapped a low-effort token only
onto an off-like value, so an agent offering graded levels and no off got
nothing. Kimi's K3 offers low/high/max/on, so reasoning "low" was a no-op
on every Kimi model. Fall back to the `low` level when there is no off;
off still wins where both exist.
Per-session menus: a pooled AcpAgentClient serves many sessions but kept
one client-wide runtimeCapabilities, overwritten by every session/new and
option write. applyReasoning and setModel read it. With per-session models
real since 0.16.0, and the model deciding which thought levels exist, a
session was matched against whichever menu was written last: K3 enrichment
with a K2.7 chat opened after it sent no thinking write; the reverse sent
thinking=low to K2.7, which the agent refuses. Each session now keeps its
own menus. The client-wide snapshot remains for agent-level questions and
as the fallback for a session with none yet.
config_option_update: ACP 1.3 defines it as the full configOptions set, but
the parser read a single changed option, so the spec shape was dropped.
Kimi emits it after every model change, and it is set_model's only report
(that call answers {}). The full set now refreshes the session's menus and
current values, currentModelId included.
Verified against Kimi Code CLI 2.0.0 with two sessions on one client and
the prompt refused locally: 0.16.0 sends no thinking write; this sends
thinking=low and Kimi confirms model=kimi-code/k3 thinking=low.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This was referenced Sep 18, 2026
- Build a session's menus on what `initialize` reported, never on the
client-wide snapshot. That snapshot is whichever session wrote last, so a
fresh session inherited another session's menus and current values and
could skip a write it believed was already applied.
`captureRuntimeCapabilities` now takes `base` as a required argument, so an
explicit `undefined` can no longer fall back to the shared snapshot.
- Apply an option write's reply to the session's runtime state as well as its
menus, so options the write reshaped (Kimi moves thinking when the model
changes) report where the agent actually put them.
- Recognize the ACP 1.3 full-set `config_option_update` in one place
(`configOptionUpdateSet`). It honors every kind key (`sessionUpdate`,
`session_update`, `kind`, `type`), so menus and runtime state agree on
which updates carry the set.
- A live full-set refresh keeps the source the session's menus were opened
with, and no longer relabels them `session-load`.
- Classify a thought level as "low" only after checking for on, so a value
that already read as on ("On (minimal budget)") keeps doing so.
Each correctness fix has a test that fails on the previous commit.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Harold Hunt (huntharo)
added a commit
to pwrdrvr/PwrSnap
that referenced
this pull request
Sep 18, 2026
0.16.0 routed the model write correctly, but `reasoning: "low"` still did nothing on any Kimi model. The low-effort token only mapped onto an off-like thought level: K2.7 Coding offers only `on`, and K3's graded `low` never matched. The pooled client also kept one option menu for all its sessions, so an enrichment on K3 could be matched against a chat session's K2.7 menu. 0.16.1 (pwrdrvr/agent-kit#39) falls back to a graded `low` when the agent offers no off, keeps option menus per session, and reads ACP 1.3's full-set `config_option_update`. Measured against Kimi Code 2.0.0: K3 + `reasoning: "low"` now sends `thinking=low`, and Kimi confirms it. Raises the floor to ^0.16.1 so a fresh resolve cannot land on 0.16.0. THIRD_PARTY_LICENSES regenerated. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
After #37, a PwrSnap review found that model selection now works but
reasoning: "low"still does nothing on Kimi. Chasing that turned up three separate bugs. Each one alone leaves the symptom in place:reasoningValueForThoughtLevelonly maps a low-effort token onto an off-like value. Kimi's K3 offerslow/high/max/onand no off, so"low"→undefined. K2.7 Coding offers onlyon. Soreasoning: "low"was a no-op on every Kimi model, whichever model was selected.AcpAgentClientserves many sessions but kept oneruntimeCapabilities, overwritten by everysession/newand option write.applyReasoning(threadId)andsetModel(threadId)read that shared copy. Before fix(acp): route model selection to the config option ACP 1.3 defines #37 every session ran the default model, so the shared menu was always right. Now sessions can run different models, and on Kimi the model decides which thought levels exist, so one session gets matched against another session's menu.config_option_updateis dropped. ACP 1.3 defines it as the fullconfigOptionsset, but the parser only reads a single changed option (update.configOption). Kimi sends the full set after every model change, and it's the only report you get fromsession/set_model, which replies{}.The fix
offif the agent has one, otherwise thelowlevel (low/minimal/min/minimum). High-effort is unchanged.AcpSessionState.runtimeCapabilities, taken from that session'ssession/new/session/loadresult and refreshed by its own option writes.setModel,applyReasoningand the session's capability notifications read it. A session's menus are built on whatinitializereported, never on the client-wide snapshot, and a session with no menu of its own readsinitialize's menus too.captureRuntimeCapabilitiestakesbaseas a required argument, so nothing falls back to the shared copy by default. The client-wide copy stays only for agent-level questions (session load, MCP transport support). An option write's reply updates the session's runtime state as well as its menus, so options the write reshaped report where the agent actually put them.config_option_update: recognized in one place (configOptionUpdateSet) however the update is keyed (sessionUpdate,session_update,kind,type). It replaces the session's menus and its current values, includingcurrentModelId, so if the agent changes the model,thread_settingsshows the new one rather than the model originally requested.Verified against Kimi Code CLI 2.0.0
Two sessions on one client, the pooled shape PwrSnap uses.
session/promptis refused locally, so the thinking write reaches Kimi but no model turn runs and no tokens are spent:startThread({ model: "kimi-code/k3" }), then a chat thread on the default model, thenstartTurn({ reasoning: "low" })on the first.on)lowmodel=kimi-code/k3 thinking=lowTests
Six new tests. I ran them against the old code, and against partial versions of the fix, to make sure each one checks something:
lowwhen there's no offlowlow, which hid the bugthread_settingsThe fake transport in
per-session-capabilities.test.tsmodels Kimi as measured: each session has its own model, and a thought level that model doesn't offer is refused.pnpm typecheck,pnpm test(agent-acp 174 passing, workspace 363),lint:boundaries,lint:licenses,lint:deps: all clean.Review follow-up (ff9e695)
A high-effort review of the first commit found that a new session could still inherit another session's menus and current values via the client-wide snapshot (and skip a write it thought was already applied). It also found that an option write's reply refreshed the menus but not the current values, that the full-set check ignored the
kind/typekeys, and that a live refresh relabeled menus assession-load. It also found that a value like "On (minimal budget)" could be reclassified from on to low. All fixed. Each correctness fix has a test that fails on the first commit.Release
This is a
patch. PwrSnap pins^0.16.0, so it picks this up with a lockfile refresh and no pin bump.🤖 Generated with Claude Code