Skip to content

Show menu pace token during early weekly window - #2853

Merged
steipete merged 9 commits into
steipete:mainfrom
Yuxin-Qiao:fix/pace-token-early-window-2842
Aug 14, 2026
Merged

Show menu pace token during early weekly window#2853
steipete merged 9 commits into
steipete:mainfrom
Yuxin-Qiao:fix/pace-token-early-window-2842

Conversation

@Yuxin-Qiao

@Yuxin-Qiao Yuxin-Qiao commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Show the menu pace token during the early weekly window.

Note

  • Privacy-sensitive screenshots were removed from this PR description.

@clawsweeper

clawsweeper Bot commented Aug 11, 2026

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. 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. labels Aug 11, 2026
@clawsweeper

clawsweeper Bot commented Aug 11, 2026

Copy link
Copy Markdown

Codex review: needs maintainer review before merge. Reviewed August 14, 2026, 3:50 AM ET / 07:50 UTC.

ClawSweeper review

What this changes

This PR makes the weekly menu-bar pace token appear after 1% of its resolved quota window has elapsed while retaining the 3% threshold for session, automatic, and Runs out tokens.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

The patch is technically sound and proof-positive, but it intentionally changes existing weekly custom layouts from a dash to a signed pace estimate during the 1–3% elapsed-window band. Keep it open for an authorized maintainer to accept that display-policy change.

Priority: P2
Reviewed head: 6896a1ba88fc3e8c29f9356ca454133354e759ca
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Focused implementation, visible proof, and regression coverage support a good merge candidate once the display-policy decision is recorded.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): The PR includes an after-fix screenshot from the menu-layout rendering path that visibly shows Weekly pace while session and automatic remain hidden in the early-window band.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (screenshot): The PR includes an after-fix screenshot from the menu-layout rendering path that visibly shows Weekly pace while session and automatic remain hidden in the early-window band.
Evidence reviewed 7 items Current behavior: Current main applies the shared 3% expected-use floor to menu-bar pace text, so the proposed 1% weekly exception is not already implemented.
Weekly-only implementation: The PR adds an elapsed-progress fallback but passes it only to the weekly token; session and automatic retain default thresholds.
Resolved-window handling: The PR evaluates elapsed eligibility on the same resolved calendar window used for pace calculations, avoiding monthly-sentinel drift.
Findings None None.
Security None None.

How this fits together

CodexBar turns provider quota snapshots into menu-bar layout tokens. The weekly pace token derives a signed estimate from the resolved quota window, while the status-item scheduler wakes the renderer when time-based eligibility changes.

flowchart LR
  A[Provider quota snapshot] --> B[Resolved quota window]
  B --> C[Pace estimate]
  B --> D[Elapsed eligibility]
  C --> E[Weekly pace token]
  D --> E
  E --> F[Status-item redraw]
  F --> G[Menu bar layout]
Loading

Decision needed

Question Recommendation
Should existing Weekly pace menu-bar layouts intentionally show a signed pace estimate after 1% elapsed progress while session, automatic, and Runs out remain at 3%? Accept the weekly-only exception: Approve the 1% elapsed fallback for Weekly pace while retaining the tested 3% floors for every other pace-related token.

Why: This is a deliberate compatibility-visible default change. The supplied acceptance wording is from a CONTRIBUTOR, and the reviewed repository history and notes do not establish an authorized maintainer decision.

Before merge

  • Resolve merge risk (P1) - Existing custom layouts containing Weekly pace will replace an unavailable dash with an early signed estimate during the first 1–3% of a quota window.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Code and test balance production +147/-18, tests +331/-6; 13 files affected Most of the change is focused regression and render coverage around a bounded menu-bar policy change.

Merge-risk options

Maintainer options:

  1. Accept the weekly-only policy (recommended)
    Approve the visible 1–3% early-window behavior for existing Weekly pace layouts after confirming it is the intended compatibility tradeoff.
  2. Retain the universal 3% floor
    Pause or close this feature direction if layouts should continue to show no pace estimate until the established threshold.

Technical review

Best possible solution:

Record authorized acceptance of the weekly-only 1% display policy, then merge the focused implementation once required checks complete.

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

Not applicable as a bug reproduction: this PR adds a deliberate display-policy exception, and its focused fixtures cover the intended early-window behavior.

Is this the best way to solve the issue?

Yes technically, conditional on policy approval: the implementation confines the fallback to Weekly pace, preserves other floors, resolves calendar windows correctly, and schedules the eligibility redraw.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This is a bounded menu-bar behavior change with limited user impact.
  • merge-risk: 🚨 compatibility: Merging changes what existing custom Weekly pace layouts display during the first 1–3% of a quota window.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (screenshot): The PR includes an after-fix screenshot from the menu-layout rendering path that visibly shows Weekly pace while session and automatic remain hidden in the early-window band.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR includes an after-fix screenshot from the menu-layout rendering path that visibly shows Weekly pace while session and automatic remain hidden in the early-window band.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The PR includes an after-fix screenshot from the menu-layout rendering path that visibly shows Weekly pace while session and automatic remain hidden in the early-window band.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Current-main history and blame connect this person to the current pace implementation and recent menu-layout work. (role: recent area contributor; confidence: high; commits: 94ac3161bcf3, 70125a5ec102, 0f070a38fa7f; files: Sources/CodexBar/UsageStore+HistoricalPace.swift, Sources/CodexBar/StatusItemController+MenuBarLayout.swift, Sources/CodexBar/MenuBarLayoutEditor.swift)
  • Petr Kratochvíl: Introduced the menu-bar pace layout tokens in the feature-history commit. (role: introduced behavior; confidence: high; commits: f93e3ed460ad; files: Sources/CodexBar/UsageStore+HistoricalPace.swift, Sources/CodexBar/StatusItemController+MenuBarLayout.swift)
  • Yuxin Qiao: Has prior merged menu-layout and rate-window work in addition to this proposal. (role: recent adjacent contributor; confidence: medium; commits: b841e34e5f91, a0d77c37f9cc; files: Sources/CodexBar/StatusItemController+MenuBarLayout.swift, Sources/CodexBar/MenuBarLayoutEditor.swift)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Have an authorized maintainer record acceptance or rejection of the weekly-only 1% threshold.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • 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.

History

Review history (9 earlier review cycles; latest 8 shown)
  • reviewed 2026-08-11T03:44:37.973Z sha 6963256 :: needs real behavior proof before merge. :: [P2] Gate early Codex pace on elapsed weekly progress | [P2] Keep the lower floor off the run-out token
  • reviewed 2026-08-11T04:15:17.406Z sha b35d9a5 :: needs changes before merge. :: [P2] Gate learned Codex pace on elapsed weekly progress | [P2] Keep the early floor off the run-out token | [P3] Document the weekly-only threshold exception
  • reviewed 2026-08-11T05:00:23.780Z sha 0cd048f :: needs changes before merge. :: [P2] Measure elapsed progress on the resolved pace window | [P2] Schedule a redraw when weekly pace crosses 1%
  • reviewed 2026-08-11T05:15:33.837Z sha 1bf1bae :: needs maintainer review before merge. :: none
  • reviewed 2026-08-11T05:44:58.130Z sha 8e1a37f :: needs maintainer review before merge. :: none
  • reviewed 2026-08-11T05:49:51.041Z sha 8e1a37f :: needs maintainer review before merge. :: none
  • reviewed 2026-08-11T06:27:19.021Z sha 8e1a37f :: needs maintainer review before merge. :: none
  • reviewed 2026-08-14T07:11:40.121Z sha be57764 :: needs maintainer review before merge. :: none

@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: 6914e0b215

ℹ️ 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".


guard let resolved else { return nil }
guard resolved.expectedUsedPercent >= Self.minimumPaceExpectedPercent else { return nil }
guard resolved.expectedUsedPercent >= minimumExpectedPercent else { return nil }

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 Gate early Codex pace on elapsed progress

For Codex users with historical tracking enabled and a mature dataset whose prior weeks have little usage in the first few hours, CodexHistoricalPaceEvaluator can return a learned expectedUsedPercent below 1% even after more than 1% of the weekly window has elapsed. This guard then still suppresses the menu token—for example, roughly 20 histories that remain flat for four hours produce an expectation around 0.78% at four hours—so the change does not reliably fix the early-window behavior for the provider-specific path. Gate menu-token eligibility on elapsed window progress (or otherwise preserve a linear floor), and cover the Codex historical branch rather than only .zai.

AGENTS.md reference: AGENTS.md:L5-L5

Useful? React with 👍 / 👎.

@Yuxin-Qiao
Yuxin-Qiao force-pushed the fix/pace-token-early-window-2842 branch from 6914e0b to 6963256 Compare August 11, 2026 03:37

@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: b35d9a5357

ℹ️ 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".

provider: provider,
window: $0,
now: now,
minimumExpectedPercent: windows.weekly != nil ? 1 : 3)

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 Keep the early floor scoped to the weekly pace token

When a layout contains .runsOut and the weekly window has only reached 1–3% expected usage, this also lowers the forecast's guard and starts showing an exhaustion estimate based on just the first few hours. runsOut is a separate token from the signed weekly pace token, so it should retain the existing 3% floor; the mirrored calculation in MenuBarLayoutEditor.liveData should do the same.

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient Contributor real behavior proof is sufficient. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed 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. labels Aug 11, 2026
@Yuxin-Qiao

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 11, 2026

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@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: 0cd048f1e0

ℹ️ 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 +53 to +55
let elapsedFloorMet = minimumElapsedPercent.map { minimum in
(Self.windowElapsedPercent(window: window, now: now) ?? 0) >= minimum
} ?? false

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 Use the resolved window for the elapsed floor

For providers whose semantic weekly lane is a calendar-month quota represented by a 30-day sentinel (for example, Notion's monthly lane), pace is correctly calculated from paceWindow, but this new eligibility check measures the original sentinel window. At the start of a 28-day February cycle it therefore reports two days (6.7%) already elapsed and exposes the pace token immediately instead of after 1%; a 31-day cycle delays it by roughly a day. Measure elapsed progress against the same resolved calendar window used to calculate resolved.

Useful? React with 👍 / 👎.

Comment on lines +86 to +90
weeklyPace: self.store.menuBarLayoutPaceText(
provider: provider,
window: windows.weekly,
now: now,
minimumElapsedPercent: 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 Schedule a redraw when weekly pace crosses 1%

When a snapshot is rendered before the new 1% boundary, this call returns nil and the status item shows a dash, but crossing the boundary changes only Date() and does not trigger Observation. In particular, with manual refresh and a custom layout containing only the weekly pace token, UsageStore.startTimer has no polling timer and scheduleMenuBarCountdownRefreshIfNeeded schedules custom-layout wakes only for reset tokens, so the new pace can remain hidden indefinitely until an unrelated update or manual refresh. Schedule an icon refresh for the eligibility boundary when this token is present.

Useful? React with 👍 / 👎.

@Yuxin-Qiao

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 11, 2026

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 11, 2026
@Yuxin-Qiao

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 11, 2026

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Aug 11, 2026
@Yuxin-Qiao

Copy link
Copy Markdown
Contributor Author

Maintainer decision: accept the weekly-only 1% elapsed eligibility for existing and custom weekly pace layouts. Keep the established 3% floor for session, automatic, and Runs out tokens.

@Yuxin-Qiao

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

# Conflicts:
#	Tests/CodexBarTests/ProviderArchitectureGatekeeperTests.swift
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. labels Aug 14, 2026
@steipete
steipete merged commit f043a78 into steipete:main Aug 14, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. P2 Normal priority bug or improvement with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants