Skip to content

Fix mobile feature flag isolation warning - #9013

Closed
lawrencecchen wants to merge 1 commit into
mainfrom
fix-main-mobile-flag-warning
Closed

lawrencecchen wants to merge 1 commit into
mainfrom
fix-main-mobile-flag-warning

Conversation

@lawrencecchen

@lawrencecchen lawrencecchen commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • mark the immutable feature-flag definition as nonisolated and Sendable
  • expose the mobile workspace flag definition and fallback as immutable off-main values
  • keep the mutable feature-flag store MainActor-isolated

Unblocks the speculative merge gate for #8850.

Testing


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.


Summary by cubic

Fixes the Swift concurrency actor-isolation warning for the mobile workspace feature flag. Removes the mobileWorkspaceChangesFlag warning and unblocks the merge for #8850.

  • Bug Fixes
    • Marked CmuxFeatureFlagDefinition as nonisolated and Sendable.
    • Made mobileWorkspaceChangesFlag and its defaults nonisolated static let.
    • Kept the mutable feature-flag store MainActor-isolated; no behavior changes.

Written for commit 355bb3f. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • Refactor
    • Improved feature-flag access across execution contexts without changing available flags or their values.

@coderabbitai

coderabbitai Bot commented Jul 27, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 05f3b98b-a876-4c33-94c9-fc6ca9d2a18e

📥 Commits

Reviewing files that changed from the base of the PR and between 45a4ddf and 355bb3f.

📒 Files selected for processing (1)
  • Sources/FeatureFlags.swift

📝 Walkthrough

Walkthrough

Swift actor-isolation annotations are updated for feature-flag definitions and the mobile workspace changes cached default and flag, enabling non-main-actor access without changing flag values or semantics.

Changes

Feature flag isolation

Layer / File(s) Summary
Update feature flag isolation annotations
Sources/FeatureFlags.swift
CmuxFeatureFlagDefinition, mobileWorkspaceChangesDefault, and mobileWorkspaceChangesFlag are marked nonisolated.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Possibly related PRs

Suggested reviewers: azooz2003-bit


Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 error)

Check name Status Explanation Resolution
Cmux Swift @Concurrent ❌ Error loadPostHogControlPlaneFlags is a nonisolated async network helper awaited inside a @MainActor task in refreshRemoteFlags(), so it lacks the required @concurrent boundary. Mark the network loader (and any async callee chain it depends on) @concurrent, or move the fetch onto a detached/background actor before awaiting it.
✅ Passed checks (24 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: fixing the mobile feature flag isolation warning.
Description check ✅ Passed The description covers the required Summary and Testing sections and is detailed enough, though some template-only sections are omitted.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Cmux Swift Actor Isolation ✅ Passed The PR only marks immutable Sendable feature-flag values nonisolated; it doesn’t add shared mutable Sendable state or loosen any UI-bound store isolation.
Cmux Swift Blocking Runtime ✅ Passed Diff only adds nonisolated/Sendable annotations in FeatureFlags.swift; it introduces no waits, sleeps, sync dispatch, polling, or locks.
Cmux Browser Automation Off-Main ✅ Passed Only Sources/FeatureFlags.swift changed; no browser.* routing, WebKit waits, socket-worker policy, or browser automation tests were touched.
Cmux Expensive Synchronous Load ✅ Passed PASS: The only change is actor-isolation annotations in Sources/FeatureFlags.swift; no synchronous agent-history loads, scans, or close-path parsing were added or moved.
Cmux Cache Substitution Correctness ✅ Passed The patch only marks immutable feature-flag definitions/defaults nonisolated; it doesn’t replace any fresh persistence/history/snapshot read with cache-backed data.
Cmux No Hacky Sleeps ✅ Passed Only Sources/FeatureFlags.swift changed, and it adds Swift actor-isolation annotations; the no-hacky-sleeps rule targets non-Swift runtime scripts.
Cmux Algorithmic Complexity ✅ Passed Diff only tweaks actor-isolation on feature-flag constants/definitions; no new scans, sorts, joins, or scalable-data algorithm changes. allFlags is a fixed 9-item registry.
Cmux Swift Concurrency ✅ Passed The diff only adds nonisolated annotations to feature-flag declarations; it does not introduce DispatchQueue, Combine, completion-handler, or new fire-and-forget Task patterns.
Cmux Swift Package Boundaries ✅ Passed The diff only adjusts actor isolation/Sendable on existing feature-flag declarations; it doesn’t introduce or expand independently testable domain logic in the app target.
Cmux Swiftpm Lockfiles ✅ Passed Diff only changes Sources/FeatureFlags.swift; no Package.swift, Package.resolved, .gitignore, or Xcode project paths were modified.
Cmux Swift Logging ✅ Passed Diff only changes actor isolation in FeatureFlags.swift; no print/debugPrint/dump/NSLog/Logger additions or changes appear.
Cmux User-Facing Error Privacy ✅ Passed The diff only changes actor-isolation annotations in FeatureFlags.swift; it adds no user-facing errors, alerts, or recovery copy.
Cmux Full Internationalization ✅ Passed Diff only changes Swift actor-isolation annotations; no user-facing text, catalogs, or locale files were added or changed.
Cmux Swiftui State Layout ✅ Passed Diff only changes feature-flag isolation in Sources/FeatureFlags.swift; it introduces no SwiftUI state/layout patterns covered by the rule.
Cmux Architecture Rethink ✅ Passed Diff only relaxes actor isolation for immutable feature-flag values; it adds no timing, locking, observer, or split-ownership workaround.
Cmux Swift Auxiliary Window Close Shortcuts ✅ Passed Diff only changes Sources/FeatureFlags.swift; no NSWindow/NSPanel/WindowGroup or cmux window-identifier code is introduced or modified.
Cmux Source Artifacts ✅ Passed Only Sources/FeatureFlags.swift changed, and it’s a normal hand-written source edit; no logs, caches, build output, or other artifacts were added.
Cmux No Test Or Debug Seam In Production Source ✅ Passed The DEBUG-gated values are production feature-flag defaults used by the flag itself, and no test/debug accessor or seam was added in Sources/.
Cmux No Ambient Global State ✅ Passed Patch only adds nonisolated/Sendable to existing flag definitions and static lets; no new free funcs, mutable globals, namespaces, or singletons.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-main-mobile-flag-warning

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@lawrencecchen

Copy link
Copy Markdown
Contributor Author

Superseded by the equivalent isolation fix now on main via #8699, specifically bbcbf81. Closing this duplicate; the feature PR will be re-gated against current main.

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.

1 participant