Skip to content

[codex] Reduce OpenAI dashboard scrape payload#1034

Closed
jb510 wants to merge 1 commit into
steipete:mainfrom
jb510:perf/openai-web-scrape-payload
Closed

[codex] Reduce OpenAI dashboard scrape payload#1034
jb510 wants to merge 1 commit into
steipete:mainfrom
jb510:perf/openai-web-scrape-payload

Conversation

@jb510
Copy link
Copy Markdown
Contributor

@jb510 jb510 commented May 18, 2026

Summary

  • Extract OpenAI auth status, signed-in email, and account plan inside the WebView scrape script.
  • Stop returning full document.documentElement.outerHTML during normal OpenAI dashboard polling.
  • Fetch full HTML only when debugDumpHTML is enabled for diagnostic failure paths.
  • Add WebKit coverage proving the scrape returns structured account fields and omits bodyHTML.

Closes #1033.

Why

Sampling a high-CPU CodexBar refresh showed the OpenAI web path spending time serializing/parsing full dashboard HTML and reparsing embedded bootstrap JSON in Swift. The normal refresh path only needs a few structured values from that HTML, so returning the full DOM on every poll is avoidable work.

Testing

  • swift test --filter OpenAIDashboardScrapeScriptTests
  • swift test --filter OpenAIDashboardFetcherCreditsWaitTests
  • swift test --filter OpenAIDashboardParserTests
  • make check
  • CODEXBAR_SIGNING=adhoc CODEXBAR_WIDGET_METADATA_MODE=skip ./Scripts/package_app.sh release

Full Suite Note

swift test was run and reached 2722 tests, but reported 2 failures outside this change area:

  • MistralUsageParserTests.swift:115: expected month 11, observed 10
  • ProviderStorageFootprintTests.swift:401: expected generation 41, observed 42

The OpenAI web-focused tests passed after the scrape-payload change.

Local Test Status

Built and installed locally for manual validation from branch perf/openai-web-scrape-payload.

@jb510 jb510 marked this pull request as ready for review May 18, 2026 18:02
@steipete
Copy link
Copy Markdown
Owner

Thanks @jb510, landed this on main as ff1a169c with the maintainer changelog in 5aca0cd6.

I could not update the contributor branch directly, so I rebased and landed the reviewed patch from a maintainer branch while preserving the original commit author. Local proof before landing:

  • swift test --filter OpenAIDashboardScrapeScriptTests
  • swift test --filter OpenAIDashboardFetcherCreditsWaitTests
  • swift test --filter OpenAIDashboardParserTests
  • make check
  • Codex review clean

@steipete steipete closed this May 20, 2026
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.

OpenAI web refresh uses high CPU while scraping full dashboard HTML

2 participants