Skip to content

Read every Codex rate-limit bucket - #14630

Open
hkairalla wants to merge 1 commit into
omacom:quattrofrom
hkairalla:fix-codex-limit-buckets
Open

hkairalla wants to merge 1 commit into
omacom:quattrofrom
hkairalla:fix-codex-limit-buckets

Conversation

@hkairalla

@hkairalla hkairalla commented Oct 8, 2026 •

Copy link
Copy Markdown

Summary

Read every Codex metered limit from account/rateLimits/read instead of only the backward-compatible single-bucket rateLimits view.

The current collector ignores rateLimitsByLimitId, hiding model-specific quotas and producing empty limits for map-only responses. Ignoring plan metadata in the map can also cause an unnecessary account/read fallback.

  • Prefer valid multi-bucket responses, with fallback to the legacy view.
  • Keep general Codex limits first and label model-specific windows using the panel's existing title field.
  • Avoid duplicate quotas and preserve plan fallback and earned reset credits.

This builds on the RPC transport and account/read fixes already on quattro. No QML, Cursor/Grok reporting, or billing configuration changes are included.

OpenAI response documentation.

Verification

  • All 15 new RPC regressions pass, including map-only and legacy responses, multiple buckets, labels, optional metadata, plan fallback, and reset credits. The map-only case fails against unmodified upstream.
  • The existing Codex scanner and notification tests pass.
  • A live installed Codex CLI returns the account's weekly limit and plan successfully.
  • Final diff review found no additional issues; git diff --check HEAD^ HEAD is clean.
  • The full clean ./test/all run completed: CLI suite passes; shell suite has 2 failures across 323 files, with skipped checks in 25 files requiring desktop/session facilities. Both failures reproduce unchanged at upstream 50d687a1f27063513cf42e6f33c3a4fcb17c24ed under the same environment:
    • default-agent-test.sh: Grok opt-out migration expects the previous mise unuse argument form.
    • passwordless-grant-lifecycle-test.sh: companion package-hook fixture cannot invoke pre_remove (status 127 instead of 1).
    • No new failure is introduced by this patch. Graphical acceptance tests were not run; the manual nested-desktop visual check is documented below.

The clean run uses direct Python/Node binaries, separate fixture homes, both companion repositories, and no inherited XDG desktop paths or GTK platform theme:

env -u WAYLAND_DISPLAY -u HYPRLAND_INSTANCE_SIGNATURE -u DISPLAY \
  -u XDG_CONFIG_HOME -u XDG_CACHE_HOME -u XDG_DATA_HOME -u XDG_STATE_HOME \
  QT_QPA_PLATFORMTHEME= OMARCHY_PATH="$PWD" \
  OMARCHY_PKGS_PATH="$PWD/../omarchy-pkgs" \
  OMARCHY_ISO_PATH="$PWD/../omarchy-iso" \
  PATH="$PWD/bin:/usr/bin:/bin:/path/to/installed/node/bin" ./test/all

Baseline failures are documented rather than mixed into this focused fix.

Visual verification

Rendered the actual upstream Agents panel in an isolated nested Hyprland desktop with a fake app-server and separate HOME/XDG directories. Both versions receive the same legacy quota and two-bucket map: 25% general usage and 80% Other model usage. The candidate displays both meters with distinct labels, no overlap, and the existing intentional label elision/tooltip behavior.

Before: legacy bucket only After: both metered buckets
Before After

Fixture records and screenshot provenance. Screenshots live on a separate personal-fork branch and do not enlarge this PR's code diff.

@hkairalla
hkairalla marked this pull request as ready for review October 8, 2026 21:03
@greptile-apps

greptile-apps Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Summary

The Codex collector now reads rateLimitsByLimitId, falls back to rateLimits, and labels model-specific windows.

  • General Codex limits come first.
  • Plan fallback and earned reset credits are preserved.
  • Fifteen regression cases cover map-only responses, multiple buckets, labels, and fallback behavior.
  • No actionable issues were found. Tests were inspected but not run during this review.

Reviews (1) · Last reviewed commit: "Read every Codex rate-limit bucket" · Reviewed by Greptile

dhh added a commit that referenced this pull request Oct 15, 2026
The collector read only rateLimits, the app-server's backward-compatible single-bucket view, so a model's own quota in rateLimitsByLimitId never showed and a map-only answer showed no limits at all. Every bucket is read now, the general one first and untitled, and each other titled "<model> Session" or "<model> Weekly" so the panel shows it beside the general window of that span. A percentage or reset time that doesn't parse costs that window or field rather than the whole probe, and percentages are kept within 0..1.

Builds on #14630.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Harrison Kairalla <hkairalla@users.noreply.github.com>
@omarchybot omarchybot added the bug Something isn't working label Oct 16, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed at f19badb by Claude Opus 5.5, with Codex Medium as the second opinion. Nothing was run on a worker: this pull request competes with an older one, and the maintainer decides between them first.

The problem is real. The Codex app-server's account/rateLimits/read returns a rateLimitsByLimitId map beside the single-bucket rateLimits view, and quattro's collector reads only the latter, so a model-scoped allowance (such as a Codex-Spark bucket) never reaches the panel. The schema in codex-cli 0.162 marks rateLimits as always present, so the map-only cases in the new test guard against a response the server does not currently send.

It competes with #7725, opened 2026-08-22, which reads the same map, skips the bucket that duplicates the general view, and titles the rest the way the panel already expects. The older fix wins by default, and both reviewers agreed no defect in #7725 decides it the other way; it does need to be brought up to date with quattro, since GitHub reports it as conflicting.

One defect here, found by both reviewers from the source: bin/omarchy-agent-usage-codex:982 titles every window "<name or id> · <label>" once there is more than one bucket. Panel.qml on quattro uses an explicit title verbatim, and attaches a model's allowance to its general row only when the title reads <model> Session|Weekly|Monthly (scopedPart(), the convention omarchy-agent-usage-claude follows). So an account with a general bucket and one model bucket would show four separate meters, codex · 5h window, codex · Weekly (7-day) and so on, instead of two rows with the model's allowance attached, and those titles would also skip translation. The fix is to leave the general codex bucket untitled and title the others <limitName> Session or <limitName> Weekly, which the tests here would then need to expect.

Waiting on the maintainer to choose between this and #7725. Codex Medium agreed with the choice of #7725 and the title defect; its independence from this review is not guaranteed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants