From 1f4cdcbbbb4dc30f259c12e3dc751984d8394345 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89verton=20Toffanetto?= Date: Sun, 26 Jul 2026 05:11:53 -0300 Subject: [PATCH] fix(coding-agent): cap the local classifier and keep the Low floor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two defects in the ceiling work, both found in review. The local backend shared the online ceiling, so with `autoThinkingMaxEffort: max` and a sparse ladder the clamp could snap a `hard` bucket up to `max` — a tier the 3-bucket on-device classifier can never select. The local branch now pins `xhigh`. Applying the ceiling before the Low floor also broke the floor's contract: on `["minimal", "max"]` under an `xhigh` ceiling the intersection hid `max`, the code concluded the model "maxes out below Low", and it fell through to `minimal`. The floor is now resolved against the model's own ladder first and the ceiling filters that pool, so an excluded top tier yields no level instead of a sub-Low one. Docs and changelog now scope the guarantee to what `auto` resolves: a `thinking.requiresEffort` model whose ladder holds nothing under the ceiling still receives its lowest supported effort from the transport, because it accepts nothing else. The test that claimed to prove billing is renamed to say what it checks. Prompt assertions now cover the `max` criteria and the tie-break exception, not just the label, since the label alone is inert. Drops the duplicated pool-level assertions in favour of the contract-level sparse-ladder case. --- docs/settings.md | 2 +- packages/coding-agent/CHANGELOG.md | 2 +- .../src/auto-thinking/classifier.ts | 11 +++-- packages/coding-agent/src/thinking.ts | 15 +++--- .../test/auto-thinking-classifier.test.ts | 47 +++++++++++++++---- 5 files changed, 54 insertions(+), 23 deletions(-) diff --git a/docs/settings.md b/docs/settings.md index eafcad15f..5fa77110d 100644 --- a/docs/settings.md +++ b/docs/settings.md @@ -383,7 +383,7 @@ thinkingBudgets: | `thinkingBudgets.high` | number | `16384` | Token budget for `high`. | | `thinkingBudgets.xhigh` | number | `32768` | Token budget for `xhigh`. | | `thinkingBudgets.max` | number | `32768` | Token budget for `max`. | -| `providers.autoThinkingMaxEffort` | enum | `xhigh` | Highest effort `defaultThinkingLevel: auto` may resolve. `xhigh` keeps the classifier one tier below the top, so only `ultrathink` reaches `max`; `max` lets the classifier bill the top tier on models that expose it. The local on-device classifier stays capped at `xhigh` either way. | +| `providers.autoThinkingMaxEffort` | enum | `xhigh` | Highest effort `defaultThinkingLevel: auto` may resolve. `xhigh` keeps the classifier one tier below the top, so only `ultrathink` reaches `max`; `max` lets the classifier bill the top tier on models that expose it. The local on-device classifier stays capped at `xhigh` either way. This governs what `auto` *resolves*: a model whose ladder offers nothing under the ceiling gets no auto level at all, and one that also sets `thinking.requiresEffort` still receives its lowest supported effort from the transport — on a `["max"]` ladder that is `max`, because the model accepts nothing else. | ### Sampling diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.md index 6b2db974d..e08fc45d9 100644 --- a/packages/coding-agent/CHANGELOG.md +++ b/packages/coding-agent/CHANGELOG.md @@ -6,7 +6,7 @@ - `omp usage` now surfaces auto-disabled credentials as red `✗` tombstone rows (identity, how long ago, the shortened upstream cause — e.g. `Refresh token expired` — and a re-login hint), including a provider section when no active credential remains. User-driven tombstones (`replaced by newer credential`, `deleted by user`) and API-key rows stay hidden. Requires a broker with `GET /v1/credentials/disabled`; older brokers degrade to no tombstone rows. - `omp usage` warns about Anthropic's ~30-day OAuth grant lifetime: accounts whose interactive login (`authorizedAt`) is within a week of the deadline get a yellow `⚠ re-login within