Skip to content

fix(desktop): restore the Swift build broken on main by SCA-103 - #10576

Merged
Git-on-my-level merged 3 commits into
mainfrom
fix/desktop-swift-build-omisupport
Jul 25, 2026
Merged

Git-on-my-level merged 3 commits into
mainfrom
fix/desktop-swift-build-omisupport

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Jul 25, 2026 •

Copy link
Copy Markdown
Member

Summary

main does not compile. The desktop Swift package has been broken since 2026-07-25 05:55 UTC. This restores it, and separately unblocks the local pre-push desktop gate on current Xcode.

Part 1 — the broken build

desktop-swift-ci on merge commit 3a63002ea9 (run 30146613366) failed. Every later main run reported success only because it changed no Swift and skipped the lane, so the red state stayed invisible for ~12 hours.

Three compile errors, all introduced by d0215a40a0 ("chore(desktop): add storage and bridge diagnostics", #10523):

Error Cause
FocusAssistant.swift:694: cannot find 'DesktopLocalProfile' in scope missing import OmiSupport
RewindIndexer.swift:441: cannot find 'DesktopLocalProfile' in scope missing import OmiSupport
ChatProvider.swift:1667: non-sendable result type 'DesktopErrorDiagnosticContext?' cannot be sent from actor-isolated context type is not Sendable but crosses an actor boundary

DesktopLocalProfile is a package enum in the separate OmiSupport target (Package.swift excludes Sources/OmiSupport from the Omi Computer target), so a file that uses it needs the import. Every pre-existing caller — AuthService.swift, OmiApp.swift, AgentVMService.swift — already has it. The two new call sites did not.

DesktopErrorDiagnosticContext is produced on whichever actor detected the failure (AgentRuntimeProcess) and consumed on @MainActor ChatProvider, so it must be Sendable. Its element type becomes any Sendable rather than Any, which makes the compiler enforce the scalar-only contract the type's own doc comment already states:

Callers must construct these from enums, booleans, and numeric measurements; paths, exception messages, identifiers, and user content do not belong here.

Every existing value is already String/Int/Int64/Bool, so no construction site changes — only the two declarations.

Scope was measured, not guessed. I scanned every Sources/ file outside the OmiSupport/Theme/OmiWAL/VoiceTurnDomain targets for all four symbols OmiSupport exports (DesktopLocalProfile, DesktopStorageIdentity, DesktopDevRuntimeManifest, DesktopDevRuntimeManifestStore). Exactly three files use one without importing; the third, AppBuild.swift, mentions DesktopStorageIdentity only inside a doc comment and correctly needs no import.

Part 2 — the local gate on Swift 6.2

Separate commit, separate concern. scripts/pre-push runs xcrun swift build -c debug against whatever Xcode is selected locally — deliberately, per desktop/macos/AGENTS.md:249: "never promote it to the full pinned-Xcode suite ... that push-time budget belongs to CI." CI pins Xcode 16.4. On Xcode 26.2 / Swift 6.2.3 the package additionally fails:

Sources/Rewind/Core/RewindDatabase.swift:10:22: error: static property 'terminationInProgress'
  is not concurrency-safe because it is nonisolated global shared mutable state

Every access already goes through terminationLock — isTerminationInProgress reads under it, and the sole write at line 352 takes it — so the property is correctly synchronized; the compiler cannot see an NSLock. nonisolated(unsafe) states that invariant where the compiler can act on it. No runtime behavior changes, and the spelling has been valid since Swift 5.10, comfortably below the pinned toolchain.

Effect: the debug build a contributor is asked to run before every push now succeeds on current Xcode instead of failing on code they did not touch. Closes #10570.

Verification

Clean worktree at origin/main (cb918cf0ba) + this diff, Xcode 26.2 (17C52) / Apple Swift 6.2.3:

xcrun swift build -c debug --package-path .               -> Build complete! (189.40s), exit 0
xcrun swift build -c debug --build-tests --package-path . -> Build complete!, exit 0

Negative direction, because a fix that was never seen failing is not known to fix anything:

  • Without either commit, the same command reproduces all three Part 1 errors, matching CI's Xcode 16.4 log (run 30167210176, job 89702239163) line-for-line.
  • Reverting only the nonisolated(unsafe) hunk reproduces the Part 2 error alone, so that annotation is load-bearing rather than decorative.

terminationInProgress appears 0 times in CI's log and DesktopLocalProfile 98 times, which is how the two parts were separated: Part 1 is what CI sees, Part 2 is what only a newer local toolchain sees.

What I did not verify

I did not run the desktop Swift test suite, only its compile (--build-tests links Omi ComputerPackageTests successfully). The suite needs the pinned Xcode 16.4 for a trustworthy result and this machine has 26.2; CI is the authority and runs it on this PR. No test source is touched by this diff.

A gap this exposed, not fixed here

Worth stating so it is not mistaken for covered. The desktop Swift check never passed on #10523 — its runs went failure, cancelled, cancelled, cancelled, then skipped. The final cancelled was caused by the merge itself: desktop-swift-ci.yml includes closed in its PR trigger with cancel-in-progress: ${{ github.event_name == 'pull_request' }}, so merging a PR supersedes its own in-flight verification, and the resulting closed run reports skipping.

That behavior is deliberate and contract-tested (test_closed_prs_release_the_same_pr_concurrency_group_without_allocating_a_runner — it protects scarce macOS runner capacity when a PR is abandoned). It is correct for a PR closed unmerged and load-bearing in the wrong direction for one closed by merging. Changing it means distinguishing github.event.pull_request.merged, which trades runner capacity for merge safety — a call for the owner of that contract, and not something I can verify without merging it. Filed separately as #10575 with the full timeline rather than bundled into a build fix.

Product invariants affected

  • INV-AUTH-1 (docs/product/invariants/auth-session.md)

Path-matched via desktop/macos/Desktop/Sources/Rewind/Core/RewindDatabase.swift. The change there is a nonisolated(unsafe) annotation on an already-lock-guarded private static; it touches no session invalidation policy, 401 handling, or ownership transition, and its guard tests are unmodified.

Failure class

Failure-Class: none

Two ordinary instance fixes. No registered class covers "a symbol from a sibling SwiftPM target was used without importing it" — that is what the compiler is for, and it did catch it; the miss was in the merge gate, which is #10575's subject and not repaired here.

🤖 Generated with Claude Code

Review in cubic

Git-on-my-level and others added 3 commits July 25, 2026 13:46
`main` does not compile. `desktop-swift-ci` on the merge commit 3a63002
(run 30146613366) failed, and every later main run reported success only
because it changed no Swift and skipped the lane, so the red state went
unnoticed for ~12h.

Three compile errors, all from d0215a4 ("chore(desktop): add storage and
bridge diagnostics", #10523):

  Sources/ProactiveAssistants/.../FocusAssistant.swift:694: cannot find
    'DesktopLocalProfile' in scope
  Sources/Rewind/Services/RewindIndexer.swift:441: cannot find
    'DesktopLocalProfile' in scope
  Sources/Providers/ChatProvider.swift:1667: non-sendable result type
    'DesktopErrorDiagnosticContext?' cannot be sent from actor-isolated context

`DesktopLocalProfile` is `package enum` in the separate `OmiSupport` target;
both new call sites use it without `import OmiSupport`. Every pre-existing
caller (AuthService.swift, OmiApp.swift, ...) already imports it.

`DesktopErrorDiagnosticContext` is produced on whichever actor detected the
failure and consumed on `@MainActor` ChatProvider, so it must be `Sendable`.
Its element type becomes `any Sendable` rather than `Any`, which makes the
compiler enforce the scalar-only contract its own doc comment already states
("enums, booleans, and numeric measurements; paths, exception messages,
identifiers, and user content do not belong here"). Every existing value is
already String/Int/Int64/Bool, so no construction site changes.

Scope was measured, not guessed: a scan of all Sources/ files outside the
OmiSupport/Theme/OmiWAL/VoiceTurnDomain targets for the four symbols
OmiSupport exports found exactly three candidates, one of which
(AppBuild.swift, DesktopStorageIdentity) is a doc comment and needs no import.

Ships a changelog fragment rather than the `no-changelog-needed` label: the
label satisfies only the PR run, and these are product `Sources/` paths with
no push-lane path exemption, so the label would redden main on the merge push
(the case check-desktop-changelog.py:32 warns about).

Verification, on a clean worktree at origin/main (cb918cf) + this diff:
  xcrun swift build -c debug --package-path .               -> Build complete! (189.40s), exit 0
  xcrun swift build -c debug --build-tests --package-path . -> Build complete!, exit 0

Before the fix the same command reproduced all three errors, matching CI's
Xcode 16.4 log for run 30167210176 job 89702239163 line-for-line.

Failure-Class: none

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
`scripts/pre-push` runs `xcrun swift build -c debug` against whatever Xcode is
selected locally -- deliberately, per desktop/macos/AGENTS.md:249: "never
promote it to the full pinned-Xcode suite ... that push-time budget belongs to
CI." CI pins Xcode 16.4. On Xcode 26.2 / Apple Swift 6.2.3 the package
additionally fails:

  Sources/Rewind/Core/RewindDatabase.swift:10:22: error: static property
    'terminationInProgress' is not concurrency-safe because it is nonisolated
    global shared mutable state [#MutableGlobalVariable]

Every access already goes through `terminationLock` (`isTerminationInProgress`
reads under it; the only write takes it), so the property is correctly
synchronized -- the compiler just cannot see an NSLock. Swift 6.0 accepted it,
Swift 6.2 does not.

`nonisolated(unsafe)` states that invariant where the compiler can act on it.
No runtime behavior changes, and it has been valid since Swift 5.10, well
below the pinned toolchain. Kept to a trailing comment on the existing line so
this 3520-line file does not grow: product-file-line-count-ratchet rejects any
increase, and a 3-line explanation is not worth a baseline raise.

With this, the desktop debug build a contributor is asked to run before every
push succeeds on current Xcode instead of failing on code they did not touch.
Closes #10570.

Verification, clean worktree at origin/main (cb918cf) + both commits:
  Xcode 26.2 (17C52) / swift 6.2.3
  xcrun swift build -c debug --package-path .               -> Build complete!, exit 0
  xcrun swift build -c debug --build-tests --package-path . -> Build complete!, exit 0
Reverting only this hunk reproduces the error, so the annotation is load-bearing.

Failure-Class: none

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Resolve conflicts in Logger.swift (keep strict Sendable + any Sendable)
and RewindDatabase.swift (keep lock-guard comment on terminationInProgress).

Co-authored-by: David Zhang <[email protected]>
@Git-on-my-level

Copy link
Copy Markdown
Member Author

@cursor address merge conflicts

@cursor

cursor Bot commented Jul 25, 2026 •

Copy link
Copy Markdown

Merge conflicts are resolved and pushed on fix/desktop-swift-build-omisupport.

Conflicts (2 files):

  1. Logger.swift — main had landed @unchecked Sendable with [String: Any]; this branch keeps the PR fix: Sendable with [String: any Sendable] and the doc comment on the actor boundary.

  2. RewindDatabase.swift — Both sides already had nonisolated(unsafe) on terminationInProgress; kept this branch’s // guarded by terminationLock comment.

Commit: b4e7d41417 — Merge origin/main into fix/desktop-swift-build-omisupport

The PR should be mergeable again; CI can run on the updated branch.

Open in Web Open in Cursor 

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.

pre-push desktop Swift compile cannot pass on Xcode 26.2 (Swift 6.2 strict concurrency)

2 participants