t3code icon indicating copy to clipboard operation
t3code copied to clipboard

[Bug]: Usage → Limits shows an offline environment's expired Codex reading as current ("resets now")

Open scwlkr opened this issue 3 days ago • 2 comments

Before submitting

  • [x] I searched existing issues and did not find a duplicate.
  • [x] I included enough detail to reproduce or investigate the problem.

Area

apps/web (Usage → Limits)

Steps to reproduce

  1. Link a second environment that uses the same ChatGPT account for Codex, and let it report Codex limits once.
  2. Take that environment offline (machine asleep or off). In T3 it shows as unreachable.
  3. On the local environment, have Codex report no limits. One way is #35186: any non-OpenAI openai_base_url makes the local snapshot unavailable: unsupported.
  4. Wait until the weekly window that the offline environment last saw has reset.
  5. Open Usage → Limits with "All environments".

Expected behavior

Either the offline environment's reading is hidden, or it is clearly marked as old (for example "last seen 2 days ago"). A window whose resetsAt is in the past should not be shown as current usage. It has reset, so its usedPercent no longer applies.

Actual behavior

The Codex card shows the offline environment's last reading as if it were live: "Weekly 49% left", with the reset label "resets now". That reading is two days old and comes from before the weekly reset. The real value from account/rateLimits/read at the same moment was 72% left, resetting in five days. Nothing on the card says the number is old or comes from a machine that is offline.

Impact

Users get a wrong remaining-quota number and have no way to tell it is wrong. "resets now" stays on the card indefinitely.

Version or commit

T3 Code desktop 0.1.14-nightly.20261128.5399 (macOS)

Environment

macOS, codex-cli 0.172.0, ChatGPT Pro login, two linked environments, both unreachable.

Logs or stack traces

Local caches/codex.json: "usageLimits": {"windows": [], "unavailable": {"reason": "unsupported"}}. The remote snapshot's weekly window has resetsAt about 1 day in the past.

Workaround

None in the UI. Compare against the Codex app or account/rateLimits/read.

scwlkr avatar Nov 28 '26 18:11 scwlkr

I tried to reproduce this on the current build and could not.

No real-app run: the report's step 1 needs a linked environment that received a real Codex usage-limits reading through a ChatGPT OAuth login, and no worker has ChatGPT OAuth (no CLIProxy hub usage source with a management key is configured on the VM either). I did not fake the reading with a hand-made cache, since that would be invented provider data. Instead, on origin/main 263d3488fd, I added a unit test to packages/shared/src/usageLimits.test.ts that feeds collectLimitAccounts + collectLimitPools exactly the reporter's state: environment 'local' with Codex usageLimits {windows: [], unavailable: {reason: 'unsupported'}}, and environment 'offline' with the same Codex account whose last snapshot (checkedAt 2 days before now) has a weekly window usedPercent 51, resetsAt 1 day before now. On main the pooled Codex weekly window comes out usedPercent 51 / remainingPercent 49, and its resets list holds a reset whose time is already in the past. resetCountdown maps that past time to {kind: 'now'}, which is where 'resets now' comes from. Command: vp test run src/usageLimits.test.ts -t "offline environment" in packages/shared fails with 1 failed.

Closing as not planned. If it still happens for you, reply with the exact steps and the version you are on and it will be looked at again.

juliusmarminge avatar Nov 28 '26 18:11 juliusmarminge

Still happens for me with Claude, in the real app: T3 Code 0.1.13 (Linux server), Android app and desktop.

  1. Use Claude in T3 until the 5-hour session has some usage (mine was at 44%).
  2. Let the session reset time pass.
  3. Open Usage → Limits.

T3 shows "Session 56% left · resets now", which is the reading from before the reset. Claude's own app at the same moment shows the session at 0% used ("Starts with your first message"). The weekly row matched (66% used in both). Six minutes later the server's cached reading had five_hour at 2% with a new resetsAt, so only the window between the reset and the next read is wrong.

Screenshot_2026-11-29-12-44-08-134_com.t3tools.t3code.jpg

Screenshot_2026-11-29-12-44-17-078_com.anthropic.claude.jpg

In the code, poolWindows in packages/shared/src/usageLimits.ts still averages usedPercent for a window whose resetsAt has passed, and resetCountdown turns that time into "resets now".

umi008 avatar Nov 29 '26 18:11 umi008