feat(desktop): configure Codex quota display

VI
4h ago
+654-8

What & why

Codex usage in the session header had a fixed 70% threshold. In Settings → Usage, users can now choose where it appears.

  • Session header shows usage for the account bound to the session. The default threshold is 70%, and a value from 1% to 100% can be set. Turning the threshold off shows any available percentage, including 0%.
  • Codex button opens the scripts bar and shows the workspace host's default Codex account. The button prefers the weekly window. Its context menu shows current windows, reset times, and a link to the corresponding usage settings.

This PR builds on the Codex quota display from #10059 by letting users choose the display location and configure the session-header threshold.

How I tested it

In an isolated macOS dev profile, I used CDP mouse and keyboard input with synthetic quota and session-binding data. At 50% usage, the session header was hidden at the default threshold and appeared when I changed the threshold to 50%. With the threshold switched off, the header showed 0%, and the setting survived a renderer reload. I switched to the Codex button, verified the two quota windows and reset times in its context menu, and followed View usage to the workspace account.

Codex usage settings

Session headerCodex button
50% in the Codex session header50% weekly usage on the Codex button

Codex context menu with quota windows and reset times

  • bun run lint, bun run typecheck, and bun run check:i18n passed.
  • All 9,124 desktop tests passed.
  • bun run test --continue=always passed 29 of 32 package tasks. Failures were in the host-service Git status batching test, the port scanner process environment test, and the shared recurrence timezone test.

Codex assisted with implementation and verification.

Checklist

  • PR title follows conventional commits (type(scope): subject)
  • bun run lint and bun run typecheck pass
  • Allow edits from maintainers is enabled
  • I have signed the CLA

Summary by cubic

Makes Codex quota display configurable in Settings → Usage. Users can now choose whether usage appears in the session header or on the Codex button in the preset bar, replacing the session header's fixed 70% threshold.

Session header

  • Shows usage for the account bound to the session, with a configurable 1–100% threshold. Turning the threshold off shows any percentage, including 0%.
  • Quota windows that have already reset are ignored when selecting the tightest usage.

Codex button

  • Shows the workspace host's default Codex account, preferring the weekly window.
  • Its context menu lists quota windows with reset times and a link to the usage settings.
  • Choosing this option in Settings enables the presets bar if it's hidden.

Summary by CodeRabbit

  • New Features
    • Choose whether Codex usage appears in the session header or on the Codex button.
    • Set a threshold to control when the session usage indicator appears.
    • View Codex quota details from presets, including usage percentages and account status, with a shortcut to usage settings.
  • Bug Fixes
    • Improved Codex quota handling when usage windows expire, including when a weekly quota remains available.
  • Localization
    • Added translations for the new Codex usage settings and labels across supported languages.