Skip to content

fix: read Grok usage from grok.com pages (0.4.4) - #13

Merged
cursor[bot] merged 2 commits into
mainfrom
cursor/grok-page-probe-e08a
Aug 26, 2026
Merged

cursor[bot] merged 2 commits into
mainfrom
cursor/grok-page-probe-e08a

Conversation

@TiantianFlow

@TiantianFlow TiantianFlow commented Aug 26, 2026 •

Copy link
Copy Markdown
Owner

Summary

Grok usage in the sidebar failed on ~v0.4.2 because the background worker fetch to grok.com is blocked by Cloudflare (403 HTML when Origin is not grok.com), and the previous page-inject helper crashed on executeScript returning null. This PR reads session, usage, subscriptions, and rate-limits from a logged-in grok.com tab in the MAIN world instead, and treats omitted SuperGrok credit_usage_percent as 0% of the weekly pool.

Release version is 0.4.4.

What changed

  • New Grok page-session package: origin-isolated injects, two-step MAIN-world stash, no background grok.com fallback.
  • page-probe: health messages when inject fails; empty vs throw are named separately.
  • SuperGrok omitted credit_usage_percent with a valid period → usedRatio: 0 (weekly pool still preferred).
  • Connect / Refresh request scripting + https://grok.com/*. Interactive refresh may open an inactive grok.com tab; scheduled refresh only injects existing tabs.
  • Existing Grok connections become permission-required until the user reconnects.

Tests

  • Unit coverage for origin isolation, self-contained inject source, null/empty/throw injects, two-step stash, no background fallback, scheduled vs interactive owned-tab, omitted percent → 0% weekly pool.
  • pnpm test:run, typecheck, and pnpm build passed locally.
  • Live grok.com SuperGrok (including 0% week) was not verified in this environment.

Closes #9.

Open in Web Open in Cursor 

Cloudflare 403s extension-background grok.com requests. Inject
self-contained MAIN-world fetches, use a two-step stash, and surface
page-probe errors instead of falling back to the worker. Treat an
omitted SuperGrok credit_usage_percent as 0% used.

Co-authored-by: wjcjttl9 <wjcjttl9@gmail.com>
@TiantianFlow
TiantianFlow marked this pull request as ready for review August 26, 2026 02:51
Patch release for the Grok page-probe usage fix.

Co-authored-by: wjcjttl9 <wjcjttl9@gmail.com>
@cursor cursor Bot changed the title fix: read Grok usage from grok.com pages instead of background fetch fix: read Grok usage from grok.com pages (0.4.4) Aug 26, 2026
@cursor
cursor Bot merged commit 11f782f into main Aug 26, 2026
2 checks passed
@cursor

cursor Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Thanks @catfish-xn — the report on #9 and the diagnosis were a huge help. Cloudflare 403 on the background fetch, executeScript serializing only function source, and SuperGrok omitting credit_usage_percent at 0% were all on target.

Merged as 0.4.4. GitHub closed #9 automatically via Closes #9.

After updating, please reconnect Grok so the extension can request scripting and https://grok.com/*. Keep a logged-in grok.com tab around (or use Refresh, which can open one). Existing Grok connections stay permission-required until you reconnect.

If anything still fails on 0.4.4 after reconnect, comment on #9 and we can reopen.

感谢你把原因和复现写得这么清楚。

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.

Grok 无法读取用量:页面注入崩溃后,后台 session 被 403 HTML 拦截

2 participants