Skip to content

Add selectable menu bar reset windows - #3481

Open
vincent-peng wants to merge 2 commits into
steipete:mainfrom
vincent-peng:feat/menu-bar-reset-windows
Open

Add selectable menu bar reset windows#3481
vincent-peng wants to merge 2 commits into
steipete:mainfrom
vincent-peng:feat/menu-bar-reset-windows

Conversation

@vincent-peng

@vincent-peng vincent-peng commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Adds explicit Session and Weekly variants of Resets in and Reset at to the menu-bar layout palette and conditional branches. Existing unqualified tokens retain automatic-window behavior. Missing selected windows display unavailable rather than another quota's reset.

Draft for feature sign-off under VISION.md; implements the proposed capability in #3356. Provider fetching and authentication are unchanged.

Persistence review addressed

The V2 compatibility finding was valid. New enum cases made released v0.56.8 reject a complete layout or override dictionary and overwrite V2 with the oldest-format fallback. A standalone reproduction of that startup contract failed both unrelated-layout preservation assertions.

Full selections now use V3 keys. Every save also writes a released-V2-readable projection preserving supported conditional placements, direct lanes, and provider overrides, plus the oldest-format projection. Re-upgrading restores V3 when the older projections agree. Older edits/deletions are authoritative for each affected provider; untouched providers retain their new reset selections. Nonempty older library edits preserve invisible V3-only rules, older same-ID replacements win, and an older clear-all remains authoritative.

Regression tests exercise fresh defaults, V2 upgrade before editor use, save → released startup → re-upgrade, multiple providers, older edits/deletions, library edits/ID collisions/clearing, and existing predicate directions/metrics. The released decoder fixture rejects the new reset discriminators, rather than relying only on today's decoder.

Validation

  • Final revision: 79c3756, based on main 912eac223.
  • make check: passed; zero format/lint violations.
  • TZ=UTC CODEXBAR_ALLOW_TEST_KEYCHAIN_ACCESS=0 make test: all 87 groups passed on the first attempt; zero failures, retries, or timeouts.
  • Focused layout, persistence, downgrade, palette, and architecture tests: 137 tests passed across five Swift Testing suites.
  • Explicit isolated native editor proof: one XCTest passed, with fresh and V2-upgrade scenarios.
  • Independent regression, reliability, and security/privacy reviews found no remaining material issues after the reconciliation fixes.

The earlier default Australia/Sydney full run stopped on two untouched OpenCode Go tests whose UTC fixture timestamps cross local midnight. That suite passed all 15 tests in UTC; full-suite runs use UTC and leave those unrelated files unchanged.

The CI aggregate reports incomplete while the PR remains a draft: the repository workflow intentionally defers required macOS tests. This is separate from the local full-suite result and is not claimed green.

Native editor evidence and remaining proof

The screenshots below capture the actual production MenuBarLayoutEditor in an isolated native XCTest window with synthetic quota data. The test invokes the editor's production activation/persistence entry point, reconstructs SettingsStore from the same isolated defaults, and verifies the selected layout survives. Both fresh and V2-upgrade scenarios pass. A real 2.05-second countdown boundary changes the formatted value from in 7m to in 6m using the production scheduling calculation.

This is supplemental native test-host evidence. It does not demonstrate ordinary application startup, pointer-driven selection, an app restart, or automatic timer delivery in a running menu-bar app. The requested normal-app/live behavior proof and maintainer feature approval remain outstanding. No live account, browser-cookie, or Keychain probes were performed.

Run the proof explicitly:

CODEXBAR_RESET_NATIVE_PROOF_DIR=/tmp/codexbar-reset-native-proof \
CODEXBAR_ALLOW_TEST_KEYCHAIN_ACCESS=0 CODEXBAR_SUPPRESS_TEST_KEYCHAIN_ACCESS=1 \
CODEXBAR_TEST_CODEX_FILE_ISOLATION=1 CODEXBAR_TEST_SESSION_FILE_ISOLATION=1 \
swift test --filter MenuBarResetWindowNativeProofTests
Isolated native editor captures and receipt

V2 upgrade before selecting new tokens:

V2 upgrade before selection

V2 upgrade after selection and SettingsStore reconstruction:

V2 upgrade restored selections

Fresh settings after selection and SettingsStore reconstruction:

Fresh settings restored selections

Scoped runtime receipt

@clawsweeper

clawsweeper Bot commented Sep 7, 2026

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P2 Normal priority bug or improvement with limited blast radius. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 7, 2026
@clawsweeper

clawsweeper Bot commented Sep 7, 2026

Copy link
Copy Markdown

Codex review: needs real behavior proof before merge. Reviewed September 8, 2026, 8:38 PM ET / September 9, 2026, 00:38 UTC (Revision 4).

ClawSweeper review

What this changes

Adds selectable session and weekly reset countdowns and clocks to menu-bar layouts and conditional branches, with refresh scheduling, versioned settings storage, documentation, and tests.

Merge readiness

Blocked before merge - 6 items remain

The feature remains absent from main and v0.57.0. The earlier V2 persistence defect is addressed, but two actionable defects remain, alongside outstanding feature/storage approval and normal-app proof.

Priority: P2
Reviewed head: 79c375612b142bb962bf86706b1e6edb591659e4
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful implementation and substantial compatibility coverage remain limited by two defects and incomplete application-level proof.
Proof confidence 🦐 gold shrimp (3/6) Needs stronger real behavior proof before merge: The inspected native screenshots and receipt support production-editor rendering and isolated SettingsStore reconstruction for fresh/V2 fixtures. They do not exercise selection, automatic countdown delivery, or persistence across launches in the freshly built menu-bar app, as the contributor explicitly acknowledges; the previous proof request remains unmet. 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.
Patch quality 🦐 gold shrimp (3/6) 2 actionable review findings remain.

Verification

Check Result Evidence
Real behavior Needs proof Needs stronger real behavior proof before merge: The inspected native screenshots and receipt support production-editor rendering and isolated SettingsStore reconstruction for fresh/V2 fixtures. They do not exercise selection, automatic countdown delivery, or persistence across launches in the freshly built menu-bar app, as the contributor explicitly acknowledges; the previous proof request remains unmet. 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 12 items Repository policy: Read the complete root AGENTS.md. No nested AGENTS.md files or maintainer-notes directory were found. Applied the shared-helper, isolated-settings, and freshly built native-app proof guidance; no builds or tests were executed during this read-only review.
Feature and storage approval policy: VISION.md includes reset windows in the product purpose, but requires sign-off for new features and storage behavior changes. The captured PR body explicitly says feature approval remains outstanding.
Current-main necessity: Current main still renders both reset tokens from data.automatic and offers only the original reset choices; it does not provide independently selectable session and weekly reset tokens.
Findings 2 actionable findings [P2] Schedule long countdowns at their visible text boundary
[P3] Compose countdown accessibility text without repeating “in”
Security None None.

How this fits together

CodexBar combines provider quota snapshots with saved layout choices to render its macOS menu-bar display. Reset tokens select a quota window, format its reset time, and schedule display updates.

flowchart LR
  A[Provider quota snapshots] --> C[Select quota window]
  B[Saved layout and conditional rules] --> C
  B --> F[Versioned settings storage]
  C --> D[Format reset time]
  C --> E[Schedule next display update]
  D --> G[Menu-bar text and accessibility]
  E --> G
Loading

Decision needed

Question Recommendation
Should CodexBar adopt the explicit Session/Weekly reset choices and their V3 storage compatibility contract? Approve the additive design: Sponsor the existing palette and V3 projection approach, subject to the identified repairs and normal-app upgrade proof.

Why: VISION.md requires approval for new features and storage changes, and the discussion explicitly leaves that approval outstanding.

Before merge

  • Add real behavior proof - Needs stronger real behavior proof before merge: The inspected native screenshots and receipt support production-editor rendering and isolated SettingsStore reconstruction for fresh/V2 fixtures. They do not exercise selection, automatic countdown delivery, or persistence across launches in the freshly built menu-bar app, as the contributor explicitly acknowledges; the previous proof request remains unmet. 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.
  • Schedule long countdowns at their visible text boundary (P2) - Selecting a weekly countdown now sends its reset date through the minute-only scheduler. With 3d 6h 30m remaining, the formatter displays in 3d 6h, yet the task repeatedly calls updateIcons() each minute while that text remains unchanged. Calculate the next actual formatting boundary, preserving minute updates when the formatter exposes minutes. This concern was present in the earlier reviewed head and was missed then.
  • Compose countdown accessibility text without repeating “in” (P3) - The selected countdown's editor label is Weekly: Resets in, and optionalTextToken appends a value such as in 2d, yielding Weekly: Resets in in 2d for VoiceOver. Use a separate accessibility prefix or composed string while retaining the window identity. This concern was present in the earlier reviewed head and was missed then.
  • Resolve merge risk (P1) - V3 reconciliation changes persisted layouts, overrides, and conditional libraries; isolated regression coverage is substantial, but retention across ordinary fresh and upgraded app launches remains unproven.
  • Complete next step (P2) - Resolve the countdown scheduling and accessibility findings, obtain feature/storage sign-off, and supply normal-app fresh/upgrade proof before merge.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.

Findings

  • [P2] Schedule long countdowns at their visible text boundary — Sources/CodexBar/StatusItemController+CountdownRefresh.swift:25
  • [P3] Compose countdown accessibility text without repeating “in” — Sources/CodexBar/MenuBarLayoutRenderer.swift:547-551
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Production and test LOC Production +244/-70 (net +174); tests +1077/-9 (net +1068) Production growth supports selectable resets and compatibility projections, while most added code exercises rendering, persistence, and downgrade behavior.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #3356
Summary: This PR is an implementation candidate for the open selectable-reset request; the merged presentation cleanup is adjacent work.

Members:

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

Merge-risk options

Maintainer options:

  1. Verify retained settings across app launches (recommended)
    Keep the V3 projections and demonstrate that fresh and upgraded installations retain existing layouts, overrides, and new selections after relaunch.
  2. Pause the storage expansion
    Hold the feature until the owner accepts the three-generation settings contract and its ongoing compatibility cost.

Technical review

Best possible solution:

With feature/storage sign-off, retain additive window choices and legacy automatic semantics, preserve saved layouts across upgrades, and refresh countdowns only when their displayed text changes.

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

Yes for the patch defects by source inspection: a selected multi-day countdown reaches the minute scheduler, and its accessibility prefix already contains 'in'. No runtime reproduction was executed; the underlying feature request itself is not a bug reproduction.

Is this the best way to solve the issue?

Unclear pending sign-off: reusing existing quota-window resolution and preserving automatic token spelling is appropriate, but countdown scheduling and accessibility composition need repair.

Full review comments:

  • [P2] Schedule long countdowns at their visible text boundary — Sources/CodexBar/StatusItemController+CountdownRefresh.swift:25
    Selecting a weekly countdown now sends its reset date through the minute-only scheduler. With 3d 6h 30m remaining, the formatter displays in 3d 6h, yet the task repeatedly calls updateIcons() each minute while that text remains unchanged. Calculate the next actual formatting boundary, preserving minute updates when the formatter exposes minutes. This concern was present in the earlier reviewed head and was missed then.
    Confidence: 0.96
    Late finding: first raised on code an earlier review cycle already covered.
  • [P3] Compose countdown accessibility text without repeating “in” — Sources/CodexBar/MenuBarLayoutRenderer.swift:547-551
    The selected countdown's editor label is Weekly: Resets in, and optionalTextToken appends a value such as in 2d, yielding Weekly: Resets in in 2d for VoiceOver. Use a separate accessibility prefix or composed string while retaining the window identity. This concern was present in the earlier reviewed head and was missed then.
    Confidence: 0.99
    Late finding: first raised on code an earlier review cycle already covered.

Overall correctness: patch is incorrect
Overall confidence: 0.94

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 928166f89947.

Labels

Label justifications:

  • P2: This is a bounded menu-bar feature with actionable refresh and accessibility defects, without evidence of an urgent production outage.
  • merge-risk: 🚨 compatibility: The PR changes persisted settings generations, and ordinary-app upgrade retention is not yet demonstrated.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The inspected native screenshots and receipt support production-editor rendering and isolated SettingsStore reconstruction for fresh/V2 fixtures. They do not exercise selection, automatic countdown delivery, or persistence across launches in the freshly built menu-bar app, as the contributor explicitly acknowledges; the previous proof request remains unmet. 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.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The inspected native screenshots and receipt support production-editor rendering and isolated SettingsStore reconstruction for fresh/V2 fixtures. They do not exercise selection, automatic countdown delivery, or persistence across launches in the freshly built menu-bar app, as the contributor explicitly acknowledges; the previous proof request remains unmet.

Evidence

What I checked:

  • Repository policy: Read the complete root AGENTS.md. No nested AGENTS.md files or maintainer-notes directory were found. Applied the shared-helper, isolated-settings, and freshly built native-app proof guidance; no builds or tests were executed during this read-only review. (AGENTS.md:1, 79c375612b14)
  • Feature and storage approval policy: VISION.md includes reset windows in the product purpose, but requires sign-off for new features and storage behavior changes. The captured PR body explicitly says feature approval remains outstanding. (VISION.md:13, 79c375612b14)
  • Current-main necessity: Current main still renders both reset tokens from data.automatic and offers only the original reset choices; it does not provide independently selectable session and weekly reset tokens. (Sources/CodexBar/MenuBarLayoutRenderer.swift:578, 928166f89947)
  • Latest release remains automatic-only: The v0.57.0 token enum and editor palette retain only bare resetCountdown and resetAbsolute choices. (Sources/CodexBar/MenuBarLayout.swift:453, 45cda6084d64)
  • Earlier persistence finding addressed: The branch stores new discriminators in V3 and writes V2/V1 projections. Downgrade tests exercise rejection by the older decoder, startup, re-upgrade, provider edits/deletions, and conditional-library reconciliation. (Tests/CodexBarTests/MenuBarResetTokenDowngradeTests.swift:29, 79c375612b14)
  • Countdown scheduling mismatch: The introduced weekly countdown path feeds the existing minute-boundary scheduler. UsageFormatter omits minutes when both days and hours are nonzero, so repeated updateIcons calls can leave the displayed text unchanged. The formatter does show minutes when the remaining whole-hour component is zero, which a repair must preserve. (Sources/CodexBar/StatusItemController+CountdownRefresh.swift:25, 79c375612b14)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • William Mitchell: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Giuseppe Bisemi: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

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

  • Repair the visible-boundary scheduler and countdown accessibility wording with focused regression coverage.
  • Add redacted fresh/upgrade app evidence showing selection, automatic countdown updates, and retention across relaunches; a recording is preferred for timing, while screenshots and runtime logs count. Remove credentials, private account details, IP addresses, and non-public endpoints. Update the PR body to trigger re-review, or ask a maintainer to comment @clawsweeper re-review.

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 (3 earlier review cycles)
  • reviewed 2026-09-07T23:01:42.574Z sha 5f82f91 :: needs real behavior proof before merge. :: [P1] Preserve V2-readable layouts before adding new token discriminators
  • reviewed 2026-09-07T23:40:01.695Z sha 79c3756 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-09T00:30:13.480Z sha 79c3756 :: needs real behavior proof before merge. :: none

@vincent-peng

Copy link
Copy Markdown
Contributor Author

Addressed the P1 persistence finding in 79c3756. The original released-V2 startup failure is reproduced; full selections now live in V3, with V2/V1 projections that released readers can decode. Added downgrade/re-upgrade tests, per-provider preservation across older edits/deletions, and conditional-library preservation with explicit clear-all/ID-replacement behavior.

Validation: make check is clean; all 87 UTC test groups passed without retries or timeouts. Added native editor captures and scoped runtime receipts for fresh/V2-upgrade settings. These are isolated test-host checks, not ordinary app restart or live timer-delivery proof; the PR body states that limitation. Normal-app proof and maintainer feature sign-off remain outstanding, so this stays a draft. The CI aggregate is incomplete because required macOS tests are deferred for drafts.

@clawsweeper clawsweeper Bot added proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Sep 7, 2026
@vincent-peng
vincent-peng marked this pull request as ready for review September 9, 2026 00:27
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 9, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-09T00:32:33.222579Z 79c3756 Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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: 79c375612b

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

if tokens.contains(.resetAbsolute) {
absoluteResetDates.append(contentsOf: resetDates)
}
countdownResetDates += self.menuBarLayoutResetDates(for: provider, now: now, absolute: 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 Schedule weekly countdowns at their visible text boundary

When a user selects “Weekly: Resets in” and the reset is more than a day away, this feeds the weekly date into menuBarCountdownRefreshDelay, which always wakes at the next minute boundary. However, UsageFormatter.resetCountdownDescription omits minutes while days are present, so the displayed text normally changes only once per hour; each wake calls updateIcons() and schedules another minute wake for potentially most of a week. Calculate the next boundary from the formatter's current granularity so long weekly countdowns do not continuously perform invisible menu-bar work.

Useful? React with 👍 / 👎.

Comment on lines +548 to +551
return self.optionalTextToken(
item.resetIsAbsolute ? text.absolute : text.countdown,
unavailableLabel: L("%@ unavailable", label),
accessibilityPrefix: label,

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 Remove the repeated “in” from countdown accessibility text

For a selected countdown token, label is already something like “Weekly: Resets in”, while the rendered countdown value is “in 2d”; passing the full label as accessibilityPrefix therefore makes VoiceOver announce “Weekly: Resets in in 2d”. Use a prefix that does not contain the countdown preposition, or provide a separately composed accessibility string.

Useful? React with 👍 / 👎.

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. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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.

1 participant