Skip to content

Add Ghostty theme picker to the command palette#1149

Open
debgotwired wants to merge 5 commits intomanaflow-ai:mainfrom
debgotwired:feat/ghostty-theme-command-palette
Open

Add Ghostty theme picker to the command palette#1149
debgotwired wants to merge 5 commits intomanaflow-ai:mainfrom
debgotwired:feat/ghostty-theme-command-palette

Conversation

@debgotwired
Copy link
Copy Markdown

@debgotwired debgotwired commented Mar 10, 2026

Summary

  • add a Ghostty Theme menu entry in the command palette that opens a focused theme submenu
  • discover available Ghostty themes from standard Ghostty resource and config search paths and mark the currently configured theme
  • apply the selected theme by updating the Ghostty config, invalidating the config cache, and reloading Ghostty configuration
  • add unit coverage for theme discovery and config upsert/create behavior

Testing

  • swiftc -parse Sources/GhosttyConfig.swift Sources/ContentView.swift cmuxTests/GhosttyConfigTests.swift
  • git diff --check
  • xcodebuild tests not run in this environment because the active developer directory points to Command Line Tools rather than a full Xcode install

Scope notes

Closes #526


Summary by cubic

Adds a Ghostty Theme picker to the command palette with a focused submenu that discovers installed themes, highlights the current one, and applies the selection by updating config and reloading Ghostty. Implements the command‑palette theme submenu from #526 and hardens async loading, validation, and config handling.

  • New Features

    • Adds “Ghostty Theme…” command with Back action, search placeholder, and loading/empty entries; hides empty text while themes are loading.
    • Discovers themes from env, app bundle, XDG_DATA_DIRS, and user dirs; case‑insensitive de‑dupe without diacritic folding; ignores non‑regular files. Marks the current theme and applies selection by updating the last active theme line, preserving light/dark variants and fallback; creates the config if missing, invalidates cache, and reloads.
    • Localization: adds Japanese translations for all new command‑palette strings.
  • Bug Fixes

    • Picks the highest‑precedence writable config file; reads current appearance on the main actor; validates theme names (rejects empty, newline, comma, .., /); avoids clobbering unreadable configs.
    • Hardens async loading: request‑token guard to prevent stale results, early cancellation on exit/query change, and clears task refs; uses defer in invalidateLoadCache; minor upsert cleanup. Adds tests for precedence, validation, discovery, and apply flows.

Written for commit 3f37356. Summary will update on new commits.

Summary by CodeRabbit

  • New Features

    • Ghostty theme submenu in the command palette to browse and apply themes; UI updates for submenu placeholders and empty states.
    • Automatic discovery of Ghostty themes across app and system locations with case-insensitive deduplication; applying a theme updates or creates config while preserving light/dark variants and fallbacks.
  • Localization

    • Added localized UI strings for Ghostty theme commands, statuses, and menu labels in multiple languages.
  • Tests

    • Extensive tests for discovery, application, variant preservation, config precedence, and edge cases.

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 10, 2026

@debgotwired is attempting to deploy a commit to the Manaflow Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 10, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds a Ghostty Theme submenu to the command palette and implements theme discovery, selection, and config mutation APIs, with unit tests and new localized strings for Ghostty theme UI and loading/empty states.

Changes

Cohort / File(s) Summary
Command palette submenu
Sources/ContentView.swift
Adds submenu enum/state for Ghostty themes, lifecycle handlers (enter/exit/reset), commands generation for theme list, loading/refresh/apply flows, deterministic command IDs, and updates to palette placeholder/empty texts.
Theme discovery & config APIs
Sources/GhosttyConfig.swift
Introduces ThemeSettingComponents, centralized theme discovery/search-path helpers, config search/writable-path resolution, config mutation helpers (upsertConfigValue, applyTheme, updatedThemeValueForSelection), parsing helpers, and refactors resolveThemeName to use the new helpers.
Tests
cmuxTests/GhosttyConfigTests.swift
Adds comprehensive tests covering theme discovery (multi-dir, dedupe, regular-file filtering), validation of theme names, config write/update behaviors (preserve variants, update last active assignment, create config), and writable-path precedence.
Localization
Resources/Localizable.xcstrings
Adds localized strings for Ghostty theme UI: menu titles, loading/current/empty states, back action and palette placeholder/empty messages across multiple locales.

Sequence Diagram

sequenceDiagram
    actor User
    participant Palette as "Command Palette\n(ContentView)"
    participant Ghostty as "GhosttyConfig"
    participant FS as "File System"

    User->>Palette: Open palette / invoke Ghostty Theme submenu
    Palette->>Palette: set submenu = ghosttyThemes
    Palette->>Ghostty: discoverThemeNames()
    Ghostty->>FS: scan theme search directories
    FS-->>Ghostty: return theme files
    Ghostty-->>Palette: return theme list
    Palette->>User: display theme list
    User->>Palette: choose theme "X"
    Palette->>Ghostty: applyTheme("X")
    Ghostty->>FS: read/update config file(s)
    FS-->>Ghostty: confirm write
    Ghostty-->>Palette: return applied theme value
    Palette->>Palette: clear submenu / dismiss
    Palette-->>User: theme applied
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐇 I hopped through folders, sniffed each theme by name,
The palette opened wide — I called a new color frame.
I nudged a line, saved a file, watched light and dark align,
A tiny hop, a chosen theme — the UI looks divine.
Nose twitch, I thump in glee, new Ghostty colors shine!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the primary change: adding a Ghostty theme picker to the command palette.
Description check ✅ Passed The PR description includes all required sections: Summary, Testing, and Scope notes. It clearly explains what changed and why, lists testing approaches, and addresses the linked issue.
Linked Issues check ✅ Passed The PR implements the command-palette theme submenu from #526: discovers themes, shows them in submenu, marks current theme, and applies selection immediately by updating config.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing the Ghostty Theme submenu in the command palette. Sidebar theme-awareness is explicitly deferred as follow-up scope in the PR description.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Comment @coderabbitai help to get the list of available commands and usage tips.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 10, 2026

Greptile Summary

This PR adds a Ghostty Theme picker to the command palette: a focused submenu that discovers installed themes from standard Ghostty resource paths, marks the currently active theme with a ✓, and applies a selection by updating the Ghostty config file and reloading.

  • All three issues flagged in the previous review round are addressed: the ✓ indicator now correctly routes through resolveThemeName for light/dark variant configs, disk I/O is moved off the main thread via Task.detached, and command IDs use hex-encoded UTF-8 bytes instead of locale-sensitive lowercased().
  • Logic issue (applyTheme / upsertConfigValue): both functions read the existing config with (try? String(contentsOf: url, encoding: .utf8)) ?? "". If the file exists but cannot be decoded as UTF-8, the error is silently swallowed, existing is treated as empty, and the subsequent write overwrites the entire config with just the new entry — destroying all other user settings. The fix is to distinguish "file does not exist" from "file unreadable" and propagate the latter as a thrown error.
  • Logic issue (theme name injection): themeName is written verbatim into the config line without sanitization. A theme filename containing a newline would inject additional lines into the config; a name containing a comma would produce an unparseable variant string. A brief validation guard before writing would prevent this.
  • Style (writableConfigPath): the ?? NSString(…).expandingTildeInPath fallback is unreachable dead code, and the hardcoded fallback path (.ghostty extension) differs from what .first would actually return.

Confidence Score: 3/5

  • Safe to merge with caution — the feature works correctly for typical users, but a silent config-destruction path exists under unusual (non-UTF-8 file) conditions.
  • The UI integration and async loading are solid, and all prior review comments are addressed. The score is held back by the silent-read-error data-loss path in applyTheme/upsertConfigValue (which would wipe the user's entire Ghostty config if the file exists but can't be decoded) and the unvalidated theme name write (which can corrupt the config if a filesystem entry contains a newline or comma).
  • Sources/GhosttyConfig.swift — specifically the applyTheme and upsertConfigValue functions around the (try? String(contentsOf:)) ?? "" read pattern and the unvalidated write of themeName into the config.

Important Files Changed

Filename Overview
Sources/GhosttyConfig.swift Adds theme discovery, config upsert, and applyTheme logic. Two logic issues found: (1) silent UTF-8 read errors in applyTheme/upsertConfigValue can silently destroy the entire config by treating an unreadable file as empty before overwriting it; (2) theme filenames with newlines or commas are written verbatim into the config, causing corruption. The themeSettingComponents refactor is clean and the deduplication/sorting logic is correct.
Sources/ContentView.swift Adds Ghostty theme submenu to the command palette. Async loading via Task.detached is correctly handled with MainActor.run, the ✓ indicator correctly routes through resolveThemeName addressing the previous review comment, command IDs use hex-encoded UTF-8 bytes (addressing the prior collision concern), and all submenu state is cleaned up on dismiss/reset.
cmuxTests/GhosttyConfigTests.swift Good unit coverage for theme discovery, deduplication, symlink exclusion, last-write-wins semantics, light/dark variant preservation, and config creation from scratch. Tests use real temp directories and clean up with defer blocks.

Sequence Diagram

sequenceDiagram
    participant User
    participant CommandPalette as Command Palette (ContentView)
    participant Task as Task.detached
    participant GhosttyConfig
    participant Disk as Config File (Disk)

    User->>CommandPalette: Select "Ghostty Theme…"
    CommandPalette->>CommandPalette: enterCommandPaletteGhosttyThemeMenu()
    CommandPalette->>Task: Task.detached { discoverThemeNames + load() }
    Task->>Disk: contentsOfDirectory (theme dirs)
    Task->>Disk: read config file (resolveThemeName)
    Task-->>CommandPalette: await MainActor.run { update state }
    CommandPalette->>CommandPalette: scheduleCommandPaletteResultsRefresh()
    CommandPalette-->>User: Show theme list with ✓ on current theme

    User->>CommandPalette: Select a theme
    CommandPalette->>GhosttyConfig: applyTheme(themeName, colorScheme)
    GhosttyConfig->>Disk: read existing config
    GhosttyConfig->>GhosttyConfig: updatedThemeValueForSelection()
    GhosttyConfig->>Disk: write updated config (atomically)
    CommandPalette->>GhosttyConfig: invalidateLoadCache()
    CommandPalette->>CommandPalette: reloadConfiguration()
Loading

Last reviewed commit: faeb59f

)

for (index, themeName) in themes.enumerated() {
let isCurrentTheme = currentTheme?.localizedCaseInsensitiveCompare(themeName) == .orderedSame
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✓ indicator never fires for light/dark variant themes

GhosttyConfig.load().theme returns the raw config value exactly as written in the file (e.g. "light:Nord,dark:Nord Dark"). The comparison against individual theme names like "Nord" will always be false for any user whose config uses the light:X,dark:Y variant syntax, so the ✓ indicator will never show for those users.

The fix is to resolve the raw value through GhosttyConfig.resolveThemeName before comparing:

let resolvedTheme = currentTheme.flatMap { raw in
    GhosttyConfig.resolveThemeName(
        from: raw,
        preferredColorScheme: GhosttyConfig.currentColorSchemePreference()
    )
}
let isCurrentTheme = resolvedTheme?.localizedCaseInsensitiveCompare(themeName) == .orderedSame

Comment on lines +3888 to +3890
private func commandPaletteGhosttyThemeCommands() -> [CommandPaletteCommand] {
let currentTheme = GhosttyConfig.load(useCache: false).theme?.trimmingCharacters(in: .whitespacesAndNewlines)
let themes = GhosttyConfig.discoverThemeNames()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Synchronous disk I/O on the main thread

Both GhosttyConfig.load(useCache: false) (which reads config files from disk) and GhosttyConfig.discoverThemeNames() (which walks one or more directories with contentsOfDirectory) are called synchronously here. This function is invoked on the main thread as part of the command palette rendering pass. For users with Ghostty's full bundled theme library (hundreds of files) spread across multiple search directories, or a networked/slow volume, this can produce perceptible UI jank each time the submenu is opened or its search query changes.

Consider loading themes asynchronously (e.g., with a Task) and caching the result for the lifetime of the submenu session, updating the list once the async work completes.


for child in children {
let values = try? child.resourceValues(forKeys: [.isRegularFileKey, .isDirectoryKey])
guard values?.isRegularFile == true || values?.isDirectory == false else { continue }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Guard condition also admits non-regular, non-directory entries

guard values?.isRegularFile == true || values?.isDirectory == false else { continue }

The condition isDirectory == false is true for symlinks, sockets, pipes, and other special files in addition to regular files. If a user's theme directory contains a non-file entry (e.g., a named socket left by another tool), it would be added to the discovered list and shown in the palette even though it is not a valid theme.

The intent appears to be "include only regular files", which a simpler guard expresses more directly:

Suggested change
guard values?.isRegularFile == true || values?.isDirectory == false else { continue }
guard values?.isRegularFile == true else { continue }

let isCurrentTheme = currentTheme?.localizedCaseInsensitiveCompare(themeName) == .orderedSame
commands.append(
CommandPaletteCommand(
id: "palette.ghosttyTheme.\(themeName.lowercased())",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Command ID collision for themes with same lowercased name but different original casing

discoverThemeNames deduplicates using a folded+lowercased normalized key (e.g., both "Nord" and "nord" → key "nord"), so only the first-seen variant survives. However, the command ID here uses only Swift.lowercased(), which is locale-dependent (Turkish-locale "I".lowercased()"ı"). For the common ASCII case this is benign, but in edge cases the generated ID may not match the normalization key used during dedup, making the pairing fragile.

More importantly, if discoverThemeNames ever emits two themes whose names only differ in non-ASCII characters that lowercased() collapses to the same string (but folding(options:…) kept distinct), the two entries would get identical command IDs, which could cause unexpected palette behaviour. A safer approach is to use a hash or a stable base64 encoding of the original name as the ID suffix.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 issues found across 3 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="Sources/GhosttyConfig.swift">

<violation number="1" location="Sources/GhosttyConfig.swift:485">
P2: Restrict theme discovery to regular files only; this condition also allows non-directory special entries, which can add invalid items to the theme list.</violation>

<violation number="2" location="Sources/GhosttyConfig.swift:539">
P2: `upsertConfigValue` replaces the first matching key, which can leave a later duplicate `theme` entry overriding the newly selected theme.</violation>
</file>

<file name="Sources/ContentView.swift">

<violation number="1" location="Sources/ContentView.swift:3908">
P2: Resolve variant theme expressions before comparing to individual theme names; otherwise `light:...,dark:...` values will never mark the active theme correctly.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
Sources/ContentView.swift (1)

3928-3945: Reset the submenu when the query leaves command mode.

Right now the Ghostty theme submenu is only cleared by Back/dismiss. If the user backspaces the leading > while inside this submenu, the UI switches to workspace search but the hidden submenu state survives, so typing > again drops them back into Ghostty Themes instead of the root command list. Clearing commandPaletteCommandSubmenu when the prefix is removed would keep the visible mode and internal mode aligned.

♻️ Suggested change
         .onChange(of: commandPaletteQuery) { _ in
+            if !commandPaletteQuery.hasPrefix(Self.commandPaletteCommandsPrefix) {
+                commandPaletteCommandSubmenu = nil
+            }
             commandPaletteSelectedResultIndex = 0
             commandPaletteSelectionAnchorCommandID = nil
             commandPaletteHoveredResultIndex = nil
             commandPaletteScrollTargetIndex = nil
             commandPaletteScrollTargetAnchor = nil
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Sources/ContentView.swift` around lines 3928 - 3945, The submenu state
(commandPaletteCommandSubmenu) isn't cleared when the user backspaces out of the
command prefix, leaving the hidden Ghostty submenu active; fix this by clearing
commandPaletteCommandSubmenu when the query leaves command mode (i.e., when
commandPaletteQuery no longer starts with Self.commandPaletteCommandsPrefix) —
either call exitCommandPaletteGhosttyThemeMenu or set
commandPaletteCommandSubmenu = nil in the routine that updates
commandPaletteQuery (the query-change handler), and then call
scheduleCommandPaletteResultsRefresh(...) / resetCommandPaletteSearchFocus() /
syncCommandPaletteDebugStateForObservedWindow() as appropriate to keep UI state
consistent.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@Sources/GhosttyConfig.swift`:
- Around line 538-553: The loop in GhosttyConfig.parse(_:) replaces the first
active occurrence of a key (e.g., "theme") instead of the last one, causing
last-write-wins semantics to be violated; change the logic to target the last
active matching line by either iterating lines.indices.reversed() or recording
the matching index (e.g., lastMatchIndex) during the forward pass and performing
the replacement after the loop, then set replaced = true and break/exit
appropriately so the final active key is updated (reference: variables lines,
trimmed, parts, rawKey, indentation and the replacement assignment lines[index]
= ...).

---

Nitpick comments:
In `@Sources/ContentView.swift`:
- Around line 3928-3945: The submenu state (commandPaletteCommandSubmenu) isn't
cleared when the user backspaces out of the command prefix, leaving the hidden
Ghostty submenu active; fix this by clearing commandPaletteCommandSubmenu when
the query leaves command mode (i.e., when commandPaletteQuery no longer starts
with Self.commandPaletteCommandsPrefix) — either call
exitCommandPaletteGhosttyThemeMenu or set commandPaletteCommandSubmenu = nil in
the routine that updates commandPaletteQuery (the query-change handler), and
then call scheduleCommandPaletteResultsRefresh(...) /
resetCommandPaletteSearchFocus() /
syncCommandPaletteDebugStateForObservedWindow() as appropriate to keep UI state
consistent.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 078f2575-3971-4b22-ab83-fa6a161075a6

📥 Commits

Reviewing files that changed from the base of the PR and between dea60ea and b7a7501.

📒 Files selected for processing (3)
  • Sources/ContentView.swift
  • Sources/GhosttyConfig.swift
  • cmuxTests/GhosttyConfigTests.swift

@debgotwired
Copy link
Copy Markdown
Author

Pushed a follow-up fix pass in faeb59fc that addresses the substantive review comments and a couple of adjacent correctness issues I found while working through them.

What changed:

  • preserved light: / dark: variant theme config when applying a new theme, instead of flattening it to a single value
  • resolved the current-theme checkmark against the active variant so light:... / dark:... configs mark the correct selected theme
  • updated config upserts to replace the last active key occurrence instead of the first
  • limited theme discovery to regular files only
  • moved Ghostty theme discovery/current-theme loading off the main thread and cached it for the submenu session
  • reset submenu state when leaving command mode so stale Ghostty theme state does not leak across palette flows
  • aligned config search path ordering with loadFromDisk
  • hardened theme command IDs so unusual theme names cannot collide or produce awkward identifiers

Tests/verification here:

  • added focused unit coverage for regular-file filtering, last-write-wins config updates, and light/dark variant preservation
  • swiftc -parse passed on the touched Swift files
  • git diff --check passed

Attribution note: the variant indicator / regular-file issues were specifically called out by cubic, the variant-overwrite and main-thread I/O risks came from Greptile, and the last-write-wins + submenu-reset issues came from CodeRabbit.

@codex review
@coderabbitai review
@greptile-apps review
@cubic-dev-ai review

@cubic-dev-ai
Copy link
Copy Markdown

cubic-dev-ai bot commented Mar 10, 2026

Pushed a follow-up fix pass in faeb59fc that addresses the substantive review comments and a couple of adjacent correctness issues I found while working through them.

What changed:

  • preserved light: / dark: variant theme config when applying a new theme, instead of flattening it to a single value
  • resolved the current-theme checkmark against the active variant so light:... / dark:... configs mark the correct selected theme
    ...

@debgotwired I have started the AI code review. It will take a few minutes to complete.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 10, 2026

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Inspect the changes in the follow-up commit faeb59fc
git show faeb59fc --stat
echo "---"
git show faeb59fc -- Sources/GhosttyConfig.swift
echo "---"
git show faeb59fc -- Sources/ContentView.swift
echo "---"
git show faeb59fc -- cmuxTests/GhosttyConfigTests.swift

Length of output: 24417


@debgotwired — solid follow-up pass. I've gone through the full diff of faeb59fc against each concern that was raised. Here's the verdict:


✅ All substantive issues addressed

Concern Resolution
light:/dark: variant overwrite updatedThemeValueForSelection with ThemeSettingComponents.hasExplicitVariants gate
Checkmark against active variant resolveThemeName called before comparing in refreshCommandPaletteGhosttyThemeData
First-match vs last-match upsert lastActiveConfigAssignment iterates lines.indices.reversed()
Non-regular-file discovery guard values?.isRegularFile == true (drops the old ‖ values?.isDirectory == false dead branch)
Main-thread I/O Task.detached(priority: .userInitiated) + await MainActor.run
Stale theme state leaking Cancelled + nil'd in exitCommandPaletteGhosttyThemeMenu, resetCommandPaletteListState, dismissCommandPalette, and the onChange(of: commandPaletteQuery) guard
Search-path ordering configSearchPaths() now puts XDG paths before Library paths, matching loadFromDisk
Theme command ID collisions Hex-encoded UTF-8 — safe for any Unicode theme name

Minor observations (no action required)

  1. Variant reconstruction orderupdatedThemeValueForSelection always emits fallback,light:…,dark:… regardless of the original order in the user's config. If someone wrote dark:Solarized Dark,light:Solarized Light, the rewritten line will swap the order. Functionally equivalent, cosmetically divergent from the user's style. Worth noting but not a correctness bug.

  2. Optimistic commandPaletteGhosttyResolvedCurrentTheme = themeName in applyGhosttyThemeFromPalette — intentional and correct: the picker lists individual theme names and the resolved string is compared per-name, so the plain name is the right value to store immediately after a successful apply.

  3. lastActiveConfigAssignment strips only " from values — single-quote stripping not done, but Ghostty config doesn't use single-quoted strings so this is a non-issue.

  4. configLines(from:) trailing-newline handling — correctly drops the phantom empty element that components(separatedBy: .newlines) appends when the string ends with \n. Reconstructed output re-appends \n on write. Round-trip is clean.


Test coverage assessment

The five new tests cover all the newly introduced logic paths:

  • testDiscoverThemeNamesIgnoresNonRegularFiles — symlink exclusion
  • testApplyThemeUpdatesLastActiveThemeEntry — last-write-wins
  • testApplyThemePreservesLightDarkThemeVariantsForLightMode/DarkMode/FallbackAlongsideVariants — variant preservation matrix

The updatedThemeValueForSelection(existingThemeValue: nil, …) path (plain new config) is already covered by testApplyThemeUpdatesExistingThemeLine and testApplyThemeCreatesConfigWhenMissing.


The PR is in good shape.

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

try fileManager.createDirectory(at: url.deletingLastPathComponent(), withIntermediateDirectories: true)

let existing = (try? String(contentsOf: url, encoding: .utf8)) ?? ""
var lines = configLines(from: existing)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Silent read failure silently destroys existing config

Both applyTheme (line 562) and upsertConfigValue (line 506) use (try? String(contentsOf: url, encoding: .utf8)) ?? "" to read the existing config. If the file exists but cannot be decoded — for example because it was saved in a non-UTF-8 encoding — the error is silently swallowed, existing becomes "", and the function immediately overwrites the entire file with just the new single-key entry, destroying all other settings.

The safer pattern is to distinguish "file does not exist" (treat as empty) from "file exists but is unreadable" (propagate the error):

let existing: String
if fileManager.fileExists(atPath: path) {
    existing = try String(contentsOf: url, encoding: .utf8)
} else {
    existing = ""
}

The same fix applies in applyTheme at line 562.

Comment on lines +576 to +578
selectedTheme: String,
preferredColorScheme: ColorSchemePreference
) -> String {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Theme name containing newline or comma corrupts the config file

nextThemeValue is written verbatim into the config line. A theme filename containing a newline character (\n) would cause "theme = \(nextThemeValue)" to become a multi-line string, injecting extra content into the config. Commas or colons in the theme name (e.g., "Night: Dark") would produce an unparseable variant string like "light:Night: Dark,dark:…".

Because themeName originates from filenames discovered on disk, these characters are legal at the OS level even if unusual. A simple guard before writing would prevent the issue:

guard !themeName.contains(where: { $0.isNewline || $0 == "," }) else {
    throw CocoaError(.fileWriteUnknown) // or a dedicated error type
}

Comment on lines +483 to +494
static func writableConfigPath(
fileManager: FileManager = .default,
searchPaths: [String]? = nil
) -> String {
let resolvedSearchPaths = searchPaths ?? configSearchPaths()
for path in resolvedSearchPaths where fileManager.fileExists(atPath: path) {
return path
}
return resolvedSearchPaths.first ?? NSString(string: "~/.config/ghostty/config.ghostty").expandingTildeInPath
}

@discardableResult
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

writableConfigPath fallback is unreachable dead code

configSearchPaths() always returns a hardcoded list of four non-empty strings, so resolvedSearchPaths can never be empty and resolvedSearchPaths.first will always return a non-nil value. The ?? NSString(string: "~/.config/ghostty/config.ghostty").expandingTildeInPath branch is dead code. Additionally, the fallback path (config.ghostty) differs from what .first would return (config, without the .ghostty extension), which could cause confusion if the reachability assumption ever changes.

return resolvedSearchPaths.first!  // safe: configSearchPaths() is always non-empty

Or just inline the first path if you want to be explicit.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

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: faeb59fcdb

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

Comment on lines +487 to +490
let resolvedSearchPaths = searchPaths ?? configSearchPaths()
for path in resolvedSearchPaths where fileManager.fileExists(atPath: path) {
return path
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Write theme changes to effective Ghostty config file

loadFromDisk parses all config paths in order, so later files override earlier ones, but writableConfigPath currently returns the first existing file. In setups where both ~/.config/ghostty/config and ~/.config/ghostty/config.ghostty (or App Support equivalents) exist, theme changes are written to the lower-precedence file and then immediately overridden on reload, so selecting a theme appears to have no effect.

Useful? React with 👍 / 👎.

Comment on lines +4009 to +4012
commandPaletteGhosttyThemeLoadTask = Task.detached(priority: .userInitiated) {
let preferredColorScheme = GhosttyConfig.currentColorSchemePreference()
let resolvedCurrentTheme = (
GhosttyConfig.load(useCache: false).theme.map {
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 Read AppKit appearance on the main actor

This detached background task calls GhosttyConfig.currentColorSchemePreference(), which reads NSApp?.effectiveAppearance (AppKit UI state), and GhosttyConfig.load(useCache: false) also defaults through that same path when no scheme is passed. Calling AppKit appearance APIs off-main can trigger thread-safety violations and intermittently resolve the wrong active variant; capture the color scheme on the main actor before launching the detached work and pass it through explicitly.

Useful? React with 👍 / 👎.

contributions.append(
CommandPaletteCommandContribution(
commandId: "palette.ghosttyThemeMenu",
title: constant(String(localized: "command.ghosttyThemeMenu.title", defaultValue: "Ghostty Theme…")),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Add new Ghostty menu keys to localization catalog

Per /workspace/cmux/AGENTS.md, all user-facing strings must be localized in Resources/Localizable.xcstrings for supported languages, but this commit introduces new keys (for example command.ghosttyThemeMenu.title) without adding catalog entries. I checked the catalog in this commit and these keys are absent, so the new Ghostty theme palette UI falls back to English instead of localized text.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 3 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="Sources/ContentView.swift">

<violation number="1" location="Sources/ContentView.swift:4010">
P2: This detached task reads AppKit appearance state off the main actor. Resolve the color scheme on `MainActor` and pass it into `GhosttyConfig.load` to avoid background-thread AppKit access.</violation>
</file>

<file name="Sources/GhosttyConfig.swift">

<violation number="1" location="Sources/GhosttyConfig.swift:488">
P2: `writableConfigPath` picks the first existing config file, which conflicts with read precedence and can make theme updates ineffective when multiple config files exist.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 10, 2026

Caution

Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted.

Error details
{"name":"HttpError","status":500,"request":{"method":"PATCH","url":"https://api.github.com/repos/manaflow-ai/cmux/issues/comments/4029434460","headers":{"accept":"application/vnd.github.v3+json","user-agent":"octokit.js/0.0.0-development octokit-core.js/7.0.6 Node.js/24","authorization":"token [REDACTED]","content-type":"application/json; charset=utf-8"},"body":{"body":"<!-- This is an auto-generated comment: summarize by coderabbit.ai -->\n<!-- walkthrough_start -->\n\n<details>\n<summary>📝 Walkthrough</summary>\n\n## Walkthrough\n\nAdds a Ghostty Themes submenu to the command palette (ContentView), implements submenu lifecycle and theme-application flows, extends GhosttyConfig with discovery, search and config upsert APIs, and adds unit tests validating discovery and apply/update behaviors.\n\n## Changes\n\n|Cohort / File(s)|Summary|\n|---|---|\n|**Command Palette / UI** <br> `Sources/ContentView.swift`|Adds submenu state and enum for `ghosttyThemes`, submenu lifecycle methods (enter/exit), command generation/ID mapping, placeholder/empty-state branching, handlers registration (`palette.ghosttyThemeMenu`), integration into `commandPaletteCommands()`, and state reset/dismiss logic to cancel and clear ghostty load state.|\n|**Theme discovery & config APIs** <br> `Sources/GhosttyConfig.swift`|New and refactored static APIs: theme search directory aggregation, theme discovery/enumeration, theme search paths, config search/writable path resolution, upsert/apply theme with preserved variant logic, helpers for parsing/updating config lines, and cancellation/atomic update-friendly behavior.|\n|**Tests** <br> `cmuxTests/GhosttyConfigTests.swift`|Adds tests covering theme discovery (merging, case-insensitive dedupe, ignoring non-regular files), applying themes (updating last active entry, preserving light/dark/fallback variants), and creating config files when missing.|\n\n## Sequence Diagram\n\n```mermaid\nsequenceDiagram\n    participant User as User\n    participant UI as Command Palette\\n(ContentView)\n    participant Config as GhosttyConfig\n    participant FS as File System\n\n    User->>UI: Open palette (Cmd+Shift+P)\n    UI->>UI: Show commands\n    User->>UI: Select \"Ghostty Theme Menu\"\n    UI->>UI: set submenu = ghosttyThemes\n    UI->>Config: request theme list (discoverThemeNames / themeSearchDirectories)\n    Config->>FS: enumerate theme directories\n    FS-->>Config: return entries\n    Config-->>UI: return theme commands\n    UI->>User: display theme list\n    User->>UI: choose theme \"X\"\n    UI->>UI: applyGhosttyThemeFromPalette(\"X\")\n    UI->>Config: applyTheme(\"X\")\n    Config->>FS: read/write config file (upsert)\n    FS-->>Config: write confirmation\n    Config-->>UI: applied\n    UI->>UI: clear submenu, dismiss palette\n    UI-->>User: theme active\n```\n\n## Estimated code review effort\n\n🎯 4 (Complex) | ⏱️ ~45 minutes\n\n## Possibly related PRs\n\n- manaflow-ai/cmux#1030 — Modifies ContentView command palette wiring and additions of submenu/handlers; strong overlap with this PR's command-palette changes.\n\n## Poem\n\n> 🐰 In a hop and a blink I found themes to explore,  \n> Ghostty menus unfurl, and colors galore,  \n> I nibble a letter, select \"Nord\" with delight,  \n> Configs hum and update, the sidebar gleams bright,  \n> Hooray — a rabbit's cheer for theme-switching tonight!\n\n</details>\n\n<!-- walkthrough_end -->\n\n\n<!-- pre_merge_checks_walkthrough_start -->\n\n<details>\n<summary>🚥 Pre-merge checks | ✅ 4 | ❌ 1</summary>\n\n### ❌ Failed checks (1 warning)\n\n|     Check name     | Status     | Explanation                                                                          | Resolution                                                                         |\n| :----------------: | :--------- | :----------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------- |\n| Docstring Coverage | ⚠️ Warning | Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. | Write docstrings for the functions missing them to satisfy the coverage threshold. |\n\n<details>\n<summary>✅ Passed checks (4 passed)</summary>\n\n|         Check name         | Status   | Explanation                                                                                                                                                                                                                                                                                               |\n| :------------------------: | :------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n|         Title check        | ✅ Passed | The title 'Add Ghostty theme picker to the command palette' clearly and concisely summarizes the main change—adding a Ghostty theme selection feature to the command palette interface.                                                                                                                   |\n|      Description check     | ✅ Passed | The PR description includes a complete Summary section explaining what changed and why, a Testing section detailing how it was tested, and references the scope boundaries. However, the Demo Video section is not filled (no URL provided) and the Review Trigger and Checklist sections are incomplete. |\n|     Linked Issues check    | ✅ Passed | The PR implements the command-palette theme submenu requirement from `#526` (discovering themes, displaying them, and applying selection), but does not address the sidebar theme-awareness requirement, which the PR correctly identifies as follow-up scope.                                              |\n| Out of Scope Changes check | ✅ Passed | All changes are scoped to implementing the command-palette theme submenu feature from `#526`. No unrelated changes to unrelated functionality detected; sidebar theme-awareness is appropriately deferred as follow-up work.                                                                                |\n\n</details>\n\n<sub>✏️ Tip: You can configure your own custom pre-merge checks in the settings.</sub>\n\n</details>\n\n<!-- pre_merge_checks_walkthrough_end -->\n\n<!-- finishing_touch_checkbox_start -->\n\n<details>\n<summary>✨ Finishing Touches</summary>\n\n<details>\n<summary>🧪 Generate unit tests (beta)</summary>\n\n- [ ] <!-- {\"checkboxId\": \"f47ac10b-58cc-4372-a567-0e02b2c3d479\", \"radioGroupId\": \"utg-output-choice-group-unknown_comment_id\"} -->   Create PR with unit tests\n- [ ] <!-- {\"checkboxId\": \"07f1e7d6-8a8e-4e23-9900-8731c2c87f58\", \"radioGroupId\": \"utg-output-choice-group-unknown_comment_id\"} -->   Post copyable unit tests in a comment\n\n</details>\n\n</details>\n\n<!-- finishing_touch_checkbox_end -->\n\n<!-- tips_start -->\n\n---\n\n\n\n<sub>Comment `@coderabbitai help` to get the list of available commands and usage tips.</sub>\n\n<!-- tips_end -->\n\n<!-- internal state start -->\n\n\n<!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOYCmGJATmriQCaQDG+Ats2bgFyQAOFk+AIwBWJBrngA3EsgEBPRvlqU0AgfFwA6NPEgQAfACgjoCEYDEZyAAUASpETZWaCrKPR1AGxJcAgrXoA4rD4iLi48riwJGw88AwA1pSQBMlRCk4Y9NxoXmEkkAAUtpBmAIylACwAnACUkHKQSgJE+LgA7vAUdAA09vjYFAz5AlQYDLCQAGYk1AD0RMGh4WCR0SRgTBm0YNm5NJCASYSQzNoYGm4IyMVo/shokABEQSFh8nBrgGQED5DsLsn4qXymxOmR4ORIeVS1H43DIdym+AY2EQdEBMQcAjYGGwGkgAElcI0kEwpBRkPAMKEcl5AotXmjpFMKCx7LhMLRnPQUc5xpAPIjqPB8JTCgEABIAeQAytBoABNAD6NgAolKJQBVGwAYVVCoAInibL00NxuPVsJkvL0ABp6gL6nzQHz6w1S3rIpK0TqIGq9JRgWjYbgeOLURmrZiMNAosAUlGU9SSEgeWTG0EnCjxZCrRgDLoYXAphQYSbwIgDVERki4qXJ0TiDBEdAMyBBlEUXDIAr4PgMLphn2QAAGVcgAF5IMAMGg2HohygsDnnkt5EwS2XehSJDl4ByaNm0mvS02GGhxiQ0/Quvybshl/Sj2WBoLhf90KaiznxphSChWHR4DDFNcXVDB1GSaRO0gNpKHyG4lHoElKApJtRy9RAkL+dli2PVtuHbXBZj7GZ9gEEhYDQCQhQoXFoEglDIAwVppC4RB+kGfJSy8ZAYK6MEyToIiWG4eAaUgKj7kQDpJlwBgET4ARoziRgogSRAAG5ICIcCvUmSZdA2VT4mg6NIAoC1NIADyYJpsFE+h9yg3j8iYwkSEs0Q8FRClUlQMgqOZDAsUJQN8hSHMz3EKRGhIKR+VhPgvS6MQe3kbh8ApBtUIBLUWBBegABkKXyaB8Hw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pO+dQPICKUYj+B5MHWByvOgfTDY6MRUYcK2KdCaARYcho1xwQcynoL0M0NWUzDSKlVc8FVdviuU6LNVT4LoFosIl2r9Vryh1QCtTwTkJQkwN1bCBanIJzVP0RAFap+XgK/li685Y8CikxSmwuUciaYp9VLF3F+UwNbDR8XCg7F1k/NpesVEBUNANYgAKQCr00ilBwHpDiA1xsRtyTFXZD2pdNMMFg1ANuM/UBUv1Q63yZjTjzrSMp6gAAi+r+Ho4FGgUp/KyKJXJtBQiASYJnBGhvqfGUGkLIhrtXKqLlqq8dU8rWUvKPAbypdaNMw1EBJJ8UnRFx2NW+tbA9i8mVgtTwu9NotABcaWICrDiVAI4zaKUA9GTAqgLvGYLQACqnjSYAgF3hUFUBVAxx7YnylJorFbQSAq0M8O71KCli6xm4l3j5VKBLiBAMih4OT1sAwz1pW4r3utDQB1jVodYtAOtAYCbQKxAVNAKUFHFng0AomzaJMCvGXi2xAgVaAFrrHKbdxaAGscOLrGTBKg60CcSQBHHliKg/m2sTnhOS3iIA3MX8T+L/FGRMx74leHeO3j4AFQ2QD0IBLDCtbgJSY0CU5v429wbhPgXAMspfFNdWAYKFpd5IColb/RDWprb1t/G/o3xoIfQEAA=== -->\n\n<!-- internal state end -->"},"request":{"retryCount":3,"retries":3,"retryAfter":16}}}

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (1)
Sources/ContentView.swift (1)

3906-3953: Surface an explicit no-themes state.

Because the Back row is always present, this function never returns an empty result set after loading, so the Ghostty empty-state copy at Lines 3279-3281 does not render for the blank-query/no-themes case. On a machine with zero discoverable themes, the submenu just shows “Back” with no explanation.

💡 One way to make the zero-themes case explicit
         if commandPaletteGhosttyThemesAreLoading && themes.isEmpty {
             commands.append(
                 CommandPaletteCommand(
                     id: "palette.ghosttyTheme.loading",
                     rank: 1,
                     title: String(localized: "command.ghosttyTheme.loading.title", defaultValue: "Loading Ghostty themes…"),
                     subtitle: String(localized: "command.ghosttyTheme.loading.subtitle", defaultValue: "Ghostty Theme"),
                     shortcutHint: nil,
                     keywords: ["loading", "theme", "ghostty"],
                     dismissOnRun: false,
                     action: {}
                 )
             )
             return commands
         }
+
+        if themes.isEmpty {
+            commands.append(
+                CommandPaletteCommand(
+                    id: "palette.ghosttyTheme.empty",
+                    rank: 1,
+                    title: String(localized: "command.ghosttyTheme.empty.title", defaultValue: "No Ghostty themes found"),
+                    subtitle: String(localized: "command.ghosttyTheme.empty.subtitle", defaultValue: "Ghostty Theme"),
+                    shortcutHint: nil,
+                    keywords: [],
+                    dismissOnRun: false,
+                    action: {}
+                )
+            )
+            return commands
+        }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Sources/ContentView.swift` around lines 3906 - 3953, The Back row is always
present so when themes is empty after loading the menu shows only "Back"; add an
explicit empty-state CommandPaletteCommand when
commandPaletteGhosttyThemesAreLoading is false and themes.isEmpty. In the
function that builds commands (which uses commandPaletteGhosttyThemesAreLoading,
themes, CommandPaletteCommand and commandPaletteGhosttyThemeCommandID), after
the loading check add a branch that appends a command with a unique id like
"palette.ghosttyTheme.empty", a user-facing title/subtitle indicating "No
Ghostty themes found" (localized), appropriate keywords, and a no-op action (or
dismissOnRun true) so the submenu displays explanatory copy instead of only
Back. Ensure this branch returns commands like the loading branch does.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@Sources/ContentView.swift`:
- Around line 4009-4018: The detached task is reading appearance-sensitive
helpers on a background thread; compute the appearance/preferredColorScheme on
the main actor first and pass that value into the detached task so GhosttyConfig
methods won't call NSApp?.effectiveAppearance on a background thread.
Concretely: call await MainActor.run {
GhosttyConfig.currentColorSchemePreference() } (or use Task { `@MainActor` in ...
} ) to obtain preferredColorScheme, then start
commandPaletteGhosttyThemeLoadTask = Task.detached { ... } using that captured
preferredColorScheme when calling GhosttyConfig.load(useCache: false) or
GhosttyConfig.resolveThemeName(...) so no default param falls back to
currentColorSchemePreference() on a background thread; refer to
commandPaletteGhosttyThemeLoadTask,
GhosttyConfig.currentColorSchemePreference(), GhosttyConfig.load(useCache:), and
GhosttyConfig.resolveThemeName(...) to locate and update the code.

In `@Sources/GhosttyConfig.swift`:
- Around line 483-492: writableConfigPath currently returns the first existing
search path, which selects a lower-precedence config file; change it to pick the
highest-precedence config by scanning resolvedSearchPaths in reverse (or using
last(where:)) and returning the first existing path found, and if none exist
return the highest-precedence target path (resolvedSearchPaths.last ?? default
"~/.config/ghostty/config.ghostty" expandingTildeInPath); update the function
writableConfigPath to use reversed iteration or last(where:) so
applyTheme()/upsertConfigValue() writes to the correct (highest-precedence)
file.
- Around line 461-464: The normalization currently folds both diacritics and
case (folding(options: [.diacriticInsensitive, .caseInsensitive], ...)) which
causes "Cafe" and "Café" to be treated as duplicates; change the folding call
used to compute normalized (the variable normalized) to only use
.caseInsensitive (remove .diacriticInsensitive) so the deduplication via
seen.insert(normalized) is case-insensitive only and preserves diacritic
differences.

---

Nitpick comments:
In `@Sources/ContentView.swift`:
- Around line 3906-3953: The Back row is always present so when themes is empty
after loading the menu shows only "Back"; add an explicit empty-state
CommandPaletteCommand when commandPaletteGhosttyThemesAreLoading is false and
themes.isEmpty. In the function that builds commands (which uses
commandPaletteGhosttyThemesAreLoading, themes, CommandPaletteCommand and
commandPaletteGhosttyThemeCommandID), after the loading check add a branch that
appends a command with a unique id like "palette.ghosttyTheme.empty", a
user-facing title/subtitle indicating "No Ghostty themes found" (localized),
appropriate keywords, and a no-op action (or dismissOnRun true) so the submenu
displays explanatory copy instead of only Back. Ensure this branch returns
commands like the loading branch does.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: cb57ea87-4697-497b-86d5-75cc9bd5899d

📥 Commits

Reviewing files that changed from the base of the PR and between b7a7501 and faeb59f.

📒 Files selected for processing (3)
  • Sources/ContentView.swift
  • Sources/GhosttyConfig.swift
  • cmuxTests/GhosttyConfigTests.swift
🚧 Files skipped from review as they are similar to previous changes (1)
  • cmuxTests/GhosttyConfigTests.swift

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

♻️ Duplicate comments (3)
Sources/GhosttyConfig.swift (2)

461-464: ⚠️ Potential issue | 🟡 Minor

Keep theme deduplication case-insensitive only.

This normalization also folds diacritics, so Cafe and Café collapse to one entry even though this path is only supposed to deduplicate case-insensitively.

💡 Suggested fix
-                let normalized = name
-                    .folding(options: [.diacriticInsensitive, .caseInsensitive], locale: .current)
-                    .lowercased()
+                let normalized = name
+                    .folding(options: [.caseInsensitive], locale: .current)
+                    .lowercased()
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Sources/GhosttyConfig.swift` around lines 461 - 464, The code is
over-normalizing theme names by folding diacritics as well as case, collapsing
distinct names like "Cafe" and "Café"; change the normalization to be
case-insensitive only: replace the folding call with a locale-aware lowercase
conversion (e.g. use name.lowercased(with: .current) or name.lowercased()) so
that only case differences are normalized before inserting into seen (refer to
the variables/functions normalized, name, and seen.insert).

483-491: ⚠️ Potential issue | 🟠 Major

Write to the highest-precedence config file.

loadFromDisk() applies these paths in order, so the last existing file wins. Returning the first existing path here means applyTheme() / upsertConfigValue() can update a lower-precedence config and have the change immediately overridden on reload.

💡 Suggested fix
     let resolvedSearchPaths = searchPaths ?? configSearchPaths()
-    for path in resolvedSearchPaths where fileManager.fileExists(atPath: path) {
+    for path in resolvedSearchPaths.reversed() where fileManager.fileExists(atPath: path) {
         return path
     }
-    return resolvedSearchPaths.first ?? NSString(string: "~/.config/ghostty/config.ghostty").expandingTildeInPath
+    return resolvedSearchPaths.last
+        ?? NSString(string: "~/.config/ghostty/config.ghostty").expandingTildeInPath
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Sources/GhosttyConfig.swift` around lines 483 - 491, writableConfigPath
currently returns the first existing path from resolvedSearchPaths, but
loadFromDisk treats later paths as higher precedence so you must return the
highest-precedence (last existing) file instead; update writableConfigPath to
find and return the last existing path (e.g. iterate
resolvedSearchPaths.reversed() or use resolvedSearchPaths.last(where: {
fileManager.fileExists(atPath: $0) })) and if none exist return the expanded
default path as before so applyTheme()/upsertConfigValue() write to the correct
(highest-precedence) config file.
Sources/ContentView.swift (1)

4007-4018: ⚠️ Potential issue | 🟠 Major

Keep the appearance lookup on the main actor.

This detached loader still calls GhosttyConfig.currentColorSchemePreference() directly, and GhosttyConfig.load(useCache: false) falls back to the same helper when preferredColorScheme is omitted. That means NSApp?.effectiveAppearance is still being read off the main thread here.

🛠️ Suggested fix
         commandPaletteGhosttyThemeLoadTask?.cancel()
         commandPaletteGhosttyThemesAreLoading = true
-        commandPaletteGhosttyThemeLoadTask = Task.detached(priority: .userInitiated) {
-            let preferredColorScheme = GhosttyConfig.currentColorSchemePreference()
+        let preferredColorScheme = GhosttyConfig.currentColorSchemePreference()
+        commandPaletteGhosttyThemeLoadTask = Task.detached(priority: .userInitiated) {
             let resolvedCurrentTheme = (
-                GhosttyConfig.load(useCache: false).theme.map {
+                GhosttyConfig.load(
+                    preferredColorScheme: preferredColorScheme,
+                    useCache: false
+                ).theme.map {
                     GhosttyConfig.resolveThemeName(
                         from: $0,
                         preferredColorScheme: preferredColorScheme
                     )
                 }

The script below should show the detached call site and the GhosttyConfig.loadcurrentColorSchemePreferenceNSApp?.effectiveAppearance fallback chain.

#!/bin/bash
set -euo pipefail

sed -n '4007,4018p' Sources/ContentView.swift
printf '\n---\n'
sed -n '58,73p' Sources/GhosttyConfig.swift
printf '\n---\n'
sed -n '241,246p' Sources/GhosttyConfig.swift
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Sources/ContentView.swift` around lines 4007 - 4018, The detached Task is
calling GhosttyConfig.currentColorSchemePreference() and
GhosttyConfig.load(useCache:) off the main actor, which reads
NSApp?.effectiveAppearance; fix by performing the appearance lookup and theme
resolution on the main actor before creating commandPaletteGhosttyThemeLoadTask:
capture let preferredColorScheme = await MainActor.run {
GhosttyConfig.currentColorSchemePreference() } and compute resolvedCurrentTheme
= await MainActor.run { /* call GhosttyConfig.load(useCache: false) and
resolve/trim theme */ } (or compute both inside a single MainActor.run block),
then pass those plain values into Task.detached so the detached work no longer
touches AppKit/NSApp; update references to commandPaletteGhosttyThemesAreLoading
and commandPaletteGhosttyThemeLoadTask accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@Sources/ContentView.swift`:
- Around line 4021-4030: Wrap the async theme load with a request token check
similar to commandPaletteSearchRequestID: generate and store a unique request id
(e.g. commandPaletteGhosttyThemeRequestID) when starting the load, capture it in
the Task, and before applying results (both before awaiting MainActor.run and
inside MainActor.run) verify that the captured id still equals the current
commandPaletteGhosttyThemeRequestID and that commandPaletteCommandSubmenu ==
.ghosttyThemes; only then assign commandPaletteGhosttyThemeNames,
commandPaletteGhosttyResolvedCurrentTheme, and
commandPaletteGhosttyThemesAreLoading, and only clear
commandPaletteGhosttyThemeLoadTask / commandPaletteGhosttyThemeRequestID if the
ids still match so stale tasks cannot overwrite a newer session.
- Around line 3906-3932: The Back and loading sentinel commands
("palette.ghosttyTheme.back" and "palette.ghosttyTheme.loading") are being added
as normal searchable items which allows a non-matching query to hide them and
show an empty Ghostty state; change the builder so these two entries are not
subject to fuzzy filtering: either (A) add the Back command and the loading
sentinel after you run the query filter (i.e., append them to the commands array
post-filter) so they always appear regardless of the search term, or (B) tag
them as non-searchable/alwaysVisible (e.g., set an isSearchable=false or
alwaysVisible flag) and ensure the filtering logic skips items with that flag;
use the existing identifiers commandPaletteGhosttyThemesAreLoading, themes,
exitCommandPaletteGhosttyThemeMenu(), and the command IDs above to locate where
to modify the append/filter logic and ensure the empty-state is suppressed while
commandPaletteGhosttyThemesAreLoading is true.

---

Duplicate comments:
In `@Sources/ContentView.swift`:
- Around line 4007-4018: The detached Task is calling
GhosttyConfig.currentColorSchemePreference() and GhosttyConfig.load(useCache:)
off the main actor, which reads NSApp?.effectiveAppearance; fix by performing
the appearance lookup and theme resolution on the main actor before creating
commandPaletteGhosttyThemeLoadTask: capture let preferredColorScheme = await
MainActor.run { GhosttyConfig.currentColorSchemePreference() } and compute
resolvedCurrentTheme = await MainActor.run { /* call
GhosttyConfig.load(useCache: false) and resolve/trim theme */ } (or compute both
inside a single MainActor.run block), then pass those plain values into
Task.detached so the detached work no longer touches AppKit/NSApp; update
references to commandPaletteGhosttyThemesAreLoading and
commandPaletteGhosttyThemeLoadTask accordingly.

In `@Sources/GhosttyConfig.swift`:
- Around line 461-464: The code is over-normalizing theme names by folding
diacritics as well as case, collapsing distinct names like "Cafe" and "Café";
change the normalization to be case-insensitive only: replace the folding call
with a locale-aware lowercase conversion (e.g. use name.lowercased(with:
.current) or name.lowercased()) so that only case differences are normalized
before inserting into seen (refer to the variables/functions normalized, name,
and seen.insert).
- Around line 483-491: writableConfigPath currently returns the first existing
path from resolvedSearchPaths, but loadFromDisk treats later paths as higher
precedence so you must return the highest-precedence (last existing) file
instead; update writableConfigPath to find and return the last existing path
(e.g. iterate resolvedSearchPaths.reversed() or use
resolvedSearchPaths.last(where: { fileManager.fileExists(atPath: $0) })) and if
none exist return the expanded default path as before so
applyTheme()/upsertConfigValue() write to the correct (highest-precedence)
config file.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8f9bf696-15dd-433e-a9f0-9b543a42975c

📥 Commits

Reviewing files that changed from the base of the PR and between b7a7501 and faeb59f.

📒 Files selected for processing (3)
  • Sources/ContentView.swift
  • Sources/GhosttyConfig.swift
  • cmuxTests/GhosttyConfigTests.swift

Comment on lines +3906 to +3932
commands.append(
CommandPaletteCommand(
id: "palette.ghosttyTheme.back",
rank: 0,
title: String(localized: "command.ghosttyTheme.back.title", defaultValue: "Back"),
subtitle: String(localized: "command.ghosttyTheme.back.subtitle", defaultValue: "Ghostty Themes"),
shortcutHint: nil,
keywords: ["back", "theme", "ghostty"],
dismissOnRun: false,
action: { exitCommandPaletteGhosttyThemeMenu() }
)
)

if commandPaletteGhosttyThemesAreLoading && themes.isEmpty {
commands.append(
CommandPaletteCommand(
id: "palette.ghosttyTheme.loading",
rank: 1,
title: String(localized: "command.ghosttyTheme.loading.title", defaultValue: "Loading Ghostty themes…"),
subtitle: String(localized: "command.ghosttyTheme.loading.subtitle", defaultValue: "Ghostty Theme"),
shortcutHint: nil,
keywords: ["loading", "theme", "ghostty"],
dismissOnRun: false,
action: {}
)
)
return commands
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Keep submenu chrome out of the searchable result set.

Because Back and the loading sentinel are emitted as normal commands, typing a non-matching query during discovery can hide both rows and render the Ghostty empty state even though loading is still in progress. Pin those rows outside fuzzy search, or suppress the empty state while commandPaletteGhosttyThemesAreLoading is true.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Sources/ContentView.swift` around lines 3906 - 3932, The Back and loading
sentinel commands ("palette.ghosttyTheme.back" and
"palette.ghosttyTheme.loading") are being added as normal searchable items which
allows a non-matching query to hide them and show an empty Ghostty state; change
the builder so these two entries are not subject to fuzzy filtering: either (A)
add the Back command and the loading sentinel after you run the query filter
(i.e., append them to the commands array post-filter) so they always appear
regardless of the search term, or (B) tag them as non-searchable/alwaysVisible
(e.g., set an isSearchable=false or alwaysVisible flag) and ensure the filtering
logic skips items with that flag; use the existing identifiers
commandPaletteGhosttyThemesAreLoading, themes,
exitCommandPaletteGhosttyThemeMenu(), and the command IDs above to locate where
to modify the append/filter logic and ensure the empty-state is suppressed while
commandPaletteGhosttyThemesAreLoading is true.

- writableConfigPath: pick highest-precedence (last) config file, not
  first, so theme changes aren't overridden by later config files
- Move AppKit appearance read (currentColorSchemePreference) to main
  actor before Task.detached to avoid background-thread AppKit access
- Remove .diacriticInsensitive from theme dedup normalization so themes
  differing only in diacritics (e.g. Café vs Cafe) stay distinct
- Replace silent try? config reads with explicit exists-check to avoid
  destroying config contents when file exists but is unreadable
- Validate theme names reject newlines and commas that would corrupt
  the config file format
- Add empty-themes state to submenu when no themes are discovered
- Add all new localization keys to Localizable.xcstrings catalog
- Add tests for writableConfigPath precedence and theme name validation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 4 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="Resources/Localizable.xcstrings">

<violation number="1" location="Resources/Localizable.xcstrings:72910">
P2: New user-facing localization keys were added with English only; add Japanese entries for these keys to keep supported locale coverage consistent.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (2)
Sources/ContentView.swift (2)

4023-4049: ⚠️ Potential issue | 🟡 Minor

Gate async theme loads with a request id.

Cancellation alone still leaves a race here: an older detached load can survive long enough to publish after a newer submenu session starts, and it can clear commandPaletteGhosttyThemeLoadTask for the active request. Mirror commandPaletteSearchRequestID with a dedicated Ghostty theme request id and verify it before applying results or clearing the stored task.

Suggested pattern
 `@State` private var commandPaletteGhosttyThemeLoadTask: Task<Void, Never>?
+@State private var commandPaletteGhosttyThemeRequestID: UInt64 = 0

 private func refreshCommandPaletteGhosttyThemeData(force: Bool = false) {
     if !force,
        (!commandPaletteGhosttyThemeNames.isEmpty || commandPaletteGhosttyThemesAreLoading) {
         return
     }

     commandPaletteGhosttyThemeLoadTask?.cancel()
+    commandPaletteGhosttyThemeRequestID &+= 1
+    let requestID = commandPaletteGhosttyThemeRequestID
     commandPaletteGhosttyThemesAreLoading = true
     let preferredColorScheme = GhosttyConfig.currentColorSchemePreference()
     commandPaletteGhosttyThemeLoadTask = Task.detached(priority: .userInitiated) {
         let resolvedCurrentTheme = (
             GhosttyConfig.load(
@@
         )?.trimmingCharacters(in: .whitespacesAndNewlines)
         let themes = GhosttyConfig.discoverThemeNames()

         guard !Task.isCancelled else { return }

         await MainActor.run {
-            guard commandPaletteCommandSubmenu == .ghosttyThemes else { return }
+            guard commandPaletteGhosttyThemeRequestID == requestID,
+                  commandPaletteCommandSubmenu == .ghosttyThemes else { return }
             commandPaletteGhosttyThemeNames = themes
             commandPaletteGhosttyResolvedCurrentTheme = resolvedCurrentTheme
             commandPaletteGhosttyThemesAreLoading = false
-            commandPaletteGhosttyThemeLoadTask = nil
+            if commandPaletteGhosttyThemeRequestID == requestID {
+                commandPaletteGhosttyThemeLoadTask = nil
+            }
             scheduleCommandPaletteResultsRefresh(forceSearchCorpusRefresh: true)
             syncCommandPaletteDebugStateForObservedWindow()
         }
     }
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Sources/ContentView.swift` around lines 4023 - 4049, Introduce a dedicated
request id (e.g., commandPaletteGhosttyThemeRequestID) and increment/set it
immediately before creating commandPaletteGhosttyThemeLoadTask; capture that id
in the detached Task and, before touching any shared state (setting
commandPaletteGhosttyThemeNames, commandPaletteGhosttyResolvedCurrentTheme,
commandPaletteGhosttyThemesAreLoading, commandPaletteGhosttyThemeLoadTask, and
calling
scheduleCommandPaletteResultsRefresh/syncCommandPaletteDebugStateForObservedWindow),
verify the captured id still equals the current
commandPaletteGhosttyThemeRequestID on the main actor. Only clear
commandPaletteGhosttyThemeLoadTask and reset/clear the request id when the ids
match; likewise bail early from the Task if Task.isCancelled or the ids mismatch
to avoid older tasks overwriting newer submenu sessions. Ensure the id is
updated for each new submenu session invocation that starts a theme load.

3906-3948: ⚠️ Potential issue | 🟡 Minor

Keep submenu chrome out of fuzzy search.

Back and the loading/empty sentinels are still emitted as normal commands, so a non-matching query can filter them out. That makes the Ghostty empty state appear while discovery is still running and can hide the only in-menu way back to the parent command list.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Sources/ContentView.swift` around lines 3906 - 3948, The back/loading/empty
sentinel commands (ids "palette.ghosttyTheme.back",
"palette.ghosttyTheme.loading", "palette.ghosttyTheme.empty") are being treated
as normal searchable commands and get filtered out by fuzzy queries; change them
to be non-searchable chrome so they always appear in the submenu by: add a
property/flag on CommandPaletteCommand (e.g. searchable: Bool or isMenuChrome:
Bool) and set it to false for these three commands where they are created, then
update the command-palette filtering logic to skip fuzzy matching for commands
with that flag (still respecting rank/order and dismissOnRun), ensuring
exitCommandPaletteGhosttyThemeMenu() remains the action for the back item and
the loading/empty sentinels remain no-op actions.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@Sources/ContentView.swift`:
- Around line 4023-4049: Introduce a dedicated request id (e.g.,
commandPaletteGhosttyThemeRequestID) and increment/set it immediately before
creating commandPaletteGhosttyThemeLoadTask; capture that id in the detached
Task and, before touching any shared state (setting
commandPaletteGhosttyThemeNames, commandPaletteGhosttyResolvedCurrentTheme,
commandPaletteGhosttyThemesAreLoading, commandPaletteGhosttyThemeLoadTask, and
calling
scheduleCommandPaletteResultsRefresh/syncCommandPaletteDebugStateForObservedWindow),
verify the captured id still equals the current
commandPaletteGhosttyThemeRequestID on the main actor. Only clear
commandPaletteGhosttyThemeLoadTask and reset/clear the request id when the ids
match; likewise bail early from the Task if Task.isCancelled or the ids mismatch
to avoid older tasks overwriting newer submenu sessions. Ensure the id is
updated for each new submenu session invocation that starts a theme load.
- Around line 3906-3948: The back/loading/empty sentinel commands (ids
"palette.ghosttyTheme.back", "palette.ghosttyTheme.loading",
"palette.ghosttyTheme.empty") are being treated as normal searchable commands
and get filtered out by fuzzy queries; change them to be non-searchable chrome
so they always appear in the submenu by: add a property/flag on
CommandPaletteCommand (e.g. searchable: Bool or isMenuChrome: Bool) and set it
to false for these three commands where they are created, then update the
command-palette filtering logic to skip fuzzy matching for commands with that
flag (still respecting rank/order and dismissOnRun), ensuring
exitCommandPaletteGhosttyThemeMenu() remains the action for the back item and
the loading/empty sentinels remain no-op actions.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6e460a13-d12d-4a2c-9ba3-fe015fc2046e

📥 Commits

Reviewing files that changed from the base of the PR and between faeb59f and 76468ea.

📒 Files selected for processing (4)
  • Resources/Localizable.xcstrings
  • Sources/ContentView.swift
  • Sources/GhosttyConfig.swift
  • cmuxTests/GhosttyConfigTests.swift

- Fix task reference leak: always clear loading state and task ref
  before the guard check so they're reset even when submenu changed
- Add early cancellation checks in detached task to avoid wasted disk
  I/O when user exits the theme menu during loading
- Extract resetCommandPaletteGhosttyThemeState() helper to DRY the
  5 duplicate state cleanup blocks across onChange, exit, reset, dismiss
- Use defer for invalidateLoadCache lock to match cachedLoad pattern
  and prevent lock leak on unexpected throw
- Remove dead `replaced` variable from upsertConfigValue; the
  if-let/else on lastMatchIndex already handles both branches
- Strengthen theme name validation: reject empty names, path traversal
  (../), and directory separators (/) in addition to newlines and commas
- Add tests for path traversal, slash, and empty name rejection

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@debgotwired
Copy link
Copy Markdown
Author

Review fixes — complete

Two commits pushed addressing all findings from the 4 AI reviewers (Greptile, Cubic, CodeRabbit, Codex) plus preemptive hardening based on each reviewer's documented patterns and historical behavior on this repo.


Commit 1: 76468ea — Fix remaining review issues

writableConfigPath picks highest-precedence config (Cubic P2, CodeRabbit Major, Codex P1)

  • Changed resolvedSearchPaths iteration to .reversed() so writes go to the last (highest-precedence) config file. Previously, when both ~/.config/ghostty/config and config.ghostty existed, theme changes were written to the lower-precedence file and immediately overridden on reload, making palette selections appear to have no effect. Fallback also changed from .first to .last for consistency.

Move AppKit appearance read to main actor (Cubic P2, CodeRabbit Major, Codex P2)

  • GhosttyConfig.currentColorSchemePreference() reads NSApp?.effectiveAppearance which must only be called from the main thread. Moved the call out of Task.detached and into the calling scope (which runs on MainActor), then passed the captured preferredColorScheme explicitly to GhosttyConfig.load(preferredColorScheme:useCache:) so no default parameter falls back to currentColorSchemePreference() on a background thread.

Remove .diacriticInsensitive from theme dedup (CodeRabbit Minor)

  • The normalization in discoverThemeNames() was folding both diacritics and case, which meant themes like "Café" and "Cafe" would be treated as duplicates. Changed to case-insensitive only so diacritic differences are preserved.

Replace silent try? config reads with explicit file-exists check (Greptile)

  • Both upsertConfigValue and applyTheme used (try? String(contentsOf: url, encoding: .utf8)) ?? "" to read existing config. If the file existed but was unreadable (wrong encoding, permissions), the error was silently swallowed and the function would overwrite the entire file with just the new single-key entry, destroying all other settings. Now distinguishes "file doesn't exist" (treat as empty) from "file exists but is unreadable" (propagate the error).

Validate theme names reject newlines and commas (Greptile)

  • Theme names originate from filenames discovered on disk. A filename containing \n would inject extra content into the config file; commas would produce unparseable variant strings like light:Night,Dark,dark:…. Added a guard in applyTheme that rejects these characters.

Add empty-themes state to submenu (CodeRabbit Nitpick)

  • When theme discovery completes with zero results, the submenu previously showed only "Back" with no explanation. Now shows a "No Ghostty themes found" placeholder.

Add 12 localization keys to Localizable.xcstrings (Codex P1)

  • Per AGENTS.md: "All user-facing strings must be localized in Resources/Localizable.xcstrings." Added English entries for all new ghostty theme keys: back title/subtitle, loading title/subtitle, current title, theme subtitle, empty title/subtitle, menu title/subtitle, search placeholder, and empty search text.

3 new testswritableConfigPath precedence, theme name with newline rejection, theme name with comma rejection.


Commit 2: 60a52b5 — Harden against deeper review patterns

These fixes are preemptive — based on documented reviewer methodologies and historical patterns from the last 20 merged PRs on this repo.

Fix task reference leak on guard failure (Cubic P2 pattern, CodeRabbit Major pattern)

  • In the detached task's MainActor.run block, commandPaletteGhosttyThemesAreLoading and commandPaletteGhosttyThemeLoadTask were only reset inside the guard commandPaletteCommandSubmenu == .ghosttyThemes branch. If the user exited the theme menu while loading was in progress, the guard would fail and these variables would never be cleared — leaving isLoading = true permanently (stuck spinner) and leaking the task reference. Moved the cleanup before the guard so state is always reset regardless of submenu changes.

Add early cancellation checks in detached task (Greptile performance pattern)

  • The original code only checked Task.isCancelled after both expensive operations (config load + theme discovery) completed. Added checks at task entry, after config load, and after theme discovery, so cancelled tasks bail out before wasting disk I/O. Greptile historically flags unnecessary I/O and redundant computation in this repo (e.g., "12 unnecessary layout passes per drag" in PR Fix browser pane blanking after round-trip drag rearrange #1068).

Extract resetCommandPaletteGhosttyThemeState() helper (CodeRabbit Refactor, Cubic P2 pattern)

  • The 5-line ghostty theme state cleanup block (cancel task, nil task ref, clear names array, nil resolved theme, clear loading flag) was duplicated verbatim in 4 locations: onChange handler, exitCommandPaletteGhosttyThemeMenu, resetCommandPaletteListState, and dismissCommandPalette. Extracted into a single helper function. This prevents future drift where one cleanup path might miss a variable — exactly the kind of duplication Cubic's Duplication Agent and CodeRabbit's Refactor Suggestion category target.

Use defer for invalidateLoadCache lock (Cubic P2 pattern)

  • invalidateLoadCache() used a bare lock()/unlock() pattern while the adjacent cachedLoad() function used the safer defer { unlock() } pattern. If removeAll() ever threw or if the function was modified to include more logic, the lock would leak. This inconsistency is exactly what Cubic flags (confidence 9) — their Security Agent checks for resource leak patterns. Matched to the existing defer pattern.

Remove dead replaced variable (Greptile dead code pattern)

  • After the refactoring to lastMatchIndex, the replaced boolean was set but only used to gate the append-new-entry branch. Since lastMatchIndex already provides this information via if let/else, the variable was dead. Greptile is the only reviewer in this repo that consistently flags dead code (e.g., "redundant frame assignment when TAMIC is false" in PR Fix browser pane portal anchor sizing #1094).

Strengthen theme name validation: path traversal + empty name (Greptile Critical, Codex P1 pattern)

  • The initial validation rejected newlines and commas but not path traversal sequences. Since applyTheme passes the theme name into file path construction (themes/\(themeName)), a name like ../../../etc/passwd could escape the themes directory. Added guards for empty names, .. sequences, and / characters. Codex's review criteria specifically require that security findings be "provably affecting other code" — the themeSearchPaths function at line 350 constructs paths with themes/\(themeName), making this provable.

6 new tests — path traversal rejection, slash rejection, empty name rejection, plus the 3 from commit 1.


Reviewer pattern summary

Reviewer Focus What they check in this repo
Greptile Security → Correctness → Architecture → Performance Traces cross-file code paths, flags redundant I/O/layout, dead code, error swallowing
Cubic Hard-to-find bugs via specialized micro-agents Thread safety, policy violations (AGENTS.md), lock patterns, unreachable code
CodeRabbit Broad coverage with 30+ integrated linters Force unwraps, main-thread safety, localization, code duplication, SwiftLint
Codex Only P0/P1 (precision over recall) AGENTS.md policy compliance, backward compat, provable security issues

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (2)
Sources/ContentView.swift (2)

3902-3928: ⚠️ Potential issue | 🟡 Minor

Keep the submenu chrome out of fuzzy filtering.

Back and the loading row are still emitted as normal searchable commands, so a non-matching query can hide both rows and show the Ghostty empty state even while discovery is still running. These rows should stay visible regardless of the query, or the empty state should be suppressed while commandPaletteGhosttyThemesAreLoading is true.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Sources/ContentView.swift` around lines 3902 - 3928, The Back and Loading
rows are being treated as normal searchable commands and get filtered out;
update the construction so those two items (CommandPaletteCommand with id
"palette.ghosttyTheme.back" and id "palette.ghosttyTheme.loading") are flagged
as menu chrome / non-searchable (e.g. add an isMenuChrome or searchable: false
property) and update the command-palette filtering logic to skip filtering for
commands where searchable is false (or alternatively, when
commandPaletteGhosttyThemesAreLoading is true short-circuit and return the
commands list before running fuzzy filtering); reference CommandPaletteCommand,
commandPaletteGhosttyThemesAreLoading, themes.isEmpty,
exitCommandPaletteGhosttyThemeMenu(), and the commands array when making the
change.

4023-4055: ⚠️ Potential issue | 🟡 Minor

Gate theme-load completion with a request token.

Cancellation alone still isn't enough here. An older detached load can reach MainActor.run after a newer submenu session starts, and this block clears commandPaletteGhosttyThemesAreLoading / commandPaletteGhosttyThemeLoadTask before it validates freshness. That lets stale work hide the spinner or overwrite the active session's theme list/current mark. Mirror the existing commandPaletteSearchRequestID pattern and verify the token before mutating state.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Sources/ContentView.swift` around lines 4023 - 4055, Introduce a per-request
token for the ghostty-theme load (mirroring commandPaletteSearchRequestID) to
ensure stale detached tasks cannot clear or overwrite state: add a
commandPaletteGhosttyThemeRequestID (e.g., UUID or incrementing Int) and set it
immediately before creating commandPaletteGhosttyThemeLoadTask; capture that
token in the Task and, before any MainActor.run mutations (and before clearing
commandPaletteGhosttyThemeLoadTask/commandPaletteGhosttyThemesAreLoading),
verify the captured token still matches the global
commandPaletteGhosttyThemeRequestID—only then update
commandPaletteGhosttyThemeNames, commandPaletteGhosttyResolvedCurrentTheme and
call
scheduleCommandPaletteResultsRefresh/syncCommandPaletteDebugStateForObservedWindow;
keep existing cancellation checks (Task.isCancelled) and ensure clearing of the
task/loader state is gated by the token match so newer submenu sessions are not
affected by stale loads.
🧹 Nitpick comments (1)
Sources/GhosttyConfig.swift (1)

88-95: Consider using defer for consistency with invalidateLoadCache.

This function manually pairs lock() and unlock() calls, while invalidateLoadCache now uses defer. While the current code is correct (the dictionary assignment won't throw), using defer would maintain consistency across the caching methods.

♻️ Optional refactor for consistency
 private static func storeCachedLoad(
     _ config: GhosttyConfig,
     for colorScheme: ColorSchemePreference
 ) {
     loadCacheLock.lock()
+    defer { loadCacheLock.unlock() }
     cachedConfigsByColorScheme[colorScheme] = config
-    loadCacheLock.unlock()
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Sources/GhosttyConfig.swift` around lines 88 - 95, The storeCachedLoad
function currently calls loadCacheLock.lock() and loadCacheLock.unlock()
manually; change it to mirror invalidateLoadCache by calling
loadCacheLock.lock() then using defer { loadCacheLock.unlock() } immediately
after locking so the unlock is guaranteed and consistent across caching helpers
(refer to storeCachedLoad and invalidateLoadCache).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@Sources/ContentView.swift`:
- Around line 3902-3928: The Back and Loading rows are being treated as normal
searchable commands and get filtered out; update the construction so those two
items (CommandPaletteCommand with id "palette.ghosttyTheme.back" and id
"palette.ghosttyTheme.loading") are flagged as menu chrome / non-searchable
(e.g. add an isMenuChrome or searchable: false property) and update the
command-palette filtering logic to skip filtering for commands where searchable
is false (or alternatively, when commandPaletteGhosttyThemesAreLoading is true
short-circuit and return the commands list before running fuzzy filtering);
reference CommandPaletteCommand, commandPaletteGhosttyThemesAreLoading,
themes.isEmpty, exitCommandPaletteGhosttyThemeMenu(), and the commands array
when making the change.
- Around line 4023-4055: Introduce a per-request token for the ghostty-theme
load (mirroring commandPaletteSearchRequestID) to ensure stale detached tasks
cannot clear or overwrite state: add a commandPaletteGhosttyThemeRequestID
(e.g., UUID or incrementing Int) and set it immediately before creating
commandPaletteGhosttyThemeLoadTask; capture that token in the Task and, before
any MainActor.run mutations (and before clearing
commandPaletteGhosttyThemeLoadTask/commandPaletteGhosttyThemesAreLoading),
verify the captured token still matches the global
commandPaletteGhosttyThemeRequestID—only then update
commandPaletteGhosttyThemeNames, commandPaletteGhosttyResolvedCurrentTheme and
call
scheduleCommandPaletteResultsRefresh/syncCommandPaletteDebugStateForObservedWindow;
keep existing cancellation checks (Task.isCancelled) and ensure clearing of the
task/loader state is gated by the token match so newer submenu sessions are not
affected by stale loads.

---

Nitpick comments:
In `@Sources/GhosttyConfig.swift`:
- Around line 88-95: The storeCachedLoad function currently calls
loadCacheLock.lock() and loadCacheLock.unlock() manually; change it to mirror
invalidateLoadCache by calling loadCacheLock.lock() then using defer {
loadCacheLock.unlock() } immediately after locking so the unlock is guaranteed
and consistent across caching helpers (refer to storeCachedLoad and
invalidateLoadCache).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7b676149-2f2f-4c30-820d-e1dbc39be35e

📥 Commits

Reviewing files that changed from the base of the PR and between 76468ea and 60a52b5.

📒 Files selected for processing (3)
  • Sources/ContentView.swift
  • Sources/GhosttyConfig.swift
  • cmuxTests/GhosttyConfigTests.swift

- Gate async theme load results with a request token
  (commandPaletteGhosttyThemeLoadRequestID) so a stale detached task
  from a previous submenu session cannot overwrite the active session's
  data after an exit→re-enter sequence. Mirrors the existing
  commandPaletteSearchRequestID pattern used by the search system.

- Suppress the empty-state text while themes are still loading so
  typing a non-matching query during discovery does not flash
  "No Ghostty themes match your search." before results arrive.

- Add Japanese translations for all 12 new localization keys to
  maintain locale coverage parity with existing command palette entries.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@debgotwired
Copy link
Copy Markdown
Author

Final review round — all 24 comments addressed

Two additional commits pushed (60a52b5, 3f37356) completing all outstanding reviewer findings.


Commit 3: 60a52b5 — Harden against deeper review patterns

Fix task reference leak on guard failure (Cubic P2, CodeRabbit Major)
commandPaletteGhosttyThemesAreLoading and commandPaletteGhosttyThemeLoadTask were only cleared inside the guard commandPaletteCommandSubmenu == .ghosttyThemes branch in the MainActor.run block. If the user exited the theme menu while loading was in progress, the guard would fail and these variables would stay set forever — stuck loading spinner, leaked task reference. Moved cleanup before the guard.

Early cancellation checks in detached task (Greptile performance)
Original code only checked Task.isCancelled after both expensive operations (config load + theme discovery). Added checks at task entry, after config load, and after theme discovery to bail before wasting disk I/O on cancelled requests.

Extract resetCommandPaletteGhosttyThemeState() (CodeRabbit Refactor, Cubic P2)
The 5-line theme state cleanup (cancel task, nil task ref, clear names, nil resolved theme, clear loading flag) was copy-pasted in 4 locations: onChange, exitMenu, resetListState, dismiss. Extracted into one helper to prevent future drift.

defer in invalidateLoadCache (Cubic P2)
Lock/unlock without defer while adjacent cachedLoad() uses defer { unlock() }. Inconsistent and fragile to refactoring. Matched to existing pattern.

Remove dead replaced variable (Greptile dead code)
After refactoring to lastMatchIndex, the boolean was set but redundant — if let/else on lastMatchIndex already handles both branches.

Path traversal + empty name validation (Greptile Critical, Codex P1)
Initial validation only rejected \n and ,. Since applyTheme passes the theme name into themes/\(themeName), a name like ../../../etc/passwd could escape the directory. Added guards for empty names, .., and /.


Commit 4: 3f37356 — Address latest review round

Gate async theme loads with request token (CodeRabbit Minor)
Added commandPaletteGhosttyThemeLoadRequestID mirroring the existing commandPaletteSearchRequestID pattern. Without this, a stale detached task from a previous submenu session could survive cancellation and overwrite the active session's theme data after an exit→re-enter sequence. The MainActor.run block now verifies requestID == commandPaletteGhosttyThemeLoadRequestID before applying results.

Suppress empty state during loading (CodeRabbit Minor)
Back and loading rows are normal searchable commands, so typing a non-matching query during discovery hid both rows and flashed "No Ghostty themes match your search" even while loading was in progress. Now returns empty string from commandPaletteEmptyStateText while commandPaletteGhosttyThemesAreLoading is true.

Japanese translations for all 12 keys (Cubic P2)
Added ja locale entries for all new ghostty theme localization keys to match supported locale coverage. Translation patterns follow existing conventions: "戻る" for Back, "Ghosttyテーマ" for Ghostty Theme, "外観" for Appearance, "を検索" for search placeholders, "検索に一致する…がありません。" for empty states.


Complete status: 24/24 actionable comments addressed

Reviewer Comments All Fixed
Greptile 7 inline ✅ (6 fixed, 1 N/A — nil-coalescing fallback is defensive, not a bug)
Cubic 6 inline
CodeRabbit 8 inline
Codex 3 inline

Tests added: writableConfigPath precedence, theme name with newline/comma/slash/path-traversal/empty rejection (6 total).

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
Sources/ContentView.swift (1)

3906-3932: ⚠️ Potential issue | 🟡 Minor

Keep the Back/loading rows out of fuzzy filtering.

palette.ghosttyTheme.back and palette.ghosttyTheme.loading are still emitted as normal searchable commands, so a non-matching query during discovery can hide both rows and leave the submenu blank while loading. Those sentinel rows should be appended after filtering, or marked always-visible/non-searchable so search only applies to real theme entries.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Sources/ContentView.swift` around lines 3906 - 3932, The back
("palette.ghosttyTheme.back") and loading ("palette.ghosttyTheme.loading")
sentinel CommandPaletteCommand rows are being added before fuzzy filtering so
they can be hidden by a non-matching query; modify the builder that produces the
commands (the block that uses commandPaletteGhosttyThemesAreLoading, themes and
exitCommandPaletteGhosttyThemeMenu) so that real theme entries are filtered
first, and then append the sentinel back/loading commands afterward (or
alternatively set a non-searchable/always-visible flag on those
CommandPaletteCommand instances if such a property exists) to ensure they remain
visible regardless of the user's query.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@Sources/ContentView.swift`:
- Around line 3977-3978: The forced refresh path is not seeding the
command-preview synchronously, so
scheduleCommandPaletteResultsRefresh(forceSearchCorpusRefresh: true) can still
render an empty/partial commands view; ensure that when forceSearchCorpusRefresh
is true you perform a synchronous seed/update of the command-preview path before
returning. Concretely: in the call-site where
refreshCommandPaletteGhosttyThemeData(force: true) and
scheduleCommandPaletteResultsRefresh(forceSearchCorpusRefresh: true) are
invoked, make the seed of the commands preview happen synchronously (either by
calling the sync seeding helper or adding a synchronous code path in
scheduleCommandPaletteResultsRefresh keyed on forceSearchCorpusRefresh) so the
commands preview path is updated immediately (so UI shows Back/Loading or loaded
rows instead of []). Target the functions refreshCommandPaletteGhosttyThemeData
and scheduleCommandPaletteResultsRefresh and ensure forceSearchCorpusRefresh
triggers immediate seeding on the main actor/thread before any async detached
search runs.

---

Duplicate comments:
In `@Sources/ContentView.swift`:
- Around line 3906-3932: The back ("palette.ghosttyTheme.back") and loading
("palette.ghosttyTheme.loading") sentinel CommandPaletteCommand rows are being
added before fuzzy filtering so they can be hidden by a non-matching query;
modify the builder that produces the commands (the block that uses
commandPaletteGhosttyThemesAreLoading, themes and
exitCommandPaletteGhosttyThemeMenu) so that real theme entries are filtered
first, and then append the sentinel back/loading commands afterward (or
alternatively set a non-searchable/always-visible flag on those
CommandPaletteCommand instances if such a property exists) to ensure they remain
visible regardless of the user's query.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ff825c56-4526-4b45-a08d-1f11adfc9e79

📥 Commits

Reviewing files that changed from the base of the PR and between 60a52b5 and 3f37356.

📒 Files selected for processing (2)
  • Resources/Localizable.xcstrings
  • Sources/ContentView.swift

Comment on lines +3977 to +3978
refreshCommandPaletteGhosttyThemeData(force: true)
scheduleCommandPaletteResultsRefresh(forceSearchCorpusRefresh: true)
Copy link
Copy Markdown

@coderabbitai coderabbitai bot Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Honor forceSearchCorpusRefresh with a synchronous seed.

These forced Ghostty submenu refreshes still stay in the .commands scope, so scheduleCommandPaletteResultsRefresh can reuse the previous commands preview path and briefly render [] or only Back before the detached search finishes. That makes the submenu flash blank/partial content instead of immediately showing Back/Loading or the loaded theme rows.

💡 Minimal fix
 private func scheduleCommandPaletteResultsRefresh(forceSearchCorpusRefresh: Bool = false) {
     refreshCommandPaletteSearchCorpus(force: forceSearchCorpusRefresh)
@@
     commandPalettePendingActivation = nil
     cancelCommandPaletteSearch()
-    if Self.commandPaletteShouldSynchronouslySeedResults(
+    if forceSearchCorpusRefresh || Self.commandPaletteShouldSynchronouslySeedResults(
         hasVisibleResultsForScope: commandPaletteVisibleResultsScope == scope
     ) {
         let matches = Self.commandPaletteResolvedSearchMatches(
             searchCorpus: searchCorpus,
             query: query,

Also applies to: 4058-4060

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Sources/ContentView.swift` around lines 3977 - 3978, The forced refresh path
is not seeding the command-preview synchronously, so
scheduleCommandPaletteResultsRefresh(forceSearchCorpusRefresh: true) can still
render an empty/partial commands view; ensure that when forceSearchCorpusRefresh
is true you perform a synchronous seed/update of the command-preview path before
returning. Concretely: in the call-site where
refreshCommandPaletteGhosttyThemeData(force: true) and
scheduleCommandPaletteResultsRefresh(forceSearchCorpusRefresh: true) are
invoked, make the seed of the commands preview happen synchronously (either by
calling the sync seeding helper or adding a synchronous code path in
scheduleCommandPaletteResultsRefresh keyed on forceSearchCorpusRefresh) so the
commands preview path is updated immediately (so UI shows Back/Loading or loaded
rows instead of []). Target the functions refreshCommandPaletteGhosttyThemeData
and scheduleCommandPaletteResultsRefresh and ensure forceSearchCorpusRefresh
triggers immediate seeding on the main actor/thread before any async detached
search runs.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch on the UX flash — this is a valid observation. However, I'm intentionally not addressing this in this PR for the following reasons:

  1. Scope: The suggested fix modifies scheduleCommandPaletteResultsRefresh, which is shared infrastructure used by every command palette submenu, not just the Ghostty theme picker. Changing the synchronous seeding logic there to key off forceSearchCorpusRefresh alters the rendering behavior for all submenus that pass that flag — a change with broader blast radius than this feature PR warrants.

  2. Pre-existing behavior: The "brief flash" pattern is how all existing submenus behave today when entered with forceSearchCorpusRefresh: true. The theme submenu follows the same established contract. Fixing it in isolation for themes would be inconsistent; fixing it globally should be a deliberate, separately tested change.

  3. Risk vs. reward: The flash is sub-frame in practice (the sync corpus refresh happens on the same main actor call, so the search corpus is already populated before the detached search kicks off). The actual visible flicker, if any, is masked by the loading state we already display. Adding forceSearchCorpusRefresh as a sync-seed trigger could cause unintended double-renders in other submenu flows.

Will track this as a follow-up UX polish item. Thanks for the thorough analysis.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@debgotwired Thanks for the context and rationale — agreed on deferring this from the feature PR given the shared nature of scheduleCommandPaletteResultsRefresh.

If helpful, I can open a follow‑up issue that scopes a global, low‑risk improvement across all submenus. Proposed acceptance criteria:

  • On forceSearchCorpusRefresh: true, the command list seeds synchronously with the up‑to‑date corpus before any detached search runs, so the first paint shows stable rows (e.g., Back + Loading or actual items) without a transient empty state.
  • No regression to selection anchoring, pending activations, or requestID gating.
  • Covered with a test that enters a submenu and asserts the first visible result set is non‑empty when loading is in progress.

Optionally, the solution could be:

  • Either a new seed mode in scheduleCommandPaletteResultsRefresh (defaulting to current behavior) to keep backwards compatibility, or
  • A small helper that synchronously materializes preview results from the refreshed corpus before kicking off the async search, used by all call sites that do a forced refresh.

Would you like me to file that issue and assign it to you?


✏️ Learnings added
Learnt from: debgotwired
Repo: manaflow-ai/cmux PR: 1149
File: Sources/ContentView.swift:3977-3978
Timestamp: 2026-03-10T09:33:29.814Z
Learning: In manaflow-ai/cmux (Sources/ContentView.swift), scheduleCommandPaletteResultsRefresh(forceSearchCorpusRefresh:) is shared command‑palette infrastructure across all submenus. Do not change its sync‑seeding behavior within feature‑scoped PRs; treat brief initial flashes as consistent with existing submenus. Any UX improvement (e.g., synchronous seeding on forced corpus refresh) should be implemented and tested globally in a dedicated follow‑up PR.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


🧠 Learnings used
Learnt from: atani
Repo: manaflow-ai/cmux PR: 819
File: Sources/ContentView.swift:3194-3196
Timestamp: 2026-03-04T14:05:48.668Z
Learning: In manaflow-ai/cmux (PR `#819`), Sources/ContentView.swift: The command palette’s external window labels intentionally use the global window index from the full orderedSummaries (index + 1), matching the Window menu in AppDelegate. Do not reindex after filtering out the current window to avoid mismatches (“Window 2” for an external window is expected).

Learnt from: apollow
Repo: manaflow-ai/cmux PR: 1089
File: Sources/ContentView.swift:6055-6057
Timestamp: 2026-03-09T02:09:08.742Z
Learning: In manaflow-ai/cmux (Sources/ContentView.swift), within CommandPaletteSwitcherSearchIndexer.metadataKeywordsForSearch(_:detail:), when tags are present, only add "tag" and "topic" to contextKeywords; do not append "claude" unconditionally to avoid false-positive switcher matches.

Learnt from: CR
Repo: manaflow-ai/cmux PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-03-05T00:05:51.436Z
Learning: Applies to **/GhosttyTerminalView.swift : `SurfaceSearchOverlay` must be mounted from `GhosttySurfaceScrollView` in `Sources/GhosttyTerminalView.swift` (AppKit portal layer), not from SwiftUI panel containers such as `Sources/Panels/TerminalPanelView.swift`

Learnt from: atani
Repo: manaflow-ai/cmux PR: 819
File: Sources/AppDelegate.swift:3491-3493
Timestamp: 2026-03-04T14:06:16.241Z
Learning: For manaflow-ai/cmux PR `#819` (Japanese i18n), keep scope limited to localization changes; UX enhancements like preferring workspace.customTitle in workspaceDisplayName() or altering move-target labels should be handled in a separate follow-up issue.

Learnt from: atani
Repo: manaflow-ai/cmux PR: 819
File: Sources/AppDelegate.swift:0-0
Timestamp: 2026-03-04T14:05:42.574Z
Learning: Guideline: In Swift files (cmux project), when handling pluralized strings, prefer using localization keys with the ICU-style plural forms .one and .other. For example, use keys like statusMenu.unreadCount.one for the singular case (1) and statusMenu.unreadCount.other for all other counts, and similarly for statusMenu.tooltip.unread.one/other. Rationale: ensures correct pluralization across locales and makes localization keys explicit. Review code to ensure any unread count strings and related tooltips follow this .one/.other key pattern and verify the correct value is chosen based on the count.

Learnt from: austinywang
Repo: manaflow-ai/cmux PR: 954
File: Sources/TerminalController.swift:0-0
Timestamp: 2026-03-05T22:04:34.712Z
Learning: Adopt the convention: for health/telemetry tri-state values in Swift, prefer Optionals (Bool?) over sentinel booleans. In TerminalController.swift, socketConnectable is Bool? and only set when socketProbePerformed is true; downstream logic must treat nil as 'not probed'. Ensure downstream code checks for nil before using a value and uses explicit non-nil checks to determine state, improving clarity and avoiding misinterpretation of default false.

Learnt from: moyashin63
Repo: manaflow-ai/cmux PR: 1074
File: Sources/AppDelegate.swift:7523-7545
Timestamp: 2026-03-09T01:38:24.337Z
Learning: When the command palette is visible (as in manaflow-ai/cmux Sources/AppDelegate.swift), ensure the shortcut handling consumes most Command shortcuts to protect the palette's text input. Specifically, do not allow UI zoom shortcuts (Cmd+Shift+= / Cmd+Shift+− / Cmd+Shift+0) to trigger while the palette is open. Do not reorder shortcut handlers (e.g., uiZoomShortcutAction(...)) to bypass this guard; users must close the palette before performing zoom actions. This guideline should apply to Swift source files handling global shortcuts within the app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make left sidebar theme-aware and add Cmd+Shift+P Ghostty theme submenu

1 participant