Skip to content

Prefer absolute reset_at epoch over relative reset_after_seconds for Codex#700

Merged
rygel merged 2 commits into
developfrom
fix/codex-reset-at-epoch
Jul 3, 2026
Merged

Prefer absolute reset_at epoch over relative reset_after_seconds for Codex#700
rygel merged 2 commits into
developfrom
fix/codex-reset-at-epoch

Conversation

@rygel

@rygel rygel commented Jul 3, 2026

Copy link
Copy Markdown
Owner

Changes

The Codex wham/usage API returns
eset_at (absolute Unix epoch) alongside
eset_after_seconds (relative). The relative value drifts by network round-trip latency (~18s observed in live testing). This PR prefers the absolute timestamp, falling back to
eset_after_seconds when
eset_at is absent.

Scope

  • CodexProvider.cs: Added JsonKeyResetAt constant + ResolveWindowResetTime helper. Applied to all four windows: primary (5h burst), secondary (weekly), and both Spark windows. The SparkWindow record now stores resolved DateTime? reset times instead of raw seconds.
  • CodexProviderTests.cs: Added 2 tests:
    • PrefersAbsoluteResetAtEpoch_OverRelativeResetAfterSeconds — verifies NextResetTime matches the epoch exactly
    • FallsBackToResetAfterSeconds_WhenResetAtAbsent — verifies backward-compatible fallback when
      eset_at is missing

Verification

  • Build: passed
  • Full test suite: 1426 passed, 2 skipped, 0 failed

…Codex

The Codex wham/usage API returns reset_at (absolute Unix epoch) alongside
reset_after_seconds (relative). The relative value drifts by network
round-trip latency (~18s observed). Now prefer the absolute timestamp,
falling back to reset_after_seconds when absent.

Applied to all four windows: primary (5h burst), secondary (weekly), and
both Spark windows.
The semgrep-action@v1 Docker image (returntocorp/semgrep-agent:v1) is too
old to handle severity=MEDIUM from current registry rules, causing every
run to crash with ValueError. Install semgrep via pip instead so the
latest version is always used.
@github-advanced-security

Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

@rygel
rygel merged commit bf7d090 into develop Jul 3, 2026
20 checks passed
@rygel
rygel deleted the fix/codex-reset-at-epoch branch July 3, 2026 07:26
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.

3 participants