Skip to content

Menubar: quota adapters for CLI-only installs (Cursor keychain, Kimi refresh, agy fallback) - #1755

Open
yishu-ziyu wants to merge 3 commits into
getagentseal:mainfrom
yishu-ziyu:menubar-cli-credential-paths
Open

yishu-ziyu wants to merge 3 commits into
getagentseal:mainfrom
yishu-ziyu:menubar-cli-credential-paths

Conversation

@yishu-ziyu

Copy link
Copy Markdown

Summary

Three small, independent fixes so the menubar dock reaches quota for users whose installs don't match the adapters' default assumptions. Each commit stands alone:

  • Cursor: cursor-agent CLI users often have no Cursor IDE installed, so state.vscdb doesn't exist. Fall back to the CLI's login-keychain item (cursor-access-token / cursor-user), read via the Apple-signed /usr/bin/security tool first (no entitlement prompt, 5s timeout), with SecItemCopyMatching as fallback. Grok Bot rides on the same session, so it connects too.
  • Kimi: the CLI's access token expires after ~15 min and the adapter previously just asked the user to rerun the CLI. The credentials file already ships a refresh_token, so renew in memory through the existing OAuth grant — nothing is written back to the CLI's file.
  • Antigravity: when no language server is running (e.g. users of the agy CLI only), fall back to agy -p "/usage" --output-format json --print-timeout 60s with a 75s process timeout, and retry once after ~8s since concurrent agy pollers can collide on a cold-start 503.

Testing

  • swift build clean (only pre-existing warnings)
  • Manually verified on a real account on macOS: dock now reports Cursor 18%, Grok Bot 36%, Kimi 2%, Antigravity 16% — previously all "Not connected"
  • swift test — all adapter suites pass. One unrelated pre-existing failure: the CursorSyncStatus localization tests expect English strings and fail on a zh-CN system locale (reproduces on unmodified main)

Notes

  • Cursor token is used in memory only — never copied into CodeBurn's keychain or support dir; subprocess output is sanitized before logging.
  • No new dependencies, no schema changes.
  • Devs & docs: not run (menubar-only change)

The quota adapter only consulted the Cursor IDE's state.vscdb, so users
who only run the cursor-agent CLI (no IDE installed) always showed
Not connected. The CLI stores the same WorkOS session JWT in the login
keychain as cursor-access-token/cursor-user; read it there as a
fallback, preferring /usr/bin/security because the agent-created item's
ACL lets Apple's signed binary read it silently, while
SecItemCopyMatching from the menu-bar app raises an interactive prompt.
Kimi access tokens live ~15 minutes and the adapter only read the file's
access_token, so the dock showed a permanent login-expired row unless
the user happened to run the Kimi CLI within the window. The credential
file already carries a refresh_token; exchange it at the same endpoint
the CLI uses (auth.kimi.com/api/oauth/token) and keep the renewed token
in memory only — the CLI's credential file is never written to.
The probe only found the quota endpoints on a live language server, so
users who only drive Antigravity through the agy CLI read Not connected
between sessions. When no candidate answers, run the CLI's own
/usage --output-format json path (it boots a throwaway server
internally) and parse the same group/bucket shape; one spaced retry
covers the throwaway server's 503 cold start when other pollers run
concurrently.
@yishu-ziyu
yishu-ziyu requested a review from iamtoruk as a code owner October 13, 2026 10:10
@ozymandiashh ozymandiashh added area: capacity-dock The Capacity Dock surface area: menubar The macOS menubar app enhancement New feature or request needs-validation PR requires validation against real-world usage before review provider: antigravity Antigravity provider provider: cursor Cursor editor provider (dashboard usage and billing) labels Oct 13, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: capacity-dock The Capacity Dock surface area: menubar The macOS menubar app enhancement New feature or request needs-validation PR requires validation against real-world usage before review provider: antigravity Antigravity provider provider: cursor Cursor editor provider (dashboard usage and billing)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants