Skip to content

fix(daemon): restore Codex usage synchronization - #295

Merged
AnnatarHe merged 1 commit into
mainfrom
agent/fix-codex-usage-tracking
Jul 31, 2026
Merged

fix(daemon): restore Codex usage synchronization#295
AnnatarHe merged 1 commit into
mainfrom
agent/fix-codex-usage-tracking

Conversation

@AnnatarHe

@AnnatarHe AnnatarHe commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Summary

  • parse the current Codex additional_rate_limits array while retaining legacy map compatibility
  • send the ChatGPT account header and synchronize v2 dynamic windows, names, and credits
  • document quota polling separately from OTEL telemetry and remove the hardcoded five-hour assumption

Why

Usage synchronization stopped matching the live WHAM response shape. The response is now an array of named limits, can omit windows, and returns credits separately; account-scoped requests also need the account ID header.

Impact

The daemon performs an immediate poll and then polls every ten minutes, forwarding exactly the windows and credit state returned by Codex. No five-hour window is synthesized.

Rollout

  1. Server contract and persistence: https://github.com/shelltime/server/pull/457
  2. CLI collection and synchronization (this PR)
  3. Web rendering: https://github.com/shelltime/web/pull/576

Validation

  • focused Codex rate-limit and synchronization tests pass
  • git diff --check passes

The full command suite still has pre-existing home-isolation failures. The installed Go toolchain lacks covdata, and go vet retains an existing context.WithTimeout cancellation warning in cmd/cli/main.go.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@codecov

codecov Bot commented Jul 31, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 86.04651% with 12 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
daemon/codex_ratelimit.go 84.21% 7 Missing and 5 partials ⚠️
Flag Coverage Δ
unittests 79.38% <86.04%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
daemon/codex_usage_sync.go 95.34% <100.00%> (+0.34%) ⬆️
daemon/codex_ratelimit.go 81.97% <84.21%> (+25.52%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@AnnatarHe
AnnatarHe marked this pull request as ready for review July 31, 2026 13:28
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@AnnatarHe
AnnatarHe merged commit dac9b2a into main Jul 31, 2026
3 of 4 checks passed
@AnnatarHe
AnnatarHe deleted the agent/fix-codex-usage-tracking branch July 31, 2026 13:28
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.

1 participant