Skip to content

feat(usage): show remaining quota for the current agent account - #472

Open
Adam-Dalloul wants to merge 75 commits into
spacering-net:mainfrom
Adam-Dalloul:remaining-quota-honest-panel
Open

Adam-Dalloul wants to merge 75 commits into
spacering-net:mainfrom
Adam-Dalloul:remaining-quota-honest-panel

Conversation

@Adam-Dalloul

@Adam-Dalloul Adam-Dalloul commented Aug 15, 2026 •

Copy link
Copy Markdown
Contributor

Remaining usage follows the account saved on the conversation. Switching a Claude chat updates its usage indicator in the same tab, while Token Usage lists accounts and usage windows separately. Agent mentions can select a native account, such as Claude Code · Work, and delegated children retain that account when resumed.

Stacks on #919; merge that first. This refresh includes main 2e657fac and the maintainer's migration-order, locale-order and translated unsupported-agent fixes. It retains the new unified session-settings picker, Claude Remote Control, TRAE CLI and Command Code. This consolidates the earlier panel, header, Cursor and OpenCode Go work from #472, #481, #490 and #491.

Usage reads cover Claude, Codex, Grok, Cursor and OpenCode Go through their official usage interfaces. Named accounts use their own credentials. API/provider overrides do not borrow an old subscription balance. Tighter Claude model limits appear separately, OpenCode Go is labelled explicitly, and missing usage stays unavailable.

The account picker retains a chat's model and mode when switching to an unused account, shows loading/retry states, and offers existing-chat switching on top-level Claude conversations. Remote Control must be turned off before switching, with both a localized UI hint and a backend check that preserves the active connection. Remote Control actions wrap with 44px touch targets on narrow screens. Connecting chats use their own account's cached selectors. These preference and Remote Control fixes are also in #919 so it works independently.

The @ menu derives accounts from the registry and retains native icons and types. delegate_to_agent accepts optional agent_account_id: omission preserves same-agent inheritance, default explicitly chooses Default, and a saved ID chooses that account. Removed or wrong-agent accounts fail before launch. Identical tasks on different accounts remain distinct, and interrupted children resume their saved account. Custom mentions, stored v3 routing frames, and Assistant presets/instructions remain compatible.

Pricing builds on merged #503, included in v0.36.0. The explanation opens by click, tap or keyboard. Partial estimates show how many tokens were priced, unpriced models are labelled, and the explanation states the standard cache-duration assumption and excluded adjustments. These are API list-rate estimates, separate from subscription charges.

Named accounts cover 14 built-in families on Windows/Linux and 13 on macOS. Cursor on macOS uses Default. Kiro, ZCode, TRAE CLI and Command Code retain native agents without named accounts; OpenClaw uses its gateway's account. The account guide and localized backup hint explain that named-account folders need separate backups. OpenCode and Cursor retain the original home/GitHub CLI configuration; other tools using separate configuration folders may need setup.

Validation: 500 focused frontend tests across 19 files, ESLint, TypeScript and production export; the native dependency passes 59 Rust account tests. All 15 focused Rust handshake tests pass after the test-only synchronization fix described below. Runtime fixtures do not perform vendor logins or paid generation.

Separate live checks on Windows verified two distinct existing Claude accounts and authenticated usage reads without changing credentials. No fresh OAuth flow or all-provider sign-in coverage is claimed. OpenCode's installed CLI passed synthetic-store isolation checks while Git, npm and gh retained their configuration; the new OpenCode and Cursor pins were also inspected at source.

The existing office_watch released-port test fix remains: only AddrInUse gets a bounded retry with a fresh candidate; other errors and persistent contention still fail. Windows desktop CI compiles tests and runs Clippy without executing that desktop suite. Browser checks use headless Chromium desktop/phone viewports, not native WebViews or physical phones.

The final server/MCP build and isolated HTTP/MCP/browser checks pass. They cover native and Assistant mentions, explicit Default and inherited accounts, child/Assistant resume, per-account usage, and switching with history/draft/model/mode retained. Pricing shows $22.05 in the full-rate fixture, $21.75 with 75% coverage when a rate is missing, and no invented zero for an unknown model. Desktop 1365px and phone 390px checks cover usage, price help and backup copy. Remote Control checks at 1365px, 390px and 320px verify direct-API refusal while active, unchanged transcript bytes, visible action bounds, QR interaction and the actual Turn off button before switching. Phone contexts use simulated touch.

The first refreshed native Linux run passed 5,413 tests and exposed an existing handshake fixture race: transport shutdown could cancel its close-notification callback. The notification now follows connection completion, retaining the timeout and all assertions. This changes only test synchronization.

Current-head checks for 364a0727.

@Adam-Dalloul Adam-Dalloul changed the title Show remaining subscription only from official payloads Show remaining subscription from live official CLI payloads Aug 15, 2026
@Adam-Dalloul
Adam-Dalloul force-pushed the remaining-quota-honest-panel branch from 9f86b6a to 3b55c9f Compare August 16, 2026 17:01
Settings MCP still targets the built-in family row. Extra custom
agents whose spec.env sets CLAUDE_CONFIG_DIR, CODEX_HOME, GROK_HOME,
GEMINI_CONFIG_DIR, or OPENCODE_CONFIG_DIR now receive the same server
on upsert and lose it on remove.

Claude extra homes only get enabledPlugins; server defs stay in the
shared ~/.claude.json. Auth files are never copied.
Custom agents whose spec.env sets a family isolator now have a Sign in
card on the Agents page. That opens the official CLI login
(claude/codex/grok/gemini/opencode) with the isolator env set.

No tokens are copied. Account 1 stays on the built-in home. Headless
and unit-test paths return the command instead of spawning a terminal.
Settings MCP still targets the built-in family row. Extra custom
agents whose spec.env sets CLAUDE_CONFIG_DIR, CODEX_HOME, GROK_HOME,
GEMINI_CONFIG_DIR, or OPENCODE_CONFIG_DIR now receive the same server
on upsert and lose it on remove.

Claude extra homes only get enabledPlugins; server defs stay in the
shared ~/.claude.json. Auth files are never copied.
Custom agents whose spec.env sets a family isolator now have a Sign in
card on the Agents page. That opens the official CLI login
(claude/codex/grok/gemini/opencode) with the isolator env set.

No tokens are copied. Account 1 stays on the built-in home. Headless
and unit-test paths return the command instead of spawning a terminal.
@Adam-Dalloul
Adam-Dalloul force-pushed the remaining-quota-honest-panel branch from 3b55c9f to cf69039 Compare October 11, 2026 15:17
@Adam-Dalloul Adam-Dalloul changed the title Show remaining subscription from live official CLI payloads feat(usage): show remaining quota for the current agent account Oct 11, 2026
xintaofei and others added 18 commits October 17, 2026 09:47
The account migration is now m20261017_000001_agent_account and is
registered last, after the four migrations v0.36.0 shipped.

A backup records only the last registered migration, and a release
restores any backup whose last migration it knows. With the account
migration in the middle of the list, a backup from this build named
m20261016_000002_conversation_assistant, so v0.36.0 restored it and
then failed to start, since it has no file for the account migration.
Now v0.36.0 refuses such a backup as coming from a newer version.

A database that already ran a build with the old name must have its
seaql_migrations row renamed to the new one.
The locale files now differ from main only by this branch's own
strings. Merging v0.36.0 had moved four of main's blocks to the end of
their sections in all ten locales: MentionPanelSettings,
WindowAttentionSettings, and AcpAgentSettings' kiro and distribution.
No string was lost, but every locale conflicted with later changes next
to those blocks, and keeping main's side of a conflict listed kiro
twice.
Kiro's and ZCode's settings showed the server's English reason, "Named
accounts are not yet supported for this agent.", in every locale. The
accounts card now shows a translated note for any built-in agent
without accounts, and keeps the OpenClaw gateway note.
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.

2 participants