Repository navigation
Show Codex's 5-hour and 7-day limits under Claude's when Codex subagents are on - #125
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
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.
Summary
The sidebar showed Claude's 5-hour and 7-day limits but not Codex's, so someone running Codex subagents had to open Codex to see how much of its plan was left.
With Settings → Custom subagents → Codex on, the sidebar footer now has a second row, CODEX 5 HOUR and CODEX 7 DAY, under Claude's. Claudiu reads the numbers from the
token_countevents Codex writes to its session logs in$CODEX_HOME/sessions(default~/.codex). It looks at the three most recently written logs in the last three day folders, because Codex files a log under the day its session started. The bars are blue until they reach the warning threshold, then turn yellow and red like Claude's. A window whose reset time has passed shows as reset. When nothing parses, the row stays hidden.The logs can be close to 1 MiB, so they are read again only when a log's write time or size changes. Each log is stat'ed directly, because on Windows a folder listing can report an old time while Codex holds the log open. A log that fails to open is tried again on the next tick and is not cached as "no reading".
Codex limits live only in memory. The tests point
CODEX_HOMEat a throwaway folder, so they never read the real~/.codex.Evidence
cargo clippy --locked --all-targets -- -D warningsis clean, andcargo test --lockedpasses 506 tests.codex_limitstests cover reading both windows, skipping a later event withrate_limits: null, ignoring other windows and buckets, a session started on an earlier day, the cache, a log still open for writing, and a log locked by its writer. Setting the day lookback to one folder fails the earlier-day test. Caching failed reads fails the locked-log test.~/.codex.Risk
The log format belongs to Codex and isn't documented. If it changes, the row disappears and nothing else breaks. Reverting the branch's commits removes the feature.