Skip to content

[Bug]: Composer effort bars are inverted when a provider advertises reasoning levels high→low #43496

Done

Description

@lynnlase

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/web

Steps to reproduce

  1. Use a provider whose reasoning select advertises its levels in descending order with the off level last. On my setup this is an ACP Registry agent exposing Qwen4-Max, whose Reasoning Effort menu lists Extra High, High, Low, None — i.e. ["xhigh", "high", "low", "none"].
  2. In the composer, open the model picker → Reasoning Effort.
  3. Select Extra High, close the menu, and look at the bars in the model trigger.
  4. Select None and look at the bars again.

No provider is needed to reproduce the logic — resolveEffortGlyph alone shows it (descriptor shape simplified):

const descriptor = {
  type: "select",
  id: "reasoningEffort",
  options: [
    { id: "xhigh", label: "Extra High" },
    { id: "high", label: "High" },
    { id: "low", label: "Low" },
    { id: "none", label: "None" },
  ],
};

resolveEffortGlyph(descriptor, "xhigh"); // { count: 4, filled: 1 } — expected filled: 4
resolveEffortGlyph(descriptor, "none");  // { count: 4, filled: 4 } — expected filled: 0

Expected behavior

Bars rise with reasoning effort, as they already do for Codex / Claude / Antigravity: Extra High = 4 of 4 filled, High = 3, Low = 2, None = 0 filled.

Actual behavior

The scale is inverted, and the off level reads as maximum:

Selected Menu label Bars filled (actual) Expected
xhigh Extra High 1 of 4 4 of 4
high High 2 of 4 3 of 4
low Low 3 of 4 2 of 4
none None 4 of 4 0 of 4

Extra High (only the shortest bar opaque, other three at 0.4) and None (all four opaque) were confirmed visually on 0.1.12; High and Low follow from the same code path.

The selected effort is still applied correctly — only the indicator is wrong. But it actively misleads in both directions: the strongest setting looks like the weakest, and "no reasoning" looks like the strongest.

Root cause

resolveEffortGlyph in apps/web/src/components/chat/EffortGlyph.tsx derives both the bar count and the fill from array position, assuming ascending order with the off level first:

const startsAtOff = OFF_LEVELS.has(levels[0]!.id);              // L28
const count = startsAtOff ? levels.length - 1 : levels.length;  // L29
// ...
const index = levels.findIndex((option) => option.id === current); // L34
filled: startsAtOff ? index : index + 1,                        // L38

For a descending list that ends in none, both assumptions fail:

  1. levels[0] is xhigh, so startsAtOff is false. The off level is counted as an ordinary level (count = 4 instead of 3) and can never map to 0 filled.
  2. index increases as effort decreases, so filled is inverted.

Built-in providers are unaffected because their descriptors are hardcoded ascending (low, medium, high, xhigh, …), which is why this only surfaces for agents that advertise their own order via ACP Registry. The picker menu renders that advertised order too, so its menu reads high→low while built-in providers read low→high.

Suggested fix

Either:

  • Rank by level id instead of position — map ids to a canonical rank (off/none < minimal < low < medium < high < xhigh), count only non-off levels, and return filled = 0 when the current level is an off level. Order-independent, and keeps working for any order an agent advertises. This is the safer minimal fix.
  • Normalize the advertised choices when building the select descriptor for ACP / ACP Registry providers, so the glyph and the menu order match built-in providers. This also removes the menu-order inconsistency.

A regression test with a descending […, "none"] descriptor would cover it.

Impact

Minor bug or occasional failure — persistent and misleading, but no functional failure.

Version or commit

Desktop 0.1.12; source read at 387d1c170b22578f8d890bc22750eda357606397.

Environment

Windows 10 (10.0.19044), T3 Code (Beta) desktop 0.1.12, provider via ACP Registry, model Qwen4-Max.

Workaround

Set the composer effort display to Word instead of Bars ("Show reasoning effort in the composer as its name, such as High, or as bars"; persisted as effortDisplay: "label"). The word label is correct — only the bar glyph is wrong. Reading the menu's text label is also reliable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions