Repository navigation
fix(app-session): reconnect from the active Grok Bot account on Windows (descriptor absent, app version header) - #152
Draft
trippjak wants to merge 1 commit into
Conversation
Grok Bot 0.70.x on Windows no longer leaves gateway-descriptor.json on disk once the cloud computer has been parked, so every gbot command fell back to files mode with "Could not find a Grok Bot agents directory" while desktop-status.json still said signedIn: true. When the descriptor is absent, decrypt only the active account's access token from sand-secrets.json (DPAPI-wrapped Safe Storage key on Windows, keychain or basic_text elsewhere) and call EnsureSandBox for a fresh route. The cached descriptor, GROK_BOT_GATEWAY_URL/TOKEN and CURSOR_ACCESS_TOKEN keep precedence. EnsureSandBox rejects the fixed x-cursor-client-version 0.20.0 as an outdated client, so send the installed app version read from the app's own desktop-status.json on every platform, falling back to the macOS Info.plist. SAND_CLIENT_VERSION still overrides. Also reads version 3 descriptors (same entries layout as version 2) and reports active-account credentials in gbot doctor. Reuses the reconnect implementation from ScriptedAlchemy#145 by Tomer Ben David; adds the desktop-status.json version source, the appData option on the credential reader, and Windows fixture tests. Verified on Windows 11 with Grok Bot 0.70.2: artifact/bin/gbot.mjs bots list --json returns the roster with no env overrides. Co-authored-by: Tomer Ben David <tomer-ben-david@users.noreply.github.com> Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 0f29266 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Tested this branch on macOS (Apple Silicon, Grok Bot desktop 0.70.2, Node 22.23), built from source:
Separately, sends report |
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.
Context
Fixes #147 on Windows, and carries #143 (descriptor v3). Builds on #145 by @tomer-ben-david, whose active-account reconnect is reused here with credit; this PR adds what was missing for it to work on Windows and adds Windows test coverage.
Since the October desktop update, Grok Bot 0.70.x on Windows no longer leaves
%APPDATA%\Grok Bot\gateway-descriptor.jsonon disk once the cloud computer has been parked (see the analysis in #147).hasGrokBotGatewaySession()then returns false and every command falls back to files mode withCould not find a Grok Bot agents directory, even thoughdesktop-status.jsonsayssignedIn: true.What is on disk instead (key names only; no secret values were read or printed):
sand-secrets.jsonholdscursor-accounts, a JSON string withactiveand per-accountcursor-access-token/cursor-refresh-token/cursor-account-profile, each av10Safe Storage blob decryptable with the DPAPI-wrapped key fromLocal State. The box route itself is not persisted anywhere (leveldb andsand-client-persistenceblobs hold UI state only).Changes
sand-secrets.jsonand callEnsureSandBoxfor a fresh route. The cached descriptor is still preferred when present;GROK_BOT_GATEWAY_URL+GROK_BOT_GATEWAY_TOKENandCURSOR_ACCESS_TOKENkeep precedence.EnsureSandBoxreturned401 This version of Grok Bot is no longer supportedbecauseheaders.jssends a fixedx-cursor-client-version: 0.20.0, and fix: keep Grok Bot CLI connected when the desktop gateway route disappears #145 only reads the real version from the macOS app bundle.grokBotAppVersion()now readsappVersionfrom the app's owndesktop-status.json(written on macOS, Linux and Windows), falling back to the macOSInfo.plist.SAND_CLIENT_VERSIONstill overrides.appDataoption as the other Windows entry points, so Windows fixtures work without pokingenv.APPDATA.gbot doctorreports whether active account credentials are present.Tests
{ accessToken }with no team; missing Safe Storage key raisesMISSING_SAFE_STORAGE_KEY;desktop-status.jsonversion read on win32, invalid version rejected on linux.npm run typecheck,npm test,npm run build,npm run validate:artifactpass locally on Windows 11.Verification on a real machine
Windows 11, Grok Bot desktop 0.70.2 signed in, no
gateway-descriptor.json, noGROK_BOT_*/CURSOR_*/SAND_*env set:node artifact/bin/gbot.mjs bots list --jsonrender-failed: Could not find a Grok Bot agents directorynode artifact/bin/gbot.mjs doctorgateway auth: nogateway auth: present,Grok Bot active account credentials: presentNot verified here: macOS and Linux (no machine available). The
desktop-status.jsonpath was reported present on macOS in #147's comments.🤖 Generated with Claude Code