Skip to content

fix(usage): summarize the composer quota for the selected model - #7148

Merged
Astro-Han merged 2 commits into
rust-previewfrom
fix/composer-usage-current-model
Nov 22, 2026
Merged

Astro-Han merged 2 commits into
rust-previewfrom
fix/composer-usage-current-model

Conversation

@Astro-Han

@Astro-Han Astro-Han commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The composer usage indicator summarized the hottest window across the whole account. Antigravity reports separate quota groups ("Gemini Models" and "Claude and GPT models"), so with Gemini 4 Neon selected the composer showed 7d 90% from the Claude/GPT weekly window while the Gemini weekly window had 92% left.

Usage windows now carry the display names of the models that share them. agy /usage lists them in each group's description ("Models within this group: …"), so the Antigravity adapter parses that into a new optional models field on UsageLimit::Window. An empty list keeps the existing account-wide meaning, so other providers are unchanged.

The composer summary now picks the hottest window among those that apply to the selected model: unscoped windows plus windows that list the model's label. A label also matches a listed name followed by a parenthesized variant, because agy models keeps the effort suffix on models it lists only once ("GPT-OSS 120B (Medium)") while /usage lists the bare name. When none apply (no model selected, or a model agy does not list), it falls back to all windows as before.

Matching uses display names on purpose. agy /usage only exposes names, so resolving them to model IDs in the Host would still join on names while adding catalog-readiness edge cases.

Before (baseline) After
Composer with Gemini 4 Neon selected showing 7d 90% from the Claude and GPT weekly window Composer with Gemini 4 Neon selected showing 7d 92% from the Gemini weekly window

Verification

  • node --test products/maka/workbench/tests/composer-toolbar.test.mjs: pass. The new cases (selected-group match, lone-variant label match, unmatched fallback, account-wide window included) fail on the baseline summary; the lone-variant case also fails with the variant match removed.
  • cargo nextest run -p maka-agent-native -p maka-providers -p maka-agent-ports -E 'test(usage)': 6 passed, including the updated agy usage parser test.
  • cargo fmt --all -- --check, cargo clippy -p maka-agent-ports -p maka-providers -p maka-agent-native --all-targets --no-deps -- -D warnings, biome on changed TS files, and node scripts/ci.mjs run contracts (regenerated SDK types): pass.
  • models is optional in both output schemas (agent.externalUsageLimits, settings.connectionUsageLimits). Checked with Ajv against the generated contracts: a reading that mixes scoped windows and a window without models (agy group without a description) validates on both endpoints.
  • Manual, debug desktop build with an isolated host root and Antigravity enabled: Gemini 4 Neon shows 7d 92% (Gemini weekly), Claude Opus 5.5 shows 7d 90% (Claude and GPT weekly). The screenshots above come from the same root and window, built from the base commit and from this branch.

AI use

Select exactly one:

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope: Claude Code (claude-opus-5-5) diagnosed the issue, implemented the change and tests, and ran the verification above under my direction and review.

Checklist

  • Tests cover the change and fail without it
  • Format, typecheck and the affected suites pass locally

Does this PR entail a change in behavior?

  • Yes — described under Summary above
  • No

The composer usage indicator summarized the hottest window across the
whole account. Antigravity reports separate quota groups ("Gemini
Models", "Claude and GPT models"), so with Gemini selected the
indicator showed the Claude/GPT weekly window instead of Gemini's.

Usage windows now carry the display names of the models that share
them, parsed from agy's group description; an empty list keeps the
account-wide meaning for every other provider. The composer prefers
windows that apply to the selected model's label (unscoped or listing
it) and falls back to all windows when none apply.

Matching on display names is deliberate: agy /usage only exposes names,
so resolving them to model IDs in the Host would still join on names
while adding catalog-readiness edge cases.

Generated-by: Claude Code (claude-opus-5-5)
…ants

`models` was skipped when empty but generated as required in the
agent.externalUsageLimits output schema, so any agy group without a
description made the Host reject the whole usage reading. Defaulting
the field makes the schema match what is serialized.

A model listed once by `agy models` keeps its effort suffix in the
picker label ("GPT-OSS 120B (Medium)") while `/usage` lists the bare
name, so the composer fell back to the account-wide window. Accept a
label that is a listed name followed by a parenthesized variant.

Generated-by: Claude Code (claude-opus-5-5)
@Astro-Han
Astro-Han marked this pull request as ready for review November 22, 2026 03:50
@Astro-Han
Astro-Han merged commit cc78382 into rust-preview Nov 22, 2026
11 of 15 checks passed
@Astro-Han
Astro-Han deleted the fix/composer-usage-current-model branch November 22, 2026 03:50
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