Skip to content

Mobile Cancel Reconnect#606

Merged
arul28 merged 3 commits into
mainfrom
ade/mobile-cancel-reconnect-3681c221
Jun 18, 2026
Merged

Mobile Cancel Reconnect#606
arul28 merged 3 commits into
mainfrom
ade/mobile-cancel-reconnect-3681c221

Conversation

@arul28

@arul28 arul28 commented Jun 18, 2026

Copy link
Copy Markdown
Owner

Summary

Describe the change.

What Changed

Key files and behaviors.

Validation

How you tested.

Risks

Anything to watch.

ADE   Open in ADE  ·  ade/mobile-cancel-reconnect-3681c221 branch  ·  PR #606

Summary by CodeRabbit

  • Bug Fixes

    • Enhanced socket disconnection to properly cancel all scheduled reconnection attempts, including network path reconnects, before completing the disconnection process.
  • New Features

    • Implemented intelligent automatic primary tools lane selection with smart fallback logic for optimal workflow initialization.

Greptile Summary

  • Tightens iOS sync disconnect behavior so user-initiated disconnects cancel scheduled reconnect work, including network-path reconnects.
  • Updates Work new-chat routing and lane resolution so primary-aware defaults are used for initial selection and auto-created lane naming.
  • Adds test coverage and documentation for reconnect cancellation behavior.

Confidence Score: 5/5

The changes are narrowly scoped to reconnect cancellation and default lane selection behavior, with corresponding test and documentation updates.

No code issues were identified in the reviewed diff, and the modified areas appear consistent with the described behavior.

T-Rex T-Rex Logs

What T-Rex did

  • The before/after evidence demonstrates that disconnect() now calls cancelReconnectLoop() and cancels the networkPathReconnectTask, changing the probe outcome from scheduled_network_reconnect_remains_after_disconnect: True to False.
  • Two log artifacts were produced to document the before/after disconnect behavior, including the command, cwd, commit SHA, source file, extracted function bodies, scenario result, assertion output, and exit code.
  • T-Rex ran the requested verification, but its local artifact references were not uploaded.

View all artifacts

T-Rex Ran code and verified through T-Rex

Comments Outside Diff (2)

  1. apps/ios/ADE/Views/Work/WorkNewChatScreen.swift, line 248 (link)

    P1 Initial lane stays first

    The screen still initializes selectedLaneId from preferredLaneId ?? lanes.first?.id, so the new primary-lane fallback is not used for normal chat or CLI starts. If the lane list is ordered with a worktree before the primary lane, a user who opens New Chat from the all filter and submits without changing the picker starts the session in the worktree lane instead of the primary lane.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: apps/ios/ADE/Views/Work/WorkNewChatScreen.swift
    Line: 248
    
    Comment:
    **Initial lane stays first**
    
    The screen still initializes `selectedLaneId` from `preferredLaneId ?? lanes.first?.id`, so the new primary-lane fallback is not used for normal chat or CLI starts. If the lane list is ordered with a worktree before the primary lane, a user who opens New Chat from the `all` filter and submits without changing the picker starts the session in the worktree lane instead of the primary lane.
    
    How can I resolve this? If you propose a fix, please make it concise.

    Fix in Claude Code

  2. apps/ios/ADE/Views/Work/WorkNewChatScreen.swift, line 246-250 (link)

    P1 Initial selection skips primary

    When WorkRootScreen opens this page from the All-lanes filter, it now passes nil for preferredLaneId, but this initializer still falls back to lanes.first?.id. If the lane list is ordered as worktree first and primary second, the screen opens with the worktree selected and a normal submit uses that worktree as targetLaneId, so the primary fallback is never used.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: apps/ios/ADE/Views/Work/WorkNewChatScreen.swift
    Line: 246-250
    
    Comment:
    **Initial selection skips primary**
    
    When `WorkRootScreen` opens this page from the All-lanes filter, it now passes `nil` for `preferredLaneId`, but this initializer still falls back to `lanes.first?.id`. If the lane list is ordered as worktree first and primary second, the screen opens with the worktree selected and a normal submit uses that worktree as `targetLaneId`, so the primary fallback is never used.
    
    How can I resolve this? If you propose a fix, please make it concise.

    Fix in Claude Code

Reviews (3): Last reviewed commit: "ship: iteration 2 - align default new ch..." | Re-trigger Greptile

@vercel

vercel Bot commented Jun 18, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
ade Ignored Ignored Preview Jun 18, 2026 1:52am

@arul28

arul28 commented Jun 18, 2026

Copy link
Copy Markdown
Owner Author

@copilot review but do not make fixes

@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

SyncService.disconnect now calls cancelReconnectLoop() instead of directly canceling reconnectTask, and cancelReconnectLoop is extended to also cancel networkPathReconnectTask. Two #if DEBUG test helpers and a new XCTest case are added. WorkNewChatScreen gains an autoCreateToolsLane computed property with a three-tier lane selection fallback.

Changes

SyncService disconnect cancels networkPathReconnectTask

Layer / File(s) Summary
cancelReconnectLoop and disconnect fix with debug helpers and test
apps/ios/ADE/Services/SyncService.swift, apps/ios/ADETests/ADETests.swift
cancelReconnectLoop() now cancels and nils networkPathReconnectTask in addition to the reconnect loop task. disconnect calls cancelReconnectLoop() instead of directly canceling reconnectTask. Two #if DEBUG helpers (scheduleNetworkPathReconnectForTesting, hasScheduledReconnectWorkForTesting) expose reconnect scheduling for tests. A new @MainActor XCTest verifies that disconnect() cancels scheduled work, sets connectionState to .disconnected, and sets ade.sync.autoReconnectPausedByUser in UserDefaults.

WorkNewChatScreen primary tools lane selection

Layer / File(s) Summary
autoCreateToolsLane computed property
apps/ios/ADE/Views/Work/WorkNewChatScreen.swift
Adds a private computed property that selects the primary tools lane from lanes by checking laneType == "primary", then a normalized name match of "primary", then falls back to the first lane in the list.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

ios

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Mobile Cancel Reconnect' directly aligns with the main changes: disconnect now properly cancels reconnect loops and scheduled reconnect work.
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 ade/mobile-cancel-reconnect-3681c221

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 and usage tips.

@mintlify

mintlify Bot commented Jun 18, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
ade-ac1c6011 🟢 Ready View Preview Jun 18, 2026, 1:21 AM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@arul28 arul28 force-pushed the ade/mobile-cancel-reconnect-3681c221 branch from 7d41ff7 to e2b4d71 Compare June 18, 2026 01:23
@arul28

arul28 commented Jun 18, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: e2b4d71fcd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/ios/ADE/Views/Work/WorkNewChatScreen.swift
@arul28

arul28 commented Jun 18, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 67aa5392da

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/ios/ADE/Views/Work/WorkRootScreen.swift
@arul28

arul28 commented Jun 18, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: bf0786431a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@arul28 arul28 merged commit 16f7ebb into main Jun 18, 2026
27 checks passed
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