Repository navigation
feat(usage): show remaining quota for the current agent account - #472
Open
Adam-Dalloul wants to merge 36 commits into
Open
Adam-Dalloul wants to merge 36 commits into
Adam-Dalloul wants to merge 36 commits into
Conversation
Adam-Dalloul
force-pushed
the
remaining-quota-honest-panel
branch
from
August 16, 2026 17:01
9f86b6a to
3b55c9f
Compare
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
force-pushed
the
remaining-quota-honest-panel
branch
from
October 11, 2026 15:17
3b55c9f to
cf69039
Compare
This was referenced Oct 11, 2026
Adam-Dalloul
force-pushed
the
remaining-quota-honest-panel
branch
from
October 11, 2026 15:36
c3755a9 to
564648f
Compare
…tches A connection whose task ends on its own (the agent failed to load or exited, or the task panicked) now parks its child in the manager's draining list, as every explicit teardown does, so a missing map entry is never taken as proof that the process stopped. The deferred cleanup is spawned on the connection's runtime handle, because the guard drops outside any runtime context. Account switches wait for every writer of the session before copying it and before rolling a target back, and a child parked after its task finished leaves the list as soon as it is reaped. A switch's staging copies are removed once the switch is committed, a rollback completes, or staging itself fails. They are kept only when a rollback fails.
Launching a named account re-applies the shared MCP servers to config files that the account's own CLIs rewrite too. The config writers now leave a file alone when its content would not change, and the config staleness check no longer syncs account folders at all. Pi accounts mirror pi's own server list instead of the empty ACP forwarding view, which removed their servers again on every launch. A missing account folder no longer fails the import scan or every MCP change; that account is skipped until its folder is restored.
…ount A conversation switched to another account keeps its session in that account's folder. Work-task retries, returns and merges, their fresh-session fallback, and chat-channel resumes now launch with the conversation's saved account instead of the Default one, which the prompt gate then refused.
A tab that starts as a draft keeps a virtual runtime key, so its detail is never fetched. After the first send it read its account as Default and held auto-connect and reconnects for good, for every user. The account now comes from the binding the view set itself, then the newer of the workspace list and detail copies, and auto-connect waits only while none is known. The in-chat switcher stays disabled until then. The conversation list gets the in-flight ordering folders already have: an older snapshot is discarded, and a row an upsert changed while a refresh was in flight keeps the upsert's copy.
Connecting or sending to a conversation of another agent was refused with "This conversation belongs to a different agent account", which sends the user looking for an account problem. The refusal now names the other agent; a different account of the same agent keeps the account message.
Removing an account keeps its folder and its conversations, but adding that folder back created a new account. The conversations stayed bound to the removed one, so none of them could continue. Adding the folder of a removed account of the same agent now brings that account back, under the name entered, with its conversations. The removal dialog names the folder and says so, and a conversation of a removed account tells which folder to add again.
… it left A Claude account switch copies the session into the target account and leaves the source account's copy in place. The import scan listed that copy as new in the source account, and importing it created a stale duplicate whose row then blocked switching the conversation back. A copy is now treated as already imported when a live conversation under another account holds everything in it: its transcript as a prefix, and its sub-agent and tool result folder and file history as older trees, the switch's own test for a copy it may replace. The scan shows it as imported, an import of it is skipped, and the folder sweep leaves it out. A copy with anything of its own, or one that appears in two project folders, stays importable.
Every open conversation tab, hidden ones included, fetched the account list for itself and refetched it on every agent registry change, so one change sent a request per tab. The list is now kept once per agent and shared, the way the agent registry is: one request per agent on each change, and a refetch after a web client reconnects, since changes made while it was disconnected are lost. A failed refresh keeps the last list instead of emptying every tab at once, which made a draft's chosen account look gone.
…them A custom agent set up as a second account of a built-in agent (an extra slot) and a native account of that agent now do the same job, but their sign-ins had drifted apart. The slot ran the bare login command, which fails when the CLI is only installed by codeg (the OpenCode binary, say), and kept credentials the terminal exports, which can stand in for the login it is meant to create. Both now build the command the same way: the vendor CLI is resolved like codeg resolves it, and inherited credentials are cleared unless the slot sets them itself. The slot's card also points to the built-in agent's accounts, which keep that agent's features, and names the folder to add there. OpenCode is the exception, since its slot names only a config folder.
Adam-Dalloul
force-pushed
the
remaining-quota-honest-panel
branch
from
October 13, 2026 16:05
11ae15f to
b718adf
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Remaining usage follows the account saved on the conversation. Switching a Claude chat between accounts updates its usage indicator in the same tab, while the Token Usage page lists accounts and their usage windows separately. Agent mentions can also select a specific native account, such as
Claude Code · Work, and delegated children keep that account when resumed.Updated against current main and the latest maintainer changes in #919 (
1ba73d28). This still stacks on #919; merge that first. The quota changes begin after combined base47915e59. 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 are signposted separately, OpenCode Go is labelled explicitly, and missing usage stays unavailable.
The follow-up keeps a chat's current model and mode when switching to an unused account, shows loading and retry states for the account list, and offers existing-chat switching only on top-level Claude conversations. Account labels align with the transcript. OpenCode keeps the user's home directory while its credentials, state and configuration remain in separate XDG directories. The Accounts screen identifies profiles whose command-line tools may need separate setup.
The existing
@menu derives named accounts from the account registry and retains native agent icons and types.delegate_to_agentaccepts an optionalagent_account_id: omitted preserves same-agent inheritance,defaultexplicitly selects Default, and a saved ID selects that account. Removed or wrong-agent accounts fail before launch. Correlation distinguishes concurrent identical tasks on different accounts, and interrupted children resume using their own saved account. Existing custom-agent mentions and stored v3 routing frames remain compatible.Pricing builds on the merged #503. The explanation opens by click, tap or keyboard, partial estimates say how many tokens were priced, and unpriced model rows are labelled. It states the standard cache-duration assumption and the adjustments the estimate does not include.
Earlier quota/pricing validation covered 102 focused frontend tests, TypeScript, ESLint, seven quota/API Rust tests, the OpenCode isolation regression, all-target server Clippy and the production export. Real server and browser checks with synthetic accounts cover desktop/mobile switching, retained draft/history/model/mode, per-account usage, partial/unpriced cost estimates and tap-accessible price help. Separate profiles and saved account labels were checked for all 14 supported agent types.
The account-mention follow-up passed 73 focused frontend/registry checks and 401 Rust routing, delegation, lifecycle and account checks, plus TypeScript, ESLint, server/MCP all-target Clippy and a production build. A real local HTTP/MCP/broker flow with an offline ACP fixture verified explicit account selection, Default, inheritance, invalid-account refusal and cancel/resume on the child's account. Desktop and phone browsers offered all 14 native account families and submitted the selected account correctly, without overflow or page errors. These checks do not represent live provider sign-ins or generations.
CI for the current head
ffda6417is running. The prior headb718adf2passed all seven jobs.