Skip to content

feat(usage): show account-specific remaining subscription quota - #472

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

Adam-Dalloul wants to merge 137 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

Show remaining subscription quota for the account a conversation actually uses, with reset windows and clear unavailable states. Supported sources are Claude, Codex, Grok, Cursor and OpenCode Go. Context occupancy and public API-list cost estimates remain separate from subscription quota.

This combined branch includes #919's native accounts and guided sign-in/API-key setup, plus #470/#471 compatibility. A named account keeps its native agent features, isolated configuration and authentication. Named-account quota reads use the launch authentication resolver, and authentication changes invalidate cached quota.

Fresh @mentions and delegation preserve an explicit native account; resuming a child retains its saved account. OpenCode code-mode delegation now correlates using the account argument too. Unreadable account expressions stay unkeyed instead of being mistaken for Default.

The UI retains existing desktop/web controls and phone layouts. Native Claude switching retains verified session/task state and refuses active work, unavailable models or live context resets. Writer checks include conversation identity even while a process is stopping. #669 adds the explicit cross-agent/account saved-context dialog.

The filter fix #1029 and recording fix #1048 are now merged upstream and included here with the maintainer's fixes for model labels, relayed-message usage and duplicate imports. The account import paths retain those protections for Default and named accounts. Native usage recovery remains a separate policy discussion in #1047; API-list estimates shipped with #503.

OpenCode Go usage reads the key OpenCode 2 keeps for the account, through OpenCode's credential helper with that account's launch environment, since OpenCode 2 reads auth.json only while migrating a 1.x install. The key is reused for up to ten minutes unless codeg changes OpenCode credentials or an account's sign-in changes. A model-provider binding that OpenCode ignores no longer hides its usage.

All previously published migration IDs and branch history are retained. New compatibility markers distinguish these schema backups from older builds.

Validation on v0.41.1: on the combined head, the production server/MCP/CLI build and all-target Clippy passed, and the complete library suite passed 6,252 of 6,253 tests. The exception is an unchanged upstream git test that expects newer git wording than the local image's git 2.39.5. Each branch also passed all-target Clippy and its focused suites on its own head. ESLint, TypeScript, the production frontend export and the full frontend suite passed (11,185 tests; five that hit the 5-second limit under full parallelism pass when their files run alone). Real HTTP/MCP/browser fixtures again cover native task restoration, unavailable-model refusal, rollback, paged history and images, account/agent switching, drafts/titles, @ routing, retry, restart, import deduplication and reset refusal, including phone and RTL layouts, plus the custom-agent recording, handoff ownership, old-database upgrade and frozen-usage fixtures. A new OpenCode 2 fixture creates named OpenCode accounts over HTTP: a saved server lands in the account's opencode.jsonc with its comments kept and no second file, a refused save leaves every config unchanged, the import scan lists that account's own OpenCode 2 session, and sign-in refuses a 1.x build. v0.41.2, released during this verification, merges with every branch without conflicts; a trial merge of the combined branch passed all-target Clippy, TypeScript and 527 of 528 overlapping chat and activity tests, and the remaining timing test times out the same way on unmodified v0.41.2 here. These use isolated synthetic data and CLI fixtures, not live sign-in/generation for every provider or OS. The runtime fixtures ran on the same production code as this head; the only later change fixed two test call sites. CI runs again on the refreshed commits.

Maintainer edits are enabled. The fixtures do not establish live provider sign-in/generation for every agent or OS.

@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
Named OpenCode accounts follow OpenCode 2: their history parser resolves the account's own database and config through upstream's rules, MCP fan-out and its preflight use the config file OpenCode loads last (JSONC included), and a change to an account's opencode.jsonc marks its session restart-required. The MCP config lock now wraps upstream's combined Antigravity/OpenCode preflight.
…sions open

OpenCode 2 keeps credentials in the database in its data dir rather than auth.json, so the sign-in also carries an OPENCODE_DB the slot sets.
…lt account

The provider model list and the OpenCode credentials helper build the default account's launch environment; named accounts sign in through their own CLI.
OpenCode 2 reads skills from both skills/ and skill/ under its config directory, so a named account links each of the three shared roots.
OPENCODE_CONFIG_DIR replaces OpenCode 2's default global directory, so an extra slot pointed there shares Default's config and the fixed ~/.config/opencode it replaced is an account of its own.
OpenCode 2 keeps credentials in its own database and no longer reads what 1.x signs in to, so a named account's sign-in refuses a 1.x build with the session's upgrade message.
OpenCode 2 stores credentials in its own database and reads auth.json only while migrating a 1.x install, so the quota panel asks OpenCode's credential helper for the account's key, caching it until codeg changes OpenCode credentials or a sign-in. A provider binding OpenCode ignores no longer hides its subscription usage.
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