Repository navigation
fix(desktop): restore the Swift build broken on main by SCA-103 - #10576
Merged
Merged
Conversation
`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]>
Member
Author
|
@cursor address merge conflicts |
|
Merge conflicts are resolved and pushed on Conflicts (2 files):
Commit: The PR should be mergeable again; CI can run on the updated branch. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
maindoes 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-cion merge commit3a63002ea9(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):FocusAssistant.swift:694: cannot find 'DesktopLocalProfile' in scopeimport OmiSupportRewindIndexer.swift:441: cannot find 'DesktopLocalProfile' in scopeimport OmiSupportChatProvider.swift:1667: non-sendable result type 'DesktopErrorDiagnosticContext?' cannot be sent from actor-isolated contextSendablebut crosses an actor boundaryDesktopLocalProfileis apackage enumin the separateOmiSupporttarget (Package.swiftexcludesSources/OmiSupportfrom theOmi Computertarget), 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.DesktopErrorDiagnosticContextis produced on whichever actor detected the failure (AgentRuntimeProcess) and consumed on@MainActorChatProvider, so it must beSendable. Its element type becomesany Sendablerather thanAny, which makes the compiler enforce the scalar-only contract the type's own doc comment already states: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 theOmiSupport/Theme/OmiWAL/VoiceTurnDomaintargets for all four symbolsOmiSupportexports (DesktopLocalProfile,DesktopStorageIdentity,DesktopDevRuntimeManifest,DesktopDevRuntimeManifestStore). Exactly three files use one without importing; the third,AppBuild.swift, mentionsDesktopStorageIdentityonly inside a doc comment and correctly needs no import.Part 2 — the local gate on Swift 6.2
Separate commit, separate concern.
scripts/pre-pushrunsxcrun swift build -c debugagainst whatever Xcode is selected locally — deliberately, perdesktop/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:Every access already goes through
terminationLock—isTerminationInProgressreads under it, and the sole write at line 352 takes it — so the property is correctly synchronized; the compiler cannot see anNSLock.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:Negative direction, because a fix that was never seen failing is not known to fix anything:
nonisolated(unsafe)hunk reproduces the Part 2 error alone, so that annotation is load-bearing rather than decorative.terminationInProgressappears 0 times in CI's log andDesktopLocalProfile98 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-testslinksOmi ComputerPackageTestssuccessfully). 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, thenskipped. The finalcancelledwas caused by the merge itself:desktop-swift-ci.ymlincludesclosedin its PR trigger withcancel-in-progress: ${{ github.event_name == 'pull_request' }}, so merging a PR supersedes its own in-flight verification, and the resultingclosedrun reportsskipping.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 distinguishinggithub.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
docs/product/invariants/auth-session.md)Path-matched via
desktop/macos/Desktop/Sources/Rewind/Core/RewindDatabase.swift. The change there is anonisolated(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