Skip to content

Show Codex's 5-hour and 7-day limits under Claude's when Codex subagents are on - #125

Merged
m4rocks merged 3 commits into
mainfrom
codex-usage-limits
Nov 18, 2026
Merged

m4rocks merged 3 commits into
mainfrom
codex-usage-limits

Conversation

@m4rocks

@m4rocks m4rocks commented Nov 18, 2026

Copy link
Copy Markdown
Owner

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_count events 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_HOME at a throwaway folder, so they never read the real ~/.codex.

Evidence

  • cargo clippy --locked --all-targets -- -D warnings is clean, and cargo test --locked passes 506 tests.
  • The codex_limits tests cover reading both windows, skipping a later event with rate_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.
  • A headless test checks that the Codex meters are drawn only with Codex subagents on. It fails without that check.
  • With a throwaway data folder and Codex on, the built app showed CODEX 5 HOUR 31% and CODEX 7 DAY 20% in blue, read from a real ~/.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.

@vercel

vercel Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
claudiu Ready Ready Preview Nov 18, 2026 9:19am UTC

@m4rocks
m4rocks merged commit c578c23 into main Nov 18, 2026
5 checks passed
@m4rocks
m4rocks deleted the codex-usage-limits branch November 18, 2026 09:30

This branch was successfully deployed

1 active deployment
Preview — 46006dcc Deployed Nov 18, 2026 by vercel[bot]
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.

1 participant