chore(menu-bar): add bounded Control Center startup diagnostics - #4012
Conversation
Record opt-in startup state for the unresolved Tahoe hosting report in #3377. Preserve recovery policy and remove unused screen-count bookkeeping. Document a signed diagnostic build and reporter capture recipe.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a4d54ab16b
ℹ️ 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".
| @MainActor static func trace(_ stage: String, item: NSStatusItem? = nil, evidence: String = "") { | ||
| guard self.diagnosticsEnabled, self.diagnosticRecords < 128 else { return } | ||
| self.diagnosticRecords += 1 |
There was a problem hiding this comment.
Reserve records for the lifecycle checkpoints
With merged icons disabled and 41 or more enabled first-party providers, the two launch traces plus three creation traces per status item exhaust this 128-record cap before scheduleStartupStatusItemVisibilityCheck emits rendered, startup-check, or settled. That leaves precisely the large multi-icon configurations most likely to expose hosting problems without the before/after lifecycle snapshots the diagnostic document asks reporters to compare; reserve capacity for those stages or stop emitting per-item creation records once the reserve is reached.
Useful? React with 👍 / 👎.
|
Codex review: needs changes before merge. Reviewed September 25, 2026, 11:25 PM ET / September 26, 2026, 03:25 UTC (Revision 3). ClawSweeper reviewWhat this changesAdds opt-in JSON diagnostics for menu-bar item creation and Control Center windows, simplifies display-change bookkeeping, and adds tests and diagnostic-build instructions. Merge readiness⛔ Needs changes before merge - 2 items remain Keep open: current main lacks the startup evidence needed for the Tahoe investigation, and the record-cap defect identified in the previous review remains on this head. The underlying hosting failure remains tracked at #3377. Priority: P2 Review scores
Verification
How this fits togetherCodexBar turns provider settings into macOS menu-bar items, which Control Center hosts. A startup watcher checks those items for visibility problems; the new diagnostics sample that path and write JSON to stdout. flowchart LR
A[Provider settings] --> B[Status item controller]
B --> C[AppKit menu items]
C --> D[Control Center windows]
C --> E[Opt-in diagnostics]
D --> E
B --> F[Startup visibility check]
E --> G[JSON stdout]
Before merge
Findings
Agent review detailsSecurityNone. Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Keep the trace bounded while coalescing creation data or reserving capacity for the later lifecycle samples; use the resulting signed production-identity build to investigate the still-open Tahoe failure. Do we have a high-confidence way to reproduce the issue? Not applicable to the diagnostic addition. The linked Tahoe hosting failure is reported on an affected machine, but this branch does not reproduce or fix it. Is this the best way to solve the issue? No, not yet: the shared record cap can discard the comparison stages the diagnostic is meant to capture. Reserving or coalescing those records is the narrow repair. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 56bf55bd9b69. LabelsLabel changes: No label changes. Label justifications:
EvidenceAcceptance criteria:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
The status-item cleanup removed two stored fields, moving the unchanged Codex metric branch from line 349 to 347. Preserve its existing anchor, fingerprint, and justification.
CodexBar can remain alive on Tahoe while Control Center creates no hosted status-item window (#3377). The new 0.66.0 report persists with fresh preferences, a single display, and Bartender stopped. Current source does not establish the cause, so this change adds opt-in startup evidence and leaves recovery decisions unchanged.
CODEXBAR_STATUS_ITEM_DIAGNOSTICS=1emits at most 128 JSON records covering launch, zero-width creation, stable naming, sizing, rendering, the startup check, and a 15-second settled sample. Records include AppKit state/geometry, expected visibility, activation policy, recognized placeholder windows, and Control Center window counts/numbers and named candidates. It does not log window titles, provider content, or credentials. Missing/redacted names are not treated as proof of hosting failure.The nearby cleanup shares startup recovery diagnostics and removes unused screen-count decision parameters/bookkeeping. Existing debounce, guidance gates, and bounded retry behavior are preserved. Documentation includes a debug-only production-identity build recipe and the reporter capture command. Keep #3377 open pending the affected-machine capture; no diagnostic artifact has been distributed and no runtime hosting fix is claimed.
Validation:
CODEXBAR_SUPPRESS_TEST_KEYCHAIN_ACCESS=1 swift test --jobs 2 --filter 'StatusItem.*Tests|MenuBar(StatusItem|VisibilityWatcher|Layout).*Tests|ProviderArchitectureGatekeeperTests|AppDelegateTests'passed: 495 tests in 29 suites, zero failures. This ran onea10876a4a00; the diagnostic runtime files and diagnostic/visibility tests are byte-identical after the subsequent upstream merge.make checkpassed:0/2665 files require formatting, 6 files skipped.andFound 0 violations, 0 serious in 2664 files..buildwas removed after final verification; the full sharded suite was not run locally.ProviderArchitectureGatekeeperTestspassed locally. CI is rerunning for the final integrated head.scoped-clean, no actionable findings. Both documented shell blocks passedbash -nwithout execution.git diff --checkpassed.The running app was not relaunched or reconfigured, and no real-account provider probes were run. Synthetic tests cover owner/layer filtering, duplicate and redacted names, exclusion of unrelated titles, and the unchanged no-record recovery decision. Regression red→green is established for the CI anchor correction, not for the unresolved hosting bug.
Refs #3377
Refs #3355
Refs #3201