Skip to content

fix: restore the context usage meter on CLI 1.1.21 and keep the chosen context-window tier - #27

Merged
luoxuanzao merged 2 commits into
mainfrom
fix/context-usage-response-shape
Aug 17, 2026
Merged

fix: restore the context usage meter on CLI 1.1.21 and keep the chosen context-window tier#27
luoxuanzao merged 2 commits into
mainfrom
fix/context-usage-response-shape

Conversation

@luoxuanzao

Copy link
Copy Markdown
Member

Summary

  • What changed? Qoder CLI 1.1.21 changed the get_context_usage control
    response from flat token counts (totalTokens/maxTokens/
    rawMaxTokens/percentage) to a percentage-based shape
    (contextWindow.usedPercentage, categories, tokenCountsAvailable).
    The turn tracker kept reading the old fields, so every lookup came back
    undefined and the context usage meter stayed stuck at its "appears after
    the first response" placeholder. The tracker now parses the new shape:
    the reported percentage drives the meter, absolute token counts are only
    trusted when tokenCountsAvailable is true, and the window size falls
    back to the effective per-model override, then the previous turn, then
    the model catalog.
  • Also fixed: the post-response refresh silently dropped a context-window
    tier chosen in the per-model editor (such as 400K) and reverted to the
    model catalog default (200K), because the CLI omits maxTokens in the
    new shape. The runtime now routes the effective per-model context window
    into the tracker, so the chosen tier survives every response.

Verification

  • npm run typecheck
  • npm run lint
  • npm run test (3324 passed)
  • npm run build
  • npm run release:check
  • npm run audit:prod
  • Tested affected qodercli behavior against a real CLI when applicable
    (end-to-end in Obsidian against qodercli 1.1.21: meter shows a real
    percentage after the first response, and a 400K tier selection stays
    400K across multiple responses instead of reverting to 200K)

Safety

  • No credentials, private vault content, internal URLs, or personal paths are included
  • User-visible changes are documented in CHANGELOG.md

luoxuanzao and others added 2 commits August 17, 2026 21:46
qodercli 1.1.21 changed the get_context_usage control response from
flat token counts (totalTokens/maxTokens/rawMaxTokens/percentage) to
a percentage-based shape (contextWindow.usedPercentage, categories,
tokenCountsAvailable). The turn tracker kept reading the old fields,
so every lookup came back undefined and the context usage meter was
stuck at its "appears after the first response" placeholder.

Parse the new shape: percentage drives the meter directly, absolute
token counts are used when the CLI reports them (tokenCountsAvailable),
and window size falls back to the previous turn or the model catalog.
Router tests now mock the new wire shape.

Co-authored-by: QoderAI (Qwen 3.8 Max) <qoder_ai@qoder.com>
The post-response context-usage refresh fell back to the model catalog
default window whenever the CLI omitted maxTokens, so a tier chosen in
the per-model editor (such as 400K) reverted to the default (200K)
after the first message. Route the effective per-model context window
into the turn tracker and prefer it over the catalog fallback when the
CLI reports no absolute window.

Co-authored-by: QoderAI (Qwen 3.8 Max) <qoder_ai@qoder.com>
@luoxuanzao
luoxuanzao merged commit bcda153 into main Aug 17, 2026
10 checks passed
@luoxuanzao
luoxuanzao deleted the fix/context-usage-response-shape branch August 17, 2026 23:38
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.

1 participant