Skip to content

Fix empty SwiftUI Settings window - #3056

Merged
steipete merged 1 commit into
steipete:mainfrom
elijahfriedman:fix/blank-settings-window
Aug 18, 2026
Merged

Fix empty SwiftUI Settings window#3056
steipete merged 1 commit into
steipete:mainfrom
elijahfriedman:fix/blank-settings-window

Conversation

@elijahfriedman

Copy link
Copy Markdown
Contributor

Resolves #3053

Summary

Fixes the blank CodexBar Settings window that opens on every launch, including launch at login (#3053).

CodexBarApp.body declares exactly one scene: Settings { EmptyView() }. The real preferences UI moved
to the AppKit SettingsWindowController in #3029, and the hidden keepalive WindowGroup was removed in
#3003 — which shipped in 0.52.0, exactly where the reports start. With the keepalive gone, the empty
Settings scene is the app's only scene, so at launch macOS takes the "open untitled window" path and
SwiftUI fills it with that empty scene: a blank 900×450 "CodexBar Settings" window that has no sidebar
and no controls, because there is nothing in it to render.

Changes

  • AppDelegate.applicationShouldOpenUntitledFile returns false. A menu bar app has no untitled document
    to open at launch or on reopen, and this is what actually keeps the placeholder window from being created.
  • New PlaceholderSettingsWindowGuard (started in applicationWillFinishLaunching) closes any window
    SwiftUI names com_apple_SwiftUI_Settings* — by identifier or frame autosave name — if the system ever
    brings one back through state restoration or a system-sent settings action. It never closes the AppKit
    Settings window: that one is excluded both by identifier (com.steipete.codexbar.settings) and by a live
    identity check against SettingsWindowController.window.

The SwiftUI Settings scene itself stays, so CommandGroup(replacing: .appSettings) keeps owning ⌘, and
the localized application-menu item — it just never gets presented.

Validation

macOS 26.5, freshly packaged bundle, windows enumerated with CGWindowListCopyWindowInfo:

  • Before (installed 0.53.0): a 900×450 window is present in the process window list right after launch —
    the placeholder, reproduced.
  • After: no such window at any point across repeated launches. The guard never fires (no log entry),
    which confirms the untitled-file path was the trigger rather than window restoration.
  • Settings still works: the application menu has exactly one Settings... item; clicking it opens the
    real 800×572 AppKit window with content (AXGroup + 3 AXButton + AXStaticText), ⌘, keeps it, and both
    menu bar status items are present.
  • swift test --filter "AppDelegateTests|PlaceholderSettingsWindowGuardTests" — 7 tests, pass
  • make test — 2 failures in AdaptiveRefreshTimerTests (CancellationError in the two "long idle timer"
    tests). These reproduce identically with this branch's changes stashed, so they are pre-existing timing
    flakiness on this machine, not from this change.
  • make check — 0 violations, no reformatting

Notes

No screenshots: the user-visible change is the absence of a window at launch, which the window-list
evidence above captures more precisely than a screenshot would.

@clawsweeper

clawsweeper Bot commented Aug 18, 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 P1 Urgent regression or broken agent/channel workflow affecting real users now. 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. labels Aug 18, 2026
@clawsweeper

clawsweeper Bot commented Aug 18, 2026

Copy link
Copy Markdown

Codex review: needs maintainer review before merge. Reviewed August 18, 2026, 5:30 PM ET / 21:30 UTC.

ClawSweeper review

What this changes

The branch declines untitled document windows for the menu bar app and closes restored empty SwiftUI Settings placeholders, with focused AppKit tests.

Regression provenance

Possible regression — probable (reproduction; reviewed change; known regression link). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

Keep open. Current main still has the empty SwiftUI Settings scene, while this focused patch prevents its launch-time presentation and preserves the real AppKit Settings window.

Priority: P1
Reviewed head: ef57f242a9559aac8d937831f50a5eff1d3d2850

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused regression repair with direct packaged-app behavior evidence and targeted automated coverage.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The PR body supplies after-fix packaged-app window enumeration and verifies that the menu and shortcut still open the real AppKit Settings window.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body supplies after-fix packaged-app window enumeration and verifies that the menu and shortcut still open the real AppKit Settings window.
Evidence reviewed 6 items Current-main scene: Current main declares an empty SwiftUI Settings scene, but its replacement Settings command calls the app delegate; the branch retains that command path.
Real Settings boundary: The existing AppKit controller gives the real preferences window a distinct identifier and retains/reuses it, allowing the guard to exclude the supported Settings surface.
Patch behavior: The branch refuses the untitled-window request and filters only windows named like the SwiftUI placeholder, excluding the identified AppKit Settings window.
Findings None None.
Security None None.

Live Verification

Command: ./Scripts/compile_and_run.sh

Result: FAIL (failed) — execution before step 1 run: sh -lc pnpm install --ignore-scripts --frozen-lockfile failed: ! Corepack is about to download https://registry.npmjs.org/pnpm/-/pnpm-11.22.0.tgz

sh -lc pnpm install --ignore-scripts --frozen-lockfile failed: ! Corepack is about to download https://registry.npmjs.org/pnpm/-/pnpm-11.22.0.tgz

Assertions:

  • FAIL expect_output: OK: CodexBar is running.

How this fits together

CodexBar uses SwiftUI for application scenes and commands, while an AppKit controller owns the real preferences window. Launch and restoration events enter through the app delegate and should result in no blank window or the retained AppKit Settings window.

flowchart LR
A[macOS launch or reopen] --> B[App delegate]
B --> C[Untitled window policy]
B --> D[Restored window events]
C --> E[SwiftUI Settings placeholder]
D --> F[Placeholder window guard]
E --> F
F --> G[AppKit Settings window]
F --> H[No blank launch window]
Loading

Before merge

  • Complete next step (P2) - No repair lane is needed: the patch is coherent with no actionable review finding, leaving only normal merge and check gating.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Production and test delta production +102, tests +88 The production change is limited to launch/window filtering and has focused coverage for both unwanted and protected windows.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #3053
Summary: This branch is a direct candidate fix for the canonical blank-Settings launch report.

Members:

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

Technical review

Best possible solution:

Land the narrow launch-path fix after normal check gating, retaining the identified AppKit Settings window as the sole preferences UI.

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

Yes from current source and the supplied packaged-app trace: main has the empty scene and lacks the launch refusal, while the PR describes the reproducible launch sequence and after-fix window enumeration.

Is this the best way to solve the issue?

Yes: declining an untitled document window is the narrow fix for a menu bar app, and the fallback guard protects restored placeholders without replacing the retained AppKit Settings path.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P1: The linked release regression opens an unwanted blank Settings window during every normal launch.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body supplies after-fix packaged-app window enumeration and verifies that the menu and shortcut still open the real AppKit Settings window.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body supplies after-fix packaged-app window enumeration and verifies that the menu and shortcut still open the real AppKit Settings window.

Label justifications:

  • P1: The linked release regression opens an unwanted blank Settings window during every normal launch.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body supplies after-fix packaged-app window enumeration and verifies that the menu and shortcut still open the real AppKit Settings window.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body supplies after-fix packaged-app window enumeration and verifies that the menu and shortcut still open the real AppKit Settings window.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Current-main blame attributes the SwiftUI Settings/app-delegate boundary to Peter, and the related lifecycle change merged as commit 4b4abd9. (role: recent lifecycle and Settings-area contributor; confidence: high; commits: 4b4abd9467b5, 5a2a70458d95; files: Sources/CodexBar/CodexbarApp.swift)
  • Zihao Qi: The related Settings-window implementation merged as commit 96ee5e1 and established the AppKit controller deliberately preserved here. (role: retained Settings-window contributor; confidence: high; commits: 96ee5e1cad84; files: Sources/CodexBar/SettingsWindowController.swift)

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
steipete merged commit f16c55c into steipete:main Aug 18, 2026
9 checks passed
steipete added a commit that referenced this pull request Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P1 Urgent regression or broken agent/channel workflow affecting real users now. 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.

CodexBar 0.53.0 always opens a blank Settings window on macOS 26.6.2

2 participants