Raise streaming session cap to 4GB so large Codex sessions are counted#569
Merged
Conversation
The 2GB stream cap silently dropped whole Codex session files over the limit, so a live 2.4GB session (about 308M tokens of real gpt-5.5 spend) was excluded and reported as zero. Raise MAX_STREAM_SESSION_FILE_BYTES to 4GB (the line-by-line reader is bounded-memory and handles multi-GB files), and surface any remaining oversize skip via an always-on notice instead of a verbose-gated warning so a dropped session is never silent. Adds a maxBytes option for testability and tests covering the cap boundary.
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.
Problem
The streaming session reader (
readSessionLines) had a 2GB hard cap (MAX_STREAM_SESSION_FILE_BYTES). Any file over it was dropped entirely, and the skip warning was gated behindCODEBURN_VERBOSE, so the drop was silent.A live Codex session reached 2.4GB (image-heavy compacted turns: ~46 events re-embedding ~2,600 inline base64 images), which is ~308M tokens of real gpt-5.5 spend. It was excluded from every report, so the menubar showed Codex as $0 / no tab for the day with no signal that anything was missing.
Fix
MAX_STREAM_SESSION_FILE_BYTES2GB -> 4GB. The reader is line-by-line and bounded-memory, so multi-GB files are safe; the cap is only a guard against pathological inputs.notice()instead of a verbose-gatedwarn(), so a dropped session is never silent.maxBytesoption toreadSessionLinesfor testability.Tests
Three new tests: under-cap files read normally, over-cap files are skipped and emit the notice without
CODEBURN_VERBOSE, and the cap constant is 4GB. Full fs-utils suite (17) and project typecheck pass.Follow-ups (not in this PR)
codex.tsreads the whole file on each scan (nostartByteOffset), so a live multi-GB session is re-read every refresh. Incremental reading is the recommended next step.codex-auto-reviewtokens into gpt-5.5 and prices them at gpt-5.5 rates, so MCP/menubar over-report Codex and disagree withoverview/export.