Skip to content

feat(cursor): pin Grok Bot usage in menu-bar layouts - #3829

Closed
steipete wants to merge 1 commit into
mainfrom
triage/20260921-grok-bot-layout
Closed

steipete wants to merge 1 commit into
mainfrom
triage/20260921-grok-bot-layout

Conversation

@steipete

Copy link
Copy Markdown
Owner

Cursor layouts can now pin Grok Bot % beside the standard usage lanes. The token reads Cursor's existing named allowance, follows the used/remaining preference, disappears when the allowance is unavailable, and refreshes when only Grok Bot changes. Cursor registers it through the shared descriptor capabilities.

The full layout uses V4 storage with V3/V2/V1 projections. Released 0.60.x decoders reject an unknown token and otherwise fall back to V2, losing explicit reset-window selections. The V3 projection omits only the named-extra token, preserving reset choices; unchanged downgrades retain the full layout on return, while older-version edits take precedence. A shared projection helper replaces repeated filtering logic.

Thanks @yicone for the token and persistence work in #3712.

Validation

  • Regression before the change: CODEXBAR_SUPPRESS_TEST_KEYCHAIN_ACCESS=1 swift test --jobs 2 --filter MenuBarLayoutNamedExtraTests — 1 test failed because the unknown extra token rejected the saved layout.
  • Regression after the change: CODEXBAR_SUPPRESS_TEST_KEYCHAIN_ACCESS=1 swift test --jobs 2 --skip-build --filter MenuBarLayoutNamedExtraTests — 4 tests passed, including the original regression.
  • CODEXBAR_SUPPRESS_TEST_KEYCHAIN_ACCESS=1 CODEXBAR_GROK_LAYOUT_SCREENSHOT_DIR=docs/screenshots swift test --jobs 2 --filter 'MenuBarLayout|MenuBarResetToken|SettingsStoreTests|SettingsStoreMergeIconStackedTests|StatusItemIconObservationSignatureTests|StatusItemLayoutPaceSignatureTests|CursorSandUsageTests|ProviderArchitectureGatekeeperTests|MenuBarPercentWindowPreferenceTests|CursorMenuCardModelTests|MistralSubscriptionBudgetTests' — 375 tests in 17 suites passed.
  • make check — zero SwiftFormat changes needed and zero SwiftLint violations; repository checks passed.
  • Independent Codex autoreview through P2: no accepted/actionable findings.

Synthetic renderer proof

These images use the production text renderer and synthetic usage values. No live account or running menu-bar app was accessed.

Before: standard Cursor lanes, synthetic data

After: Cursor lanes plus Grok Bot, synthetic data

Fixes #3309
Closes #3712

Add descriptor-owned named extra percentages and hide unavailable allowances.
Refresh the strip when Grok Bot changes independently of Cursor's other lanes.
Keep V3/V2/V1 projections beside V4 so downgrades preserve reset choices and
older-version edits still win when upgrading again.

Fixes #3309
Refs #3712

Co-authored-by: yicone <yicone@gmail.com>
@clawsweeper

clawsweeper Bot commented Sep 21, 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.

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

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

{
switch token {
case .hidden: return nil
case let .extraPercent(id): return data.extraWindow(id) == nil ? nil : token

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 adjacent separators when the named extra vanishes

When a user configures a natural layout such as Cursor % · Grok Bot %, an unavailable Grok Bot window makes this branch remove only the extraPercent token, leaving the explicit .separatorDot behind; renderUncached then renders a dangling trailing dot (or a leading one when the order is reversed). Since this token is expected to disappear dynamically when its allowance is absent, the resolution step should also clean up an adjacent structural separator.

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added 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: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 21, 2026
@clawsweeper

clawsweeper Bot commented Sep 21, 2026

Copy link
Copy Markdown

Codex review: needs changes before merge. Reviewed September 21, 2026, 6:35 AM ET / 10:35 UTC.

ClawSweeper review

What this changes

Adds a selectable Cursor Grok Bot percentage to menu-bar layouts, refreshes it independently, and preserves older-readable layouts alongside new V4 storage.

Merge readiness

Needs changes before merge - 2 items remain

Keep open: the capability is absent from current main and v0.63.0, and this owner-sponsored implementation remains useful. One previously reported rendering defect remains actionable.

Priority: P2
Reviewed head: de88f9407091a0e956ba18e17ab41aaa45415ed9

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The implementation has useful focused coverage and compatibility handling, but the confirmed separator defect prevents a clean correctness verdict.
Proof confidence 🌊 off-meta tidepool Not applicable: The owner-authored PR is exempt from ordinary contributor runtime proof. Inspected synthetic screenshots exercise the production text renderer and show the added percentage, while tests cover persistence and refresh signatures; they do not demonstrate a running status item.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The owner-authored PR is exempt from ordinary contributor runtime proof. Inspected synthetic screenshots exercise the production text renderer and show the added percentage, while tests cover persistence and refresh signatures; they do not demonstrate a running status item.
Evidence reviewed 8 items Repository policy and review boundary: Read the complete root AGENTS.md; no nested AGENTS.md or maintainer-notes directory was found. Applied provider isolation, focused renderer testing, and Keychain safety guidance. Builds and tests were not executed under the read-only review contract; the final working-tree check was clean.
Introduced change and current-main necessity: The pinned base-to-head diff adds the named-extra token, descriptor capability, renderer path, refresh signature, and V4 projections. The base token enum has semantic percentages and three fixed lanes but no named-extra percentage. Existing extra-usage selection reads a spending limit, not Grok Bot’s named allowance.
Latest release boundary: The v0.63.0 token enum also lacks the proposed named-extra percentage, so the latest supplied release does not already implement this feature.
Findings 1 actionable finding [P2] Remove adjacent structural separators when Grok Bot disappears
Security None None.

How this fits together

CodexBar turns provider usage snapshots and saved layout choices into menu-bar text. This change exposes Cursor’s existing Grok Bot allowance through that shared editor and renderer.

flowchart LR
  A[Cursor usage snapshot] --> B[Named allowance eligibility]
  B --> C[Layout editor]
  C --> D[Saved layout and older projections]
  D --> E[Menu-bar renderer]
  B --> E
  A --> F[Refresh change detection]
  F --> E
  E --> G[Percentage and accessibility text]
Loading

Before merge

  • Remove adjacent structural separators when Grok Bot disappears (P2) - With a layout such as Cursor % · Grok Bot %, an unavailable allowance makes this branch remove only the Grok Bot token. renderUncached retains the explicit dot, producing a trailing separator; reversing the order produces a leading one, and a separator-only row remains stacked. The existing cleanup only handles duplicate balance resets. Remove separators orphaned by the missing extra and cover leading, trailing, and middle placements. This confirms the existing review comment.
  • Complete next step (P2) - Remove separators orphaned when Grok Bot becomes unavailable and add focused rendering regressions before merge.

Findings

  • [P2] Remove adjacent structural separators when Grok Bot disappears — Sources/CodexBar/MenuBarLayoutRenderer.swift:601
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Production and test growth Production +214/-58 lines; tests +387/-6 lines Production growth supports the named allowance and compatibility projections, with focused renderer and persistence coverage.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #3309
Summary: This PR implements the canonical request and incorporates work from an overlapping open proposal; neither should be treated as merged.

Members:

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

Technical review

Best possible solution:

Keep the shared named-allowance design and compatibility projections, with unavailable allowances collapsing their structural separators cleanly.

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

Yes, by source inspection: render a Cursor layout containing a percentage, separator dot, and Grok Bot token with no available named window; the dot survives. No runtime reproduction was executed.

Is this the best way to solve the issue?

Yes, extending the existing provider-driven layout path avoids another provider or probe; the separator handling needs a narrow correction.

Full review comments:

  • [P2] Remove adjacent structural separators when Grok Bot disappears — Sources/CodexBar/MenuBarLayoutRenderer.swift:601
    With a layout such as Cursor % · Grok Bot %, an unavailable allowance makes this branch remove only the Grok Bot token. renderUncached retains the explicit dot, producing a trailing separator; reversing the order produces a leading one, and a separator-only row remains stacked. The existing cleanup only handles duplicate balance resets. Remove separators orphaned by the missing extra and cover leading, trailing, and middle placements. This confirms the existing review comment.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.96

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: This is a bounded Cursor display improvement with a concrete rendering defect and no demonstrated urgent user regression.
  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The owner-authored PR is exempt from ordinary contributor runtime proof. Inspected synthetic screenshots exercise the production text renderer and show the added percentage, while tests cover persistence and refresh signatures; they do not demonstrate a running status item.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: The owner-authored PR is exempt from ordinary contributor runtime proof. Inspected synthetic screenshots exercise the production text renderer and show the added percentage, while tests cover persistence and refresh signatures; they do not demonstrate a running status item.

Label justifications:

  • P2: This is a bounded Cursor display improvement with a concrete rendering defect and no demonstrated urgent user regression.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: The owner-authored PR is exempt from ordinary contributor runtime proof. Inspected synthetic screenshots exercise the production text renderer and show the added percentage, while tests cover persistence and refresh signatures; they do not demonstrate a running status item.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The owner-authored PR is exempt from ordinary contributor runtime proof. Inspected synthetic screenshots exercise the production text renderer and show the added percentage, while tests cover persistence and refresh signatures; they do not demonstrate a running status item.

Evidence

Acceptance criteria:

  • [P1] CODEXBAR_SUPPRESS_TEST_KEYCHAIN_ACCESS=1 swift test --filter MenuBarLayoutRendererTests.
  • [P1] CODEXBAR_SUPPRESS_TEST_KEYCHAIN_ACCESS=1 make test.
  • [P1] make check.

What I checked:

  • Repository policy and review boundary: Read the complete root AGENTS.md; no nested AGENTS.md or maintainer-notes directory was found. Applied provider isolation, focused renderer testing, and Keychain safety guidance. Builds and tests were not executed under the read-only review contract; the final working-tree check was clean. (AGENTS.md:1, de88f9407091)
  • Introduced change and current-main necessity: The pinned base-to-head diff adds the named-extra token, descriptor capability, renderer path, refresh signature, and V4 projections. The base token enum has semantic percentages and three fixed lanes but no named-extra percentage. Existing extra-usage selection reads a spending limit, not Grok Bot’s named allowance. (Sources/CodexBar/MenuBarLayout.swift:470, de88f9407091)
  • Latest release boundary: The v0.63.0 token enum also lacks the proposed named-extra percentage, so the latest supplied release does not already implement this feature. (Sources/CodexBar/MenuBarLayout.swift:460, f3e718c897d5)
  • Existing review finding remains valid: The review at feat(cursor): pin Grok Bot usage in menu-bar layouts #3829 (comment) identifies dangling separators. Source confirms unavailable extras resolve to nil, while renderUncached retains explicit separators; the separate separator-cleanup helper only handles duplicate balance resets. (Sources/CodexBar/MenuBarLayoutRenderer.swift:601, de88f9407091)
  • Storage compatibility evidence: The V4 suite covers older-decoder rejection, readable V3 projections preserving explicit resets, startup without V4, unchanged downgrade round trips, and older-version edits across global layouts, overrides, and conditional libraries. Existing SettingsStore tests cover fresh defaults and startup migration. The captured PR body reports 375 focused tests passing; these results were not independently rerun. (Tests/CodexBarTests/MenuBarLayoutV4PersistenceTests.swift:6, de88f9407091)
  • Inspected synthetic screenshots: Inspected both prepared local images: the before image shows 10%, 9%, and 17%; the after image adds 42%. They match the synthetic production-renderer test, not a running status item. The captured body explicitly discloses synthetic inputs and no live account access. Captured context sourceRevision: 7a3e025f54344ad91c04ea34e602517d893a8460e428994b00a54ad0acb4ceb4. (Tests/CodexBarTests/MenuBarLayoutRendererTests.swift:162, de88f9407091)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • vincent-peng: 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.

  • Fix orphaned separators around unavailable named extras and add focused renderer regressions.

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.

steipete added a commit that referenced this pull request Sep 21, 2026
Add descriptor-owned named extra percentages and hide unavailable allowances.
Refresh the strip when Grok Bot changes independently of Cursor's other lanes.
Keep V3/V2/V1 projections beside V4 so downgrades preserve reset choices and
older-version edits still win when upgrading again.

Fixes #3309
Refs #3712

Co-authored-by: yicone <yicone@gmail.com>
(cherry picked from commit de88f94)
steipete added a commit that referenced this pull request Sep 21, 2026
Add descriptor-owned named extra percentages and hide unavailable allowances.
Refresh the strip when Grok Bot changes independently of Cursor's other lanes.
Keep V3/V2/V1 projections beside V4 so downgrades preserve reset choices and
older-version edits still win when upgrading again.

Fixes #3309
Refs #3712

Co-authored-by: yicone <yicone@gmail.com>
(cherry picked from commit de88f94)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Menu bar: pin Cursor Grok Bot weekly usage (extra lane or status item)

1 participant