Skip to content

fix(codex): correct historical pace run-out forecasts - #1581

Merged
steipete merged 6 commits into
steipete:mainfrom
Yuxin-Qiao:fix-1544-codex-historical-pace
Jun 18, 2026
Merged

fix(codex): correct historical pace run-out forecasts#1581
steipete merged 6 commits into
steipete:mainfrom
Yuxin-Qiao:fix-1544-codex-historical-pace

Conversation

@Yuxin-Qiao

@Yuxin-Qiao Yuxin-Qiao commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Fixes #1544

Summary

  • Remove the unrelated app-packaging/signing rewrite; Scripts/package_app.sh is byte-identical to main.
  • Extrapolate historical weeks that reached 100% early instead of treating censored demand as flat.
  • Keep historical pacing active when weekly work-days are off.
  • Bound the display expectation by quota-safe linear pace so a projected run-out cannot render as a reserve.
  • Report already-exhausted quota as zero ETA and 100% run-out certainty.
  • Never combine Lasts until reset with a material rounded run-out risk.
  • Add maintainer changelog credit for @Yuxin-Qiao.

Proof

Exact reviewed head: 7ffb96cffb1ed737833db09288ff7eb8bf182699

  • 84 focused historical pace, pace model, and pace text tests pass.
  • Reported-state regression: 88% used, 67 hours remaining, work-days off renders 28% in deficit and Runs out in 13h 47m.
  • Early-exhaustion regression renders 5% in deficit with a run-out forecast, never a reserve.
  • Exhausted-current regression renders Runs out now · ≈ 100% run-out risk.
  • make check passes with zero format or lint findings.
  • Final full branch autoreview: no actionable findings, confidence 0.84.
  • Exact ad-hoc package built; deep strict codesign passed; bundle reports CodexGitCommit=7ffb96cf; app launched and remained running.
  • Live menu screenshot was attempted after capturing the target screen. An orphaned protected Keychain dialog and zero-size CodexBar status-item accessibility frames prevented reliable menu interaction, so no menu screenshot is claimed.

@Yuxin-Qiao Yuxin-Qiao changed the title Fix Codex historical pace exhaustion calculations (Issue #1544) fix(codex): clamp historical pace ETA to zero when quota is exhausted (#1544) Jun 16, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d7c30ce2b5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Scripts/package_app.sh Outdated
APP="$TMP_APP"
SPARKLE="$APP/Contents/Frameworks/Sparkle.framework"
chmod -R u+w "$APP"
xattr -cr "$APP"; xattr -dr com.apple.FinderInfo "$APP" 2>/dev/null

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Ignore missing FinderInfo when clearing xattrs

On a normal package where com.apple.FinderInfo is not present, this aborts the script under set -e: xattr -cr "$APP" clears all attributes first, then xattr -dr com.apple.FinderInfo "$APP" tries to delete an attribute that is now absent. The macOS xattr man page documents -c as clearing all attributes, -d as deleting the named attribute, and non-zero exit on errors, while removexattr(2) reports ENOATTR when the attribute does not exist, so direct ./Scripts/package_app.sh can fail before signing unless this delete is made best-effort.

Useful? React with 👍 / 👎.

@steipete
steipete force-pushed the fix-1544-codex-historical-pace branch from ac73ecc to 7ffb96c Compare June 18, 2026 14:11
@steipete steipete changed the title fix(codex): clamp historical pace ETA to zero when quota is exhausted (#1544) fix(codex): correct historical pace run-out forecasts Jun 18, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7ffb96cffb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +877 to +880
if actual >= 100 {
willLastToReset = false
etaSeconds = 0
runOutProbability = 1

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Let exhausted windows reach this ETA override

When usedPercent is 100% or more and the UI gets pace via UsageStore.weeklyPace, this branch is skipped: Sources/CodexBar/UsageStore+HistoricalPace.swift returns nil for window.remainingPercent <= 0 before invoking CodexHistoricalPaceEvaluator. I checked the MenuDescriptor/menu-bar pace paths that call store.weeklyPace directly, so exhausted Codex weekly windows still do not receive the new Runs out now/etaSeconds = 0 pace there; allow exhausted windows through the store or handle the zero-ETA case at that layer.

Useful? React with 👍 / 👎.

@clawsweeper

clawsweeper Bot commented Jun 18, 2026

Copy link
Copy Markdown

Codex review: needs real behavior proof before merge. Reviewed June 18, 2026, 10:53 AM ET / 14:53 UTC.

Summary
The branch adjusts Codex historical weekly pace forecasting, adds focused pace/text/store tests, and adds a changelog entry.

Reproducibility: yes. at source level. The PR adds exhausted-quota handling in the evaluator, but the current store wrapper still returns nil for exhausted windows before the evaluator is called by menu/card paths.

Review metrics: 2 noteworthy metrics.

  • Diff surface: 6 files, +207/-7. The patch is focused, but the app-facing store wrapper is outside the changed production surface.
  • Test surface: 4 test files changed. The added tests are useful, but the exhausted-current regression currently exercises the evaluator rather than the store/menu path.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #1544
Summary: This PR is the open candidate fix for the linked Codex weekly reserve/run-out issue, while a merged adjacent PR already handled only the contradictory label subset.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🧂 unranked krab
Proof: 🧂 unranked krab
Patch quality: 🦐 gold shrimp
Result: blocked until real behavior proof is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P1] Fix exhausted Codex weekly windows through UsageStore.weeklyPace and add a store-level regression.
  • [P1] Add redacted real behavior proof showing the corrected visible Codex weekly pace text.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The PR body lists tests, codesign, and launch checks, but it does not show the corrected visible CodexBar menu/card pace behavior with redacted output, logs, screenshot, or recording. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Mantis proof suggestion
A visible CodexBar menu/card proof would materially help because this PR changes user-facing pace text and current proof does not show it. A maintainer can ask Mantis to capture proof by posting this exact PR comment:

@openclaw-mantis visual task: verify Codex weekly pace shows the reported deficit/run-out text after this fix, with private account details redacted.

Risk before merge

  • [P1] Exhausted Codex weekly windows still return nil through UsageStore.weeklyPace before the PR's evaluator override can run, so visible menu/card callers can miss the new Runs out now state.
  • [P1] The PR body lists tests and launch/codesign checks, but it does not include redacted real app output, screenshot, recording, or logs showing the corrected Codex weekly pace text.

Maintainer options:

  1. Fix the app-facing exhausted path (recommended)
    Allow exhausted Codex weekly windows to reach or be handled by UsageStore.weeklyPace, add a store/menu regression, and attach redacted real behavior proof before merge.
  2. Pause until proof is available
    If nobody can capture the real CodexBar menu/card behavior, keep the PR paused rather than merging an unproven visible forecast change.

Next step before merge

  • [P1] Human PR follow-up is needed because the branch has a concrete app-path correctness finding and the contributor must add real behavior proof for the visible UI path.

Security
Cleared: Cleared; the current head changes Swift pace logic, tests, and changelog text, with no scripts, dependencies, CI, credentials, or package metadata changes.

Review findings

  • [P2] Let exhausted windows reach the store pace path — Sources/CodexBar/HistoricalUsagePace.swift:877-880
Review details

Best possible solution:

Finish the store/menu exhausted-window path, keep the focused historical pace regressions, and add redacted real-app proof showing the corrected Codex weekly pace text.

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

Yes, at source level. The PR adds exhausted-quota handling in the evaluator, but the current store wrapper still returns nil for exhausted windows before the evaluator is called by menu/card paths.

Is this the best way to solve the issue?

No. The evaluator changes are mostly the right direction, but the complete fix needs exhausted-window behavior to reach UsageStore.weeklyPace callers and needs real app proof.

Full review comments:

  • [P2] Let exhausted windows reach the store pace path — Sources/CodexBar/HistoricalUsagePace.swift:877-880
    This zero-ETA override only runs when the evaluator is called, but UsageStore.weeklyPace still returns nil for window.remainingPercent <= 0 before invoking it, and the menu/card paths call the store wrapper. Exhausted Codex weekly windows therefore still cannot render the new Runs out now / 100% risk state in the app; allow that case through the store or handle zero ETA at the store layer with a store-level regression.
    Confidence: 0.91

Overall correctness: patch is incorrect
Overall confidence: 0.88

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 016f3b9e1314.

Label changes

Label changes:

  • add merge-risk: 🚨 other: The diff changes visible quota forecast semantics, and current app callers can still miss the new exhausted state despite focused tests.

Label justifications:

  • P2: This is a normal-priority user-visible Codex weekly quota forecast bug with limited blast radius and one remaining app-path defect.
  • merge-risk: 🚨 other: The diff changes visible quota forecast semantics, and current app callers can still miss the new exhausted state despite focused tests.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body lists tests, codesign, and launch checks, but it does not show the corrected visible CodexBar menu/card pace behavior with redacted output, logs, screenshot, or recording. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed

What I checked:

Likely related people:

  • steipete: Recent main history includes the work-days weekly pace merge, and this PR's final narrowing commits were maintainer-authored by steipete. (role: recent area contributor and branch refiner; confidence: high; commits: 2f92ee97e46e, 6f57299f6e9f, e5d8b771e035; files: Sources/CodexBar/UsageStore+HistoricalPace.swift, Sources/CodexBarCore/UsagePace.swift, Sources/CodexBar/HistoricalUsagePace.swift)
  • tristanmanchester: GitHub commit history ties Tristan Manchester to historical pace evaluator and backfill hardening in the same area this PR modifies. (role: historical pace contributor; confidence: medium; commits: a2973265477e; files: Sources/CodexBar/HistoricalUsagePace.swift, Sources/CodexBar/UsageStore+HistoricalPace.swift, Tests/CodexBarTests/HistoricalUsagePaceTests.swift)
  • pstanton237: The work-day weekly pace merge that issue reporters suspected was co-authored from pstanton237's original work. (role: original proposed-change contributor; confidence: medium; commits: 2f92ee97e46e; files: Sources/CodexBarCore/UsagePace.swift, Tests/CodexBarTests/UsagePaceTests.swift)
  • kiranmagic7: Merged PR history shows kiranmagic7 handled the related risk-label consistency subset referenced by the linked issue. (role: recent adjacent contributor; confidence: medium; commits: 99752f704e8a; files: Sources/CodexBar/UsagePaceText.swift, Tests/CodexBarTests/UsagePaceTextTests.swift)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal priority bug or improvement with limited blast radius. merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. labels Jun 18, 2026
@steipete

Copy link
Copy Markdown
Owner

Landing proof for exact head 7ffb96cf:

  • historical pace now computes counterfactual run-out from historical curves, keeps work-days-off authority, caps linear forecasts safely, and reports exhausted state without a contradictory "Lasts" message
  • 84 focused tests, make check, and autoreview clean (0.84)
  • unrelated package-script changes removed; package script matches main
  • exact ad-hoc package passed deep strict code-sign verification and stayed running
  • deterministic model/state tests cover the UI behavior; menu screenshot was not claimed because the status item had zero-size geometry behind an unrelated protected Keychain prompt
  • macOS, Linux x86_64/arm64, and security CI green

Public model identifier gate: N/A; no model-bearing content changed.

@steipete
steipete merged commit f986661 into steipete:main Jun 18, 2026
4 checks passed
@Yuxin-Qiao
Yuxin-Qiao deleted the fix-1544-codex-historical-pace branch June 25, 2026 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. P2 Normal priority bug or improvement with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Weekly reserve / run-out risk inverted in v0.35.0 with work-days OFF — a clear deficit is shown as surplus (Codex Pro 20x)

2 participants