Repository navigation
fix(quota): unwrap the Cursor safe-storage token for Grok Bot quota - #1926
Merged
Merged
Conversation
Cursor 3.27+ stores its session as cursor-safe-storage:v1 ciphertext. The Grok Bot reader sent that blob as the bearer, so every request got a 401 and asked the user to sign in again. It now unlocks the token the way the Cursor reader does, under the same keychain consent rule, and reports a locked keychain with the Cursor locked message. In codeburn quota both readers share one keychain read, so one prompt covers both. The menu bar Grok Bot service uses CursorSafeStorage.unlock like its Cursor service. Fixes #1924
…and Grok Bot A user refresh unlocked the Cursor session twice, once for Cursor and once for Grok Bot, so it could prompt twice. An allowed read now reuses the previous allowed read's answer for 30 seconds, a Deny included. Background reads are unchanged.
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.
Closes #1924. Thanks @ramonmnavarro-byte.
Cursor 3.27 and newer store the login token wrapped as
cursor-safe-storage:v1:<base64>. The Cursor quota reader decrypts it; the Grok Bot quota reader sent the wrapped value as the Bearer token, so Cursor answered 401 and Grok Bot quota always showed "sign in again".CLI
fetchGrokbotQuotaunwraps the token with the same helpers as the Cursor reader. A locked or denied Keychain returns Cursor's locked message; a plain token is unchanged.codeburn quotarun serves both Cursor and Grok Bot, scoped to the run, so there is one prompt, not two, and Grok Bot never prompts where Cursor would not.Menubar
Not in this PR
Tests: CLI tests for wrapped-plus-unlocked, wrapped-plus-locked, plain token and one shared read per run; Swift tests with a counting fake Keychain for the unlocked request, the locked error, and one read for Cursor then Grok Bot, including Deny. tsc clean, vitest 76/76 on the quota files, build OK. Swift compiles on CI.