Fix Vault folder icons on Intel

Closed
AU
1mo ago
+1385-282

Fixes #4476.

Summary

  • Consolidates Vault sidebar section icon rendering into shared SectionIconImage / AgentIconImage paths used by the sidebar list, drag previews, and the "Show more" popover.
  • Resolves folder section icons through an AppKit-backed symbol image with a real Finder folder fallback instead of duplicated lazy SwiftUI Image(systemName:) branches.
  • Keeps branded agent icons on the shared path while preserving the previous SwiftUI Image(assetName) fallback if AppKit rejects an asset image.
  • Keeps the CI unit-test watchdog as the single xcodebuild process owner, with isolated DerivedData, process-group termination, nonblocking output drains, and stdout EOF handling.

Root Cause

The "By folder"/"By agent" tab icons live outside the virtualized/equatable Vault section subtree and render as plain static SF Symbols. The per-section folder icons were duplicated as computed @ViewBuilder branches inside sidebar row and popover views, so SwiftUI repeatedly resolved the same lazy symbol branch inside cached list subtrees. That can intermittently produce an empty symbol layer while leaving labels intact.

The fix makes section icons a single concrete value view and gives folder sections a deterministic AppKit NSImage fallback (NSWorkspace.shared.icon(for: .folder)) if SF Symbol resolution does not produce a renderable image.

Testing

  • Static validation: git diff --check origin/main...HEAD.
  • Static validation: plutil -lint cmux.xcodeproj/project.pbxproj.
  • Full build/test verification is delegated to GitHub Actions for this PR per the current no-local-build/no-local-test handoff.

Demo Video

No demo video is attached. The reported visual failure is intermittent and platform/render-layer dependent; I did not run a local or cloud app build before CI-green handoff.

Regression Test Status

No deterministic UI regression test was added. The failing state is an intermittent SwiftUI/AppKit render-layer blank icon, and a source-shape test would be fake coverage rather than a behavior proof.

Build Handoff

After CI is green, use the serialized cloud build lane:

/Users/austinwang/manaflow/cmuxterm-hq/scripts/reload-cloud.sh --tag issue-4476-vault-folder-icons-intel

View with Codesmith Autofix with Codesmith
Need help on this PR? Tag @codesmith with what you need. Autofix is disabled.


[!NOTE]
Medium Risk
UI icon path changes affect lazy Vault list rendering on Intel; CI watchdog changes how hung xcodebuild after XCTest crashes is killed, which could mask or alter failure signals if mis-tuned.

Overview
Fixes intermittent blank Vault folder icons by centralizing session sidebar icon rendering in SessionIndexIconImage and wiring SessionIndexView (section headers, drag previews, “Show more” popover) through SectionIconImage / AgentIconImage instead of duplicated lazy Image(systemName:) branches.

Folder sections now resolve icons via AppKit (NSImage SF Symbols with a Finder folder fallback when symbols are not renderable); agent icons validate catalog assets before use and still fall back to SwiftUI symbols. Template images are copied so shared NSImage caches are not mutated.

CI: the macOS unit-test step replaces the tee + shell poll loop with an inline Python watchdog that owns xcodebuild in a new session, streams logs to /tmp/test-output.txt, detects Program crashed:, uses non-blocking stdout reads, and terminates the process group on overall or post-crash quiet timeouts so expected-failure parsing can finish. The SPM-retry guard test is updated to assert the new behavior and forbid blocking readline().

Reviewed by Cursor Bugbot for commit 8581437d6081aebd59331956814a48f6987e75ba. Bugbot is set up for automated code reviews on this repo. Configure here.


Summary by cubic

Fixes intermittent blank Vault folder icons on Intel by centralizing section/agent icon rendering and resolving symbols via AppKit with a Finder-folder fallback; closes #4476. Hardens macOS CI by replacing tee with a nonblocking Python watchdog that streams logs to /tmp/test-output.txt, detects app-host crashes, and enforces quiet/overall timeouts.

  • Bug Fixes

    • Use SectionIconImage/AgentIconImage across sidebar, drag previews, and the popover. Resolve symbols via AppKit with template NSImage copies; validate asset images. Folder icons fall back to Finder. Agent icons now prefer AppKit-validated catalog images, then SwiftUI asset images, then system symbols.
  • Refactors

    • CI: keep SWIFT_BACKTRACE=interactive=no. New Python watchdog runs xcodebuild in a new session, streams and writes to /tmp/test-output.txt, uses nonblocking select/os.read, detects “Program crashed:”, drains ≤2s of tail output on exit, applies overall and configurable quiet timeouts (CMUX_XCTEST_CRASH_QUIET_TIMEOUT_SECONDS), and kills the process group on timeout (SIGTERM→SIGKILL). Guard test updated to assert markers and forbid blocking readline().

Summary by CodeRabbit

  • New Features
    • Consistent session list icons with smart fallbacks (asset image, system symbol, or folder) and improved template rendering for crisper visuals.
  • Refactor
    • Consolidated icon rendering into shared components used across section headers and popovers for a unified UI.
  • Chores
    • Updated CI test runner and backtrace behavior for improved test logging, crash handling, and retry checks.

Review Change Stack