Repository navigation
Menubar: quota adapters for CLI-only installs (Cursor keychain, Kimi refresh, agy fallback) - #1755
Open
yishu-ziyu wants to merge 3 commits into
Open
yishu-ziyu wants to merge 3 commits into
yishu-ziyu wants to merge 3 commits into
Conversation
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.
This branch has not been deployed
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.
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-agentCLI users often have no Cursor IDE installed, sostate.vscdbdoesn't exist. Fall back to the CLI's login-keychain item (cursor-access-token/cursor-user), read via the Apple-signed/usr/bin/securitytool first (no entitlement prompt, 5s timeout), withSecItemCopyMatchingas fallback. Grok Bot rides on the same session, so it connects too.refresh_token, so renew in memory through the existing OAuth grant — nothing is written back to the CLI's file.agyCLI only), fall back toagy -p "/usage" --output-format json --print-timeout 60swith a 75s process timeout, and retry once after ~8s since concurrentagypollers can collide on a cold-start 503.Testing
swift buildclean (only pre-existing warnings)swift test— all adapter suites pass. One unrelated pre-existing failure: theCursorSyncStatuslocalization tests expect English strings and fail on a zh-CN system locale (reproduces on unmodifiedmain)Notes