Skip to content

fix(codex): format status rate limits like usage#77815

Closed
MatthewSchleder wants to merge 2 commits into
openclaw:mainfrom
MatthewSchleder:fix/codex-status-rate-limit-wording
Closed

fix(codex): format status rate limits like usage#77815
MatthewSchleder wants to merge 2 commits into
openclaw:mainfrom
MatthewSchleder:fix/codex-status-rate-limit-wording

Conversation

@MatthewSchleder

@MatthewSchleder MatthewSchleder commented May 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Aligns /codex status rate-limit output with the main /status usage style.
  • Shows remaining quota instead of used quota, e.g. primary 74% left.
  • Replaces raw ISO reset timestamps in status summaries with compact reset durations, e.g. ⏱3h or ⏱7d.
  • Keeps the newer current-main /codex account availability and paused-limit summaries intact.
  • Adds a changelog entry for the user-facing /codex status output change.

Real behavior proof

  • Behavior addressed: /codex status rate-limit summaries now show remaining quota and compact reset durations instead of used quota and raw ISO timestamps.
  • Real environment tested: Local OpenClaw checkout on the rebased PR branch, running the real Codex status formatter through Node/tsx against an app-server-shaped status payload.
  • Exact steps or command run after the patch: node --import tsx -e "import { formatCodexStatus } from \"./extensions/codex/src/command-formatters.ts\"; const now=Math.floor(Date.now()/1000); console.log(formatCodexStatus({models:{ok:true,value:{models:[{id:\"gpt-5.5\",isDefault:true}],truncated:false}},account:{ok:true,value:{account:{email:\"codex@example.com\"}}},limits:{ok:true,value:{rateLimits:{limitId:\"codex\",limitName:\"Codex\",primary:{usedPercent:26,windowDurationMins:300,resetsAt:now+3*60*60},secondary:{usedPercent:4,windowDurationMins:7*24*60,resetsAt:now+7*24*60*60},credits:null,planType:\"pro\",rateLimitReachedType:null}}},mcps:{ok:true,value:{data:[{name:\"filesystem\"}]}},skills:{ok:true,value:{data:[{name:\"repo\"}]}}}));"
  • Evidence after fix: Terminal output from the formatter command:
Codex app-server: connected
Models: gpt-5.5
Account: codex@example.com
Rate limits: Codex: primary 74% left ⏱3h · secondary 96% left ⏱7d
MCP servers: 1
Skills: 1
  • Observed result after fix: The status line reports primary 74% left ⏱3h · secondary 96% left ⏱7d, matching the intended remaining-quota and compact-reset wording.
  • What was not tested: Full live /codex status chat round trip was not run locally; GitHub workflows will validate the rebased branch.

Verification

  • git diff --check
  • node_modules/.bin/oxfmt --check --threads=1 extensions/codex/src/app-server/rate-limits.ts extensions/codex/src/commands.test.ts CHANGELOG.md
  • Formatter proof command above

Notes

  • Not run locally: Vitest. GitHub workflows will validate the rebased branch.

@openclaw-barnacle openclaw-barnacle Bot added extensions: codex triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. triage: refactor-only Candidate: refactor/cleanup-only PR without maintainer context. size: S labels May 5, 2026
@clawsweeper

clawsweeper Bot commented May 5, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

Summary
The PR changes the Codex app-server rate-limit formatter, one /codex command expectation, and the changelog so /codex status shows remaining quota and compact reset durations.

Reproducibility: yes. source-reproducible: current main still formats Codex rate-limit windows as used percent with verbose reset text, while the existing status/usage contract uses normalized % left output. I did not run local tests because this review was read-only.

Real behavior proof
Sufficient (terminal): The PR body includes after-fix terminal output from running the changed formatter through Node/tsx and showing the new remaining-quota rate-limit line.

Next step before merge
No automated repair is needed; the maintainer action is ordinary review, waiting for relevant CI, and a merge decision for the focused contributor PR.

Security
Cleared: The diff is limited to a TypeScript formatter, one command test expectation, and changelog text, with no workflow, dependency, script, secret, or package-resolution changes.

Review details

Best possible solution:

Review and merge the plugin-local formatter change after relevant CI completes, keeping the output logic inside the Codex plugin and preserving the focused command expectation.

Do we have a high-confidence way to reproduce the issue?

Yes, source-reproducible: current main still formats Codex rate-limit windows as used percent with verbose reset text, while the existing status/usage contract uses normalized % left output. I did not run local tests because this review was read-only.

Is this the best way to solve the issue?

Yes: changing the Codex-owned rate-limit formatter and its command expectation is the narrow maintainable fix for this output-only mismatch. A core usage formatter import would cross plugin boundaries and is not needed for this small alignment.

What I checked:

  • Current main still has old Codex formatter output: Current main formats each Codex rate-limit window as raw used percent and appends verbose reset text via formatResetTime, so the PR is not already implemented on main. (extensions/codex/src/app-server/rate-limits.ts:333, 730cbb356feb)
  • Shared usage formatter target pattern: The shared provider usage formatter already presents remaining quota as <label> <remaining>% left, optional compact reset suffixes, and middle-dot window separators. (src/infra/provider-usage.format.ts:61, 730cbb356feb)
  • Docs define normalized usage display: The status docs say --usage prints normalized provider usage windows as X% left, and slash-command docs describe status provider usage as normalized % left. Public docs: docs/cli/status.md. (docs/cli/status.md:23, 730cbb356feb)
  • PR diff matches the requested formatter surface: The PR changes the Codex-owned rate-limit summary to compute remaining percent, use compact reset durations, join windows with ·, and update the focused command expectation. (extensions/codex/src/app-server/rate-limits.ts:332, 557d52ddc4e1)
  • Changelog coverage is included: The second PR commit adds a user-facing changelog bullet for the /codex status rate-limit wording change. (CHANGELOG.md:13, c9e900a9b1da)
  • After-fix terminal proof is present: The live PR body includes terminal output from running formatCodexStatus through Node/tsx against a representative app-server-shaped payload, showing primary 74% left ⏱3h · secondary 96% left ⏱7d. (c9e900a9b1da)

Likely related people:

  • steipete: Recent GitHub path history shows steipete on multiple Codex command/rate-limit maintenance commits, and the shared provider usage formatter history points to steipete's formatter/refactor work. (role: recent area contributor / adjacent owner; confidence: high; commits: 6ee0c9a69654, 3f05165c47d7, dc0ebdfef8ab; files: extensions/codex/src/app-server/rate-limits.ts, extensions/codex/src/commands.test.ts, src/infra/provider-usage.format.ts)
  • pashpashpash: GitHub path history shows pashpashpash authored recent Codex rate-limit reset/account summary changes that created much of the surrounding behavior this formatter uses. (role: Codex rate-limit feature contributor; confidence: medium; commits: b2c3202a15e7, c3af812fe3de, 30ed0329cbc3; files: extensions/codex/src/app-server/rate-limits.ts, extensions/codex/src/commands.test.ts)

Remaining risk / open question:

  • Several broad CI jobs for the PR head were still queued at review time, so merge should wait for the relevant checks to finish.
  • The supplied proof exercises the real formatter with a representative app-server payload rather than a full live /codex status chat round trip; that is acceptable for this formatter-only diff but leaves E2E coverage to CI or maintainer judgment.

Codex review notes: model gpt-5.5, reasoning high; reviewed against 730cbb356feb.

@MatthewSchleder MatthewSchleder force-pushed the fix/codex-status-rate-limit-wording branch from 1a118f7 to 3c9e1f5 Compare May 5, 2026 15:25
@MatthewSchleder MatthewSchleder force-pushed the fix/codex-status-rate-limit-wording branch 2 times, most recently from b0a849c to a2c521a Compare May 12, 2026 14:58
@openclaw-barnacle openclaw-barnacle Bot added proof: supplied External PR includes structured after-fix real behavior proof. and removed triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 12, 2026
@MatthewSchleder MatthewSchleder force-pushed the fix/codex-status-rate-limit-wording branch 2 times, most recently from 8748a42 to e57c22b Compare May 12, 2026 15:09
@MatthewSchleder MatthewSchleder force-pushed the fix/codex-status-rate-limit-wording branch from e57c22b to c9e900a Compare May 12, 2026 15:13
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 12, 2026
@MatthewSchleder

Copy link
Copy Markdown
Contributor Author

Closing this superseded PR in favor of the fresh replacement: #81149

The replacement keeps the same formatter change, summary, proof, and verification, but is back at the top of the PR queue.

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

Labels

extensions: codex proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: supplied External PR includes structured after-fix real behavior proof. size: XS triage: refactor-only Candidate: refactor/cleanup-only PR without maintainer context.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants