Status bar items jump to leftmost (hidden) on restart — corrupted NSStatusItem Preferred Position values
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 55/100
Research direction
Start with CodexBar/MenuBarStatusItemPlacementPreflight.swift, StatusItemController+MenuBarLayout.swift, and StatusItemController+MenuRowReordering.swift, focusing on restart, lane recreation, and re-merge paths. Reproduce the issue by inspecting the NSStatusItem Preferred Position defaults before and after restarting CodexBar. Done means status items retain their dragged positions or receive in-bounds values and no longer jump left or become hidden.
Written by the indexing model from the issue text.
Description
Bug
On restart, one or more CodexBar status items (codex / claude / antigravity) jump to the leftmost position of the menu bar, where they collide with the notch / system control-center cluster and become hidden. Dragging them back does not stick — they snap to the front again on the next restart.
Root cause
The NSStatusItem Preferred Position <autosaveName> defaults (macOS status-item autosave; position is measured in points from the right edge of the menu bar) get written as out-of-range values far larger than any screen width. macOS clamps an out-of-range position to the leftmost slot, so the icon ends up at the front of the menu list and gets hidden behind system items.
Evidence
defaults read com.steipete.codexbar right before the fix:
"NSStatusItem Preferred Position codexbar-antigravity" = 614;
"NSStatusItem Preferred Position codexbar-claude" = 501;
"NSStatusItem Preferred Position codexbar-codex" = 6247; ← out of range → clamped to FRONT → hidden
"NSStatusItem Visible codexbar-merged" = 0;
hasRepairedHiddenStatusItemVisibilityDefaults = 1;
Note that only codexbar-codex had the corrupted 6247 value; the other two were sane 3-digit numbers. The user also reports that on every restart, all three items jump to the leftmost position — suggesting the out-of-range write is not limited to a single provider and happens on a restart code path.
Workaround
Deleting the corrupted autosave positions and the hasRepaired flag, then restarting CodexBar, restores sane values:
defaults delete com.steipete.codexbar "NSStatusItem Preferred Position codexbar-codex"
defaults delete com.steipete.codexbar "NSStatusItem Visible codexbar-merged"
defaults delete com.steipete.codexbar hasRepairedHiddenStatusItemVisibilityDefaults
killall CodexBar && open -a CodexBar
After the above, values are sane again:
"NSStatusItem Preferred Position codexbar-antigravity" = 1218;
"NSStatusItem Preferred Position codexbar-claude" = 615;
"NSStatusItem Preferred Position codexbar-codex" = 548;
… but the corruption recurs on subsequent restarts.
Environment
- macOS: 15.7.7
- CodexBar: 0.56.2 (build 133)
- Bundle:
com.steipete.codexbar
Suspected code paths (from DWARF in the binary)
CodexBar/MenuBarStatusItemPlacementPreflight.swiftCodexBar/StatusItemController+MenuBarLayout.swiftCodexBar/StatusItemController+MenuRowReordering.swift
It looks like the autosave position for a status item is being written as an out-of-range value on some restart / lane-(re)creation / re-merge path (e.g. when the codex lane is freshly created or re-merged), instead of being derived from the current screen width or left untouched.
Expected
Status items keep their last user-dragged position across restarts, or are assigned a sane in-bounds position; they should never be written with a value larger than the screen width.
- Dominant language
- Swift
- Stars
- 21.6k
- Forks
- 2k
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 385
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from steipete/CodexBar
-
clawsweeper:needs-live-repro clawsweeper:needs-maintainer-review clawsweeper:no-new-fix-pr impact:ux-friction issue-rating: 🐚 platinum hermit P2
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
clawsweeper:needs-maintainer-review clawsweeper:needs-product-decision clawsweeper:no-new-fix-pr clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster P2
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
clawsweeper:needs-maintainer-review clawsweeper:needs-product-decision clawsweeper:no-new-fix-pr impact:ux-friction issue-rating: 🌊 off-meta tidepool P3
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
clawsweeper:needs-maintainer-review clawsweeper:needs-product-decision clawsweeper:needs-security-review clawsweeper:no-new-fix-pr impact:auth-provider impact:security issue-rating: 🌊 off-meta tidepool P2
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
impact:ux-friction issue-rating: 🦪 silver shellfish P2
Difficulty 3/5 1-2 days Newbie friendliness 65/100
All issues in steipete/CodexBar
Similar issues
-
tvOS
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
skiptools/skip-fuse-ui#147 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
OneBusAway/onebusaway-ios#1438 · 1 reaction ·