Repository navigation
Carry remaining #217 mobile stream-recovery work onto main - #255
Conversation
* fix(android): fence deferred home cache writes * fix(android): reject superseded cross-owner chat reads * fix(android): order Home summary requests and pagination commits * Preserve Android turn receipts across response ownership changes (#227) * Preserve Android accepted turn receipts across response ownership changes * Keep receipt merges under request authority in both completion orders (cherry picked from commit 1a3cd3e)
* Own iOS Bot navigation responses and live permission publication * fix(ios): keep in-flight Bot opens and same-policy grants through restoration Restoration re-ran on an open's own path change and superseded it, and it reset an already-presented chat's live mutation grant to false before revalidating, leaving it disabled after a transient failure. Restoration now adopts an in-flight open under identical inputs, and keeps a prior live grant only when the write and notice policy are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GAkZRgQzUoKWGpgupF3a4D * fix(ios): preserve newer detail state across workspace list responses (#234) * fix(ios): admit workspace lists against newer detail owners * fix(ios): preserve accepted rename titles and coherent chat revisions (#236) * fix(ios): preserve rename receipts without replacing newer chat state * Preserve authoritative list titles across detail hydration * Fence iOS Home responses and preserve admitted row ownership (#238) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit ccb6415) Conflict resolution against #242: saveChats keeps #242's committed-write ordering (older lists are partial companions, rows come from successful detail commits, and the list token is the max). #233's in-memory list, rename-title and fetch authority stay. The durable list extends only the last admitted rows, so a detail whose disk write failed stays a memory-only winner on the read path and never becomes a durable row. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GAkZRgQzUoKWGpgupF3a4D
Integration coverage for the merged stream-recovery and acknowledged run-control state machines: - iOS: removal while a stop, approval response or approval snapshot is held cannot report, restore a card or re-read; URLError(.cancelled) on stop/approval leaves the run live without optimistic cancel or card resurrection, and a second Stop may retry. - Android: unpair during a held stop or approval snapshot, and a dropped stop write that is not retried. #217 fixtures now encode the Mac wire shape (absent optionals omitted) so main's reasoning validator accepts them. (cherry picked from commit d41ad06) Conflict resolution against #242: #242 already added the cancelledControls mode, its URLProtocol failure path and the load()-based mismatched-approval delivery, so those duplicates were dropped. The cancelled Stop test now follows #242's silent-cancellation rule (no "Stop was not confirmed"). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GAkZRgQzUoKWGpgupF3a4D
Executed on the iPhone 17 Pro simulator for the first time, the stacked ownership changes exposed real interaction bugs with #217: - Workspace list merges pulled a removed chat's later detail-only re-admission into a list reserved before the removal. - Chat removal minted a fresh summary reservation and cleanup-era Home writes needed the full floor, so unrelated pending-era rows were lost. Removal keeps its deletion token; partial writes are row updates. Test-only corrections: whole-second dates for ISO 8601 round trips, create the cache root before blocking its chats directory, and assert that a fresh detail re-admission owns its Home row (#238 projection). (cherry picked from commit 37b5920) Conflict resolution against #242: #242 already moved the cached-stream check ahead of draft I/O in load(), so that duplicate was dropped. Its committed-write ordering also admits an older create list's own row when the create's detail committed after the omitting list, so create() no longer needs the `!saveChats` fallback. admitCreatedWorkspaceChat stays for the superseded and failed-write create paths carried next. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GAkZRgQzUoKWGpgupF3a4D
A superseded saveChat fell back to cache.loadChat, which reads disk only. saveChat admits the winner in memory before its file write, so a failed winner write left no file (row removed, stream startup aborted) or an older snapshot (rebase onto stale data). Both sites now use cache.admittedChat. Adds failed-write regression tests for both paths. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GAkZRgQzUoKWGpgupF3a4D (cherry picked from commit eb2dc82)
After adopting the admitted winner, the superseded create branch (and the detail disk-failure branch) returned before any workspace-list write, so a failed detail write with a writable list cache lost the created row on an offline cold reopen. Both branches now call admitCreatedWorkspaceChat, which also accepts a newer detail winner only while that winner is newer than the list token, so later removal, purge and newer list omissions win. (cherry picked from commit 1ad6af1) Adjusted for #242: the helper extends the admitted list rows themselves, not the merged memory view, so only the created chat (not other chats' memory-only detail winners) becomes a durable row. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GAkZRgQzUoKWGpgupF3a4D
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GAkZRgQzUoKWGpgupF3a4D
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GAkZRgQzUoKWGpgupF3a4D
There was a problem hiding this comment.
Important
The Bot owner can cancel an unrelated selected chat, and rename completion can republish a row omitted by a newer list. Please resolve these races and close the documented iOS runtime-test gap before merging.
Reviewed changes I reviewed the 19-file diff at feb1726d, covering Android chat and Home cache admission, iOS Bot/Workspace/Home response ownership, rename reconciliation, and the integration regressions.
- Android response admission Request-origin tokens and retained in-memory winners fence stale chat, summary, and turn-receipt writes across owners, removal, and purge.
- iOS navigation and permissions Bot open/restoration ownership and live policy checks are integrated with the shared conversation presentation path.
- Workspace persistence Rename receipts use a durable title overlay rather than replacing newer transcript state; create/send fallbacks retain the admitted winner.
- Regression coverage New held network/cache schedules cover receipts, pagination, run controls, rename/list races, deletion, and write failures.
⚠️ iOS runtime coverage is pending on this integrated head
The PR description reports iOS build-for-testing but says AidenChatTests has not executed on this branch. Compile-only verification does not exercise the held actor/network schedules added by this integration; please run the simulator suite on this head before merging.
Technical details
# Verify integrated iOS schedules on simulator
## Affected sites
- `ios/AidenOnTheGoTests/AidenChatTests.swift` contains newly added held HTTP/cache regressions.
- The PR description reports `build-for-testing` passed but says simulator XCTest execution is pending.
## Required outcome
- Execute the iOS test suite on exact head `feb1726d` and report the result before merging.GPT Luna | 𝕏
| let deviceID = deepLinkedDeviceID, | ||
| presentationScope == PresentationScope(instanceID: instanceID, deviceID: deviceID) else { return } | ||
| let scope = PresentationScope(instanceID: instanceID, deviceID: deviceID) | ||
| presentationOwner.invalidate() |
There was a problem hiding this comment.
[P2] A permission result for the retained deep link can invalidate a different chat's in-flight load. Once the access notice is accepted, the deep-link Bot lookup can still be pending while this callback runs; it invalidates the shell-wide owner even when another chat is selected. That chat's continuation then exits, and restorationID does not change for this result, so the UI can remain on its skeleton or read-only state.
Technical details
# Preserve the selected Bot presentation
## Affected sites
- `ios/AidenOnTheGo/Features/Remote/AidenProductShellView.swift:896` invalidates the global presentation owner for every deep-link permission change.
- `ios/AidenOnTheGo/Features/Remote/AidenProductShellView.swift:998-1004` and `:1194-1200` publish only while the current attempt owns that owner.
- `ios/AidenOnTheGo/Features/Remote/AidenProductShellView.swift:902-903` keys restoration by `restorationID`, which does not include the deep-link permission result.
## Required outcome
- A permission update for a non-selected deep link must not cancel an unrelated selected chat; changes relevant to the selected chat must trigger validation against its current policy.| guard await cache.reconcileWorkspaceChat(admitted, instanceId: instanceId, authority: origin, cutoff: receiptCutoff) else { return } | ||
| let publicationGeneration = presentationGenerations[chat.id] ?? 0 | ||
| guard let presentation = await cache.presentedWorkspaceChat(instanceId: instanceId, workspaceId: workspaceId, chatId: chat.id) else { return } | ||
| guard coordinator.isCurrent(context), publicationGeneration == (presentationGenerations[chat.id] ?? 0), cache.isChatWriteRetained(origin, instanceId: instanceId, chatId: chat.id) else { return } |
There was a problem hiding this comment.
[P2] A newer authoritative list can omit this chat after the cache read but before this continuation publishes. load() updates chats without advancing this model's presentationGenerations, and isChatWriteRetained only fences removal/purge, so this guard can still pass and upsert can re-add the omitted row. Recheck current admitted workspace-list authority after the await before publishing, including the refresh path.
Technical details
# Do not republish a row omitted by a newer list
## Affected sites
- `ios/AidenOnTheGo/Features/Remote/AidenChatFeature.swift:813-814` guards and publishes the rename receipt presentation.
- `ios/AidenOnTheGo/Features/Remote/AidenChatFeature.swift:825-826` has the same gap after rename refresh.
- `ios/AidenOnTheGo/Features/Remote/AidenChatFeature.swift:724-735` admits and publishes a fetched authoritative list without advancing the per-chat presentation generation.
## Required outcome
- A rename continuation must not publish a chat when a later admitted authoritative list has omitted it.| let value = RenameTitle(instanceId: instanceId, chatId: receipt.id, title: newerListTitle ?? receipt.title) | ||
| renameTitles[instanceId, default: [:]][receipt.id] = PendingRename(value: value, origin: origin, cutoff: titleCutoff) | ||
| retiredRenameTitles[instanceId]?.remove(receipt.id) | ||
| try? save(value, to: fileURL(kind: "rename-titles", instanceId, receipt.id)) |
There was a problem hiding this comment.
[P2] A failed sidecar write can drop the only durable copy of a successful rename title. If a newer detail winner has already made this PATCH receipt ineligible to replace the canonical chat, try? hides failure to persist the title overlay; after relaunch, the old detail/list title is shown offline. Keep the receipt title durable through an admitted cache representation or surface and repair this persistence failure.
Technical details
# Retain a successful title when its canonical receipt is stale
## Affected sites
- `ios/AidenOnTheGo/Persistence/AidenChatCache.swift:599` ignores failure to write the `rename-titles` record.
- `ios/AidenOnTheGo/Persistence/AidenChatCache.swift:601-605` can retain a newer canonical detail winner instead of the PATCH receipt.
- `ios/AidenOnTheGo/Models/AidenChat.swift:973-975` keeps the presentation-only title out of canonical cache/wire encoding.
## Required outcome
- When the canonical chat is newer than the PATCH receipt, failure to persist its title overlay must not silently leave restart-time Workspace/detail presentation with the pre-rename title.
Hermes Review BotConfidence: 5 Engine: SummaryRemaining stream-recovery capabilities from #217 are ported cleanly onto Confidence Score: 5/5Full confidence: the complete diff and all modified Swift and Kotlin source files were traced end-to-end across UI, view models, actors/coroutines, cache write clocks, and serialization boundaries. Every core path aligns with the design memory contracts ( 📁 Important Files Changed
FindingsNo findings. 📊 Sequence DiagramsequenceDiagram
autonumber
actor User
participant ViewModel as ChatViewModel / Feature
participant Cache as ChatCache (Actor / Mutex)
participant Disk as Local File Storage
participant Server as Aiden Backend (SSE / HTTP)
User->>ViewModel: Send Message / Prompt
ViewModel->>Cache: reserveWriteToken(chatId)
Cache-->>ViewModel: token #T1
ViewModel->>Cache: mergeTurnReceiptOverlay(token #T1, pendingTurn)
Cache->>Disk: Persist unconfirmed snapshot
par Stream Execution
ViewModel->>Server: POST /chat/stream
Server-->>ViewModel: SSE Stream Events (turn #T1)
ViewModel->>Cache: recordStreamMarker(chatId, sequence)
and Authoritative Refresh
ViewModel->>Server: GET /chat/{id}
Server-->>ViewModel: Authoritative Chat Details
ViewModel->>Cache: presentedChat(chatId, serverChat, throughToken: #T1)
Note over Cache: Retires overlays <= #T1<br/>Preserves overlays > #T1<br/>Updates memory winner
Cache->>Disk: Persist reconciled snapshot
end
Cache-->>ViewModel: Admitted Reconciled Chat
ViewModel-->>User: Render updated UI & localTitleOverride
Machine-Readable Findings[]
|
Android startTurn keeps #225's installation, client and receipt fences and adopts main's selected-skill and pending-question resets. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GAkZRgQzUoKWGpgupF3a4D
There was a problem hiding this comment.
ℹ️ No new issues found in this incremental change. Existing review threads remain open and are outside this delta.
Reviewed changes I re-reviewed the merge commit added after feb1726d, focusing on Android's accepted-turn flow.
- Turn receipt admission Moved successful turn handling behind installation-retention checks, admitted the receipt through the shared cache, and started streaming only from the admitted stream.
GPT Luna | 𝕏

Carries the rest of #217 (mobile stream recovery, 0.50.0) onto main. #242 (squash 7033118) already contains #217 through 62fa352 plus its own repairs. These #217 commits were not on main, so they are cherry-picked here onto a fresh branch from main. This is not a reconciliation merge. #217 can be closed as superseded once this lands.
Carried commits (in order)
admittedChat49f8d90 (papercuts only) did not apply cleanly, so I skipped it.
Resolved against #242
Where #242 already fixed something, I kept #242's version and left the #217 copy out. Everything #242 didn't have is kept.
AidenChatCache.saveChatskeeps Integrate native stream recovery and repair persistence/control regressions #242's ordering of committed writes:committedChatWritesand are read from disk.It also keeps Preserve iOS Bot navigation and live permission ownership #233's in-memory list, rename titles,
isAuthoritativeFetchauthority andBoolreturn. The durable list only extends the last admitted rows, not the merged memory view. So a detail whose disk write failed stays a winner in memory but never becomes a durable row (Integrate native stream recovery and repair persistence/control regressions #242'stestFailedDetailWriteDoesNotPromoteOlderDiskSnapshotIntoList).admitCreatedWorkspaceChat(1ad6af1) is the one create-specific exception. It also extends only the admitted rows.Left out as duplicates of Integrate native stream recovery and repair persistence/control regressions #242:
load().!saveChatsfallback increate(). Integrate native stream recovery and repair persistence/control regressions #242's older-list rule already admits the create's own committed row.cancelledControlsenum case, its URLProtocol branch, and itsrestorePendingApprovaldelivery.Changed to match Integrate native stream recovery and repair persistence/control regressions #242: the carried cancelled-Stop test now follows Integrate native stream recovery and repair persistence/control regressions #242's rule that a cancelled Stop is silent.
Pullfrog comment at
scripts/bot-inbox-writer.test.mjs:73(Linux EPIPE claim): main's version no longer makes that claim. Its comment is platform-neutral, so there was nothing to change.Verification
build-for-testing(iPhone 17 Pro simulator) succeeded after every cherry-pick and after the--no-ffmerge of the latest main.testDebugUnitTest: 207/207 passed.lintis clean.npm run test:ci-policy: 45/45 passed.Refs #217, #242.
🤖 Generated with Claude Code
https://claude.ai/code/session_01GAkZRgQzUoKWGpgupF3a4D