[orchestrator-v2] fix(mobile): Stabilize iOS draft attachments, Hermes sort, and Home#3923
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
ApprovabilityVerdict: Needs human review This PR bundles significant runtime behavior changes including shell sync strategy refactoring (HTTP heal before socket subscription, authoritative snapshot acceptance), subagent thread exclusion from home list, and draft attachment handling fixes. The shell sync changes in particular alter core state synchronization logic and warrant human review. You can customize Macroscope's approvability policy. Learn more. |
2857eb3 to
76a88a0
Compare
Persist dual-tagged draft image attachments, replace Hermes-missing toSorted with copySorted on mobile-reachable paths, hide subagent threads from Home, and stabilize Home native-stack options to avoid PreventRemove max-update-depth.
76a88a0 to
6e9701d
Compare
33a612d to
10513f1
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 10513f1. Configure here.
Port the ios-fixes-main shell reconnect heal to orchestration V2: always HTTP-heal (or force a full socket snapshot) before afterSequence resume, reject stale full snapshots, and normalize active/archive membership from archivedAt so dropped archive deltas cannot stick threads on the home list.
10513f1 to
a5467d3
Compare

Summary
Array.prototype.toSortedwith a shared copy-sort helper.PreventRemoveProvider.Problem and Fix
idand adataUrl. The start-turn path did not treat those dual-tagged attachments as uploads, so order and persistence broke for mobile screenshots.Array.prototype.toSorted. CTM queue UI calls it fromderiveThreadQueueWorkflowState/ThreadQueueControl, so queuing a reply or finishing a turn can crash withTypeError: undefined is not a function.@t3tools/shared/ArraycopySorted([...values].sort) and use it on mobile-reachable call sites (threadWorkflows,ThreadRelationshipsBanner,use-thread-selection, CTMmodel.ts).lineage.relationshipToParent === "subagent"when grouping Home rows; keep fork threads.setOptionsand could hit maximum update depth throughPreventRemoveProvideron CTM device launches.afterSequenceresume could skip a droppedthread.archivedshell delta after later events advancedsnapshotSequence, leaving archived threads active on Home (reproduced with a paired CTM environment).afterSequenceresume; if HTTP fails, force a full socket snapshot; normalize active/archive membership fromarchivedAt; reject stale non-authoritative full snapshots.Validation
Arraytests.vp check(0 errors).@t3tools/shared,@t3tools/client-runtime,@t3tools/mobile.shell-sync/shellReducer): passcom.mwolson.t3code.v2.devfrom local orchestrator-v2 integration; queued reply send after active turn finished without crash; Home list usable after nav stability fix.Notes
t3code/codex-turn-mappingonly. Main-line ios-on-main (fix(mobile): Harden iOS reconnect, crash capture, and chat layout on main #3910) does not haveThreadQueueControl/ this queue path.Note
Fix iOS draft attachments, shell sync membership, and stale closures in mobile Home header
persistAttachmentsin commands.ts to correctly remap upload attachments to server-assigned IDs while preserving order; local preview-only IDs are no longer dispatched.normalizeShellThreadMembershipto re-partition threads between active and archive lists based onarchivedAt, fixing mis-tagged deltas keeping archived threads in active lists.propsRefso header action callbacks always read current props..toSorted()calls withcopySortedfrom a new Array.ts utility to avoid mutating source arrays; filters subagent threads from home thread groups.Macroscope summarized a5467d3.
Note
Medium Risk
Touches shared turn-start attachment persistence and client-runtime shell bootstrap/healing used by mobile and desktop; incorrect heal or snapshot rules could show wrong thread lists, but behavior is heavily unit-tested.
Overview
Fixes several mobile orchestration-v2 issues: draft image turns, Hermes crashes, Home list noise, navigation loops, and ghost threads after archive.
Attachments:
persistAttachmentsnow treats any attachment with adataUrlas an upload (including dual-tagged local preview ids), strips local-only fields beforeassetsPersistChatAttachments, and remaps persisted server ids in original order alongside already-stored attachments.Hermes: Adds
@t3tools/shared/ArraycopySortedand replacesArray.prototype.toSortedon mobile-reachable paths (queue UI, thread relationships, thread selection, model option comparison) to avoid runtime fatals on RN Hermes.Home: Skips threads with
lineage.relationshipToParent === "subagent"when building Home groups (forks remain). HomeHeader memoizes native stack options and routes toolbar handlers throughpropsRef; HomeRouteScreen stabilizes Settings/New Task callbacks and title option objects to reducesetOptions/PreventRemoveProviderupdate depth.Shell sync: On each live session, heals membership via HTTP full snapshot before
afterSequenceresume (warm disk cache alone no longer drives resume). AddsnormalizeShellThreadMembershipand prefersarchivedAtover mis-taggedlocationon deltas; rejects stale non-authoritative full snapshots; when HTTP heal fails, accepts the next socket full snapshot authoritatively.Reviewed by Cursor Bugbot for commit a5467d3. Bugbot is set up for automated code reviews on this repo. Configure here.