Skip to content

fix(status-bar): sync Codex rate-limit chip with remaining reset time (#8378)#9004

Merged
nwparker merged 1 commit into
mainfrom
nwparker/fix-8378-codex-reset-time
Jul 17, 2026
Merged

fix(status-bar): sync Codex rate-limit chip with remaining reset time (#8378)#9004
nwparker merged 1 commit into
mainfrom
nwparker/fix-8378-codex-reset-time

Conversation

@nwparker

Copy link
Copy Markdown
Contributor

Summary

Status-bar rate-limit chips now show remaining time until reset when resetsAt is known (e.g. 2h 33m), matching the usage popup countdown. Fixed window labels (5h, wk) remain only as a fallback when no reset timestamp is available.

Fixes #8378

Description

Codex (and other providers) exposed a mismatch between:

  • Usage popup: formatResetCountdown → “Resets in 2h 33m”
  • Status-bar chip: formatWindowLabel(windowMinutes) → “5h” (full window size)

Both surfaces now share remaining-time semantics via formatResetDuration when resetsAt is present. Chip copy stays compact (2h 33m); the popup still prefixes with “Resets in …”.

Evidence

  • Repro unit test: chip with windowMinutes: 300 and resetsAt = now + 2h33m renders 42% used 2h 33m, not 5h.
  • Formatter unit test pins chip duration = formatResetDuration and popup = Resets in 2h 33m for the same delta.
  • Fallback preserved: resetsAt: null still yields 5h / wk / 30d.
pnpm exec vitest run --config config/vitest.config.ts \
  src/renderer/src/lib/window-label-formatter.test.ts \
  src/renderer/src/components/status-bar/provider-segment-monthly-window.test.tsx \
  src/shared/rate-limit-reset-format.test.ts \
  src/renderer/src/components/status-bar/tooltip.test.ts
# Test Files  4 passed (4)
# Tests  61 passed (61)

ELI5

The little number in the bottom bar said “this window is 5 hours long,” while the popup said “you have 2 hours 33 minutes left.” They now both talk about time left.

User-regression-tradeoffs

Ideally zero: users already expected remaining time (popup was correct; chip was wrong).
Possible mild surprise only if someone relied on the chip as a static window-size badge (5h/wk); that fallback still appears when the API omits resetsAt. Chip labels can be slightly longer (2h 33m vs 5h).

Screenshots

No new UI chrome — text change on existing status-bar usage chips (remaining duration instead of fixed window size when reset time is known).

Testing

  • Added/updated unit tests (formatter + ProviderSegment repro-8378)
  • vitest for rate-limit label / status-bar segment / tooltip suites
  • pnpm lint (not run full suite)
  • pnpm typecheck
  • pnpm test (full suite)
  • pnpm build

AI Review Report

Checked that:

  • Chip and popup share formatResetDuration / formatResetCountdown from the same remaining-ms input.
  • Fallback path for missing resetsAt still uses fixed window labels.
  • Fable continues to use the product name label (not a time label).
  • Pure formatting only — no platform-specific shortcuts, paths, shell, or Electron APIs. Safe on macOS/Linux/Windows.

Security Audit

Display-only change: formats existing numeric timestamps for UI. No new IPC, auth, secrets, command execution, or path handling.

Notes

Countdown updates on re-render (same as the popup), not a live 1s ticker. Session/weekly/monthly chips all prefer remaining time when resetsAt is set.

Prefer formatResetDuration when resetsAt is known so the status-bar chip
matches the usage popup countdown instead of the fixed window size.
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 7d9f7d80-2735-4394-ae0b-5121d7a28be9

📥 Commits

Reviewing files that changed from the base of the PR and between cf02cc4 and c9f02d0.

📒 Files selected for processing (4)
  • src/renderer/src/components/status-bar/StatusBar.tsx
  • src/renderer/src/components/status-bar/provider-segment-monthly-window.test.tsx
  • src/renderer/src/lib/window-label-formatter.test.ts
  • src/renderer/src/lib/window-label-formatter.ts

📝 Walkthrough

Walkthrough

The status bar now uses a reset-aware formatter for session, weekly, and monthly rate-limit chips. The formatter displays remaining duration when a reset timestamp exists, falls back to the fixed window size when it does not, and reports expired windows as “now.” Tests cover formatter behavior and status-bar rendering with reset timestamps.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the status-bar reset-time fix and references the linked issue.
Description check ✅ Passed The description includes all required template sections and gives a clear summary, testing notes, review, security, and notes.
Linked Issues check ✅ Passed The changes match #8378 by making status-bar chips show remaining reset time when available, matching the popup.
Out of Scope Changes check ✅ Passed The PR stays focused on the reset-time label fix and related regression tests, with no unrelated code changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nwparker

Copy link
Copy Markdown
Contributor Author

Agent handoff

Fixes: #8378

Reproduce (before / regression after merge)

Branch with kits: nwparker/bug-repro-handoffs

Full issue kit (summary + re-run + file links): see the Agent handoff — reproduction kit comment on #8378.

Writeup: https://github.com/stablyai/orca/blob/nwparker/bug-repro-handoffs/docs/bug-reproductions/8378.md

This PR

Already includes Description / Evidence / ELI5 / User-regression-tradeoffs in the body. Review that section first; re-run the issue's repro-* test after pulling this branch to confirm the fix.

@nwparker
nwparker merged commit a279ece into main Jul 17, 2026
2 checks passed
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.

[Bug]: Codex Session reset time mismatch between popup and bottom status bar

1 participant