Skip to content

Keep startup retry in reconnecting state - #13856

Merged
teamleaderleo merged 1 commit into
mainfrom
feat-startup-retry-state
Sep 23, 2026
Merged

teamleaderleo merged 1 commit into
mainfrom
feat-startup-retry-state

Conversation

@azooz2003-bit

@azooz2003-bit azooz2003-bit commented Sep 23, 2026 •

Copy link
Copy Markdown
Collaborator

The startup retry introduced by #13750 can leave the iOS shell showing Not Connected while it is already retrying the saved Mac. Lawrence's recording shows Reconnecting, then about two seconds of Not Connected, followed by the same Mac and its workspaces appearing.

This removes the delayed retry and starts it through retryActiveMacReconnect, which sets isReconnectingStoredMac before its first await. The global status remains Reconnecting until the retry resolves.

Validation:

  • swift test --filter CmuxMobileShellTests.MobileShellCompositePreviewTests/userRetryCoalescesWhileReconnectIsAlreadyInFlight passes.
  • The shell package compiles.
  • ReconnectRouteSelectionTests/hungRedialSettlesAtDeadlineAndUnfreezesRecovery still fails in the existing deadline test before this UI-only change is involved.

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

Stops the iOS shell from showing Not Connected for a couple of seconds during startup retry. The delayed root-level retry is now started through retryActiveMacReconnect, which sets the reconnecting state before its first await, so the global status stays Reconnecting until the retry resolves.

Written for commit ff0fda2. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • Bug Fixes
    • Improved reconnection handling for stored Macs after failed connection attempts.
    • Reconnection status is now reported immediately, with canceled attempts stopped before they begin.

@github-actions

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@coderabbitai

coderabbitai Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: manaflow-ai/cmux/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 24515e95-6c12-4fba-9d92-582439d9f11b

📥 Commits

Reviewing files that changed from the base of the PR and between cd4d84e and ff0fda2.

📒 Files selected for processing (1)
  • Packages/iOS/CmuxMobileShellUI/Sources/CmuxMobileShellUI/CMUXMobileRootView.swift

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

The stored Mac reconnect flow now performs a direct retry. It checks cancellation before the retry and starts reconnecting state before the first await.

Changes

Stored Mac reconnect

Layer / File(s) Summary
Direct reconnect retry
Packages/iOS/CmuxMobileShellUI/Sources/CmuxMobileShellUI/CMUXMobileRootView.swift
The code replaces delayed recursive retry logic with store.retryActiveMacReconnect. It checks cancellation before the attempt and reports reconnecting state immediately.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~5 minutes

Change: Bug fix

Suggested reviewers: lawrencecchen

Merge Risk: ⚪ Minimal · up to ff0fd

The stored-Mac retry now starts directly while setting reconnecting state before the asynchronous attempt. No actionable merge-blocking risk remains in the supplied evidence.

🚥 Pre-merge checks | ✅ 24 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the problem, the implementation, and validation results. It omits the required Testing, Demo Video, Review Trigger, and Checklist sections, including the required UI behavior … Add the required template sections. Include testing details and manual verification, attach a short demo video, include the review-trigger comment, and complete the checklist. For the iOS connectivity checklist item, explain why existing de…
✅ Passed checks (24 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: keeping startup retries in the reconnecting state.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files.
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 Cloud Persistent Session And Early Input ✅ Passed PASS. The pull request changes only startup retry orchestration in CMUXMobileRootView.swift. It calls the existing retryActiveMacReconnect API; that API is identical in the base and head revisions…
Cmux Swift Actor Isolation ✅ Passed The PR changes only CMUXMobileRootView.swift. The new retry call runs inside Task { @mainactor in ... }. CMUXMobileShellStore aliases MobileShellComposite, which is explicitly @MainActor, so…
Cmux Swift Blocking Runtime ✅ Passed PASS. The only changed production Swift file removes the one-second ContinuousClock().sleep from the startup retry path. It replaces the delayed recursive call with store.retryActiveMacReconnect, …
Cmux Browser Automation Off-Main ✅ Passed PASS. The pull request changes only Packages/iOS/CmuxMobileShellUI/Sources/CmuxMobileShellUI/CMUXMobileRootView.swift. It replaces a delayed startup reconnect with store.retryActiveMacReconnect; i…
Cmux Expensive Synchronous Load ✅ Passed PASS. The PR changes only CMUXMobileRootView.swift and replaces a one-second delay/recursive reconnect with an async store.retryActiveMacReconnect call. The diff adds no `RestorableAgentSessionInd…
Cmux Cache Substitution Correctness ✅ Passed PASS. The Swift diff changes only startup reconnect scheduling. It replaces a one-second delay and recursive UI method call with store.retryActiveMacReconnect(stackUserID:), which sets `isReconnecti…
Cmux No Hacky Sleeps ✅ Passed PASS. The pull request changes only CMUXMobileRootView.swift, which is Swift. The custom check applies to TypeScript, JavaScript, shell, and non-Swift runtime scripts. The diff removes a one-second …
Cmux Algorithmic Complexity ✅ Passed The diff changes only the startup retry dispatch in CMUXMobileRootView.swift. It replaces a delayed recursive call with one call to the existing retryActiveMacReconnect method. It adds no loop, co…
Cmux Swift Concurrency ✅ Passed PASS. The diff only replaces the existing one-second sleep and recursive retry with an async call to store.retryActiveMacReconnect. That API sets isReconnectingStoredMac before its first await. Th…
Cmux Swift @Concurrent ✅ Passed PASS. The diff changes only the startup retry closure. The closure remains explicitly @MainActor and adds no @concurrent or nonisolated async declaration. MobileShellComposite is @MainActor,…
Cmux Swift Package Boundaries ✅ Passed PASS: The diff changes only CMUXMobileRootView, a SwiftUI root-view composition surface. It replaces a one-second delay and recursive UI retry with the existing `CmuxMobileShell.MobileShellComposite…
Cmux Swiftpm Lockfiles ✅ Passed PASS. The authoritative PR diff changes only Packages/iOS/CmuxMobileShellUI/Sources/CmuxMobileShellUI/CMUXMobileRootView.swift. It does not change a Package.swift, Package.resolved, .gitignore…
Cmux Swift Logging ✅ Passed The pull request changes only reconnect control flow and adds a comment. It does not add or materially change print, debugPrint, dump, NSLog, file/stdout diagnostics, Logger declarations, or l…
Cmux User-Facing Error Privacy ✅ Passed The diff adds no user-facing error, alert, command output, or diagnostic payload. It changes the root view to call the existing retryActiveMacReconnect API and adds a developer comment containing th…
Cmux Full Internationalization ✅ Passed PASS. The PR changes only reconnect control flow in CMUXMobileRootView.swift. The added Not Connected text appears only in a developer comment. No user-facing string literal, localization key, str…
Cmux Swiftui State Layout ✅ Passed PASS. The PR changes only the retry logic in CMUXMobileRootView.reconnectStoredMacIfNeeded. It removes a delay and recursive call, then invokes the existing store.retryActiveMacReconnect API. The …
Cmux Architecture Rethink ✅ Passed PASS. The diff removes the one-second delayed retry and recursive root-view entrypoint. It delegates the retry to the existing MobileShellComposite.retryActiveMacReconnect owner, which sets `isRecon…
Cmux Swift Auxiliary Window Close Shortcuts ✅ Passed The PR changes only stored-Mac reconnect retry logic in CMUXMobileRootView.swift. The diff adds no NSWindow, NSPanel, NSWindowController, Window, WindowGroup, window identifier, or close-s…
Cmux Source Artifacts ✅ Passed PASS. The PR changes only Packages/iOS/CmuxMobileShellUI/Sources/CmuxMobileShellUI/CMUXMobileRootView.swift. The diff contains hand-written Swift source and comments in a tracked Sources path. It …
Cmux No Test Or Debug Seam In Production Source ✅ Passed The PR changes only the production startup retry call in CMUXMobileRootView.swift. It removes a delay and recursive call, then calls the existing retryActiveMacReconnect production API. No `#if DE…
Full details: Description check

Explanation

The description explains the problem, the implementation, and validation results. It omits the required Testing, Demo Video, Review Trigger, and Checklist sections, including the required UI behavior demo and checklist confirmations.

Resolution

Add the required template sections. Include testing details and manual verification, attach a short demo video, include the review-trigger comment, and complete the checklist. For the iOS connectivity checklist item, explain why existing deterministic soak coverage applies or update the coverage and record the workload result.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

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.

@teamleaderleo

Copy link
Copy Markdown
Collaborator

Agent review.

The delayed root-level retry slept 1 s and then called reconnectStoredMacIfNeeded(allowRetry: false), so the global status read Not Connected while the same Mac was already being retried. It now goes through store.retryActiveMacReconnect(stackUserID:), which marks the retry as reconnecting before its first await. One file, iOS shell UI only. CI green.

Merging with the user's go-ahead.

— Ibex g1 🌿

@teamleaderleo
teamleaderleo enabled auto-merge (squash) September 23, 2026 23:34
@teamleaderleo
teamleaderleo merged commit 4dafd99 into main Sep 23, 2026
47 of 50 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in cmux backlog Sep 23, 2026
rustybret pushed a commit to rustybret/bmux that referenced this pull request Sep 24, 2026
1ba90a1 fix(ios): decrypt pushes on release builds by sharing state via the keychain (manaflow-ai#14039)
73f12e5 Regenerate config schema and shortcut docs for toggleFileEditorWordWrap (manaflow-ai#14052)
4dafd99 Keep startup retry in reconnecting state (manaflow-ai#13856)
58bbcfa coderouter: report Server-Timing on every route (manaflow-ai#13976)
e5a1d11 Drop the retired staging legacy Subrouter default (manaflow-ai#13946)
727d3f0 ci: fetch previous nightly DMGs by asset id and treat misses as no delta (manaflow-ai#13970)
72490a9 ci: make cross-run product reuse actually adopt products (manaflow-ai#14007)

# Conflicts:
#	.github/workflows/ci-macos.yml
#	.github/workflows/persistent-macos-compile.yml
#	.github/workflows/test-e2e.yml
#	.github/workflows/test-ios.yml
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.

2 participants