Repository navigation
Preserve iOS Bot navigation and live permission ownership - #233
sambitcreate merged 4 commits into
Conversation
|
Run failed. View the logs →
|
very-hermes-bot
left a comment
There was a problem hiding this comment.
Inline review — 2 finding(s) anchored to the diff. See the pinned summary comment for the overview.
|
|
||
| let cached = aidenAdmittedCachedBotChat( | ||
| await AidenChatCache.shared.loadChat( | ||
| let existing = chatsByScope[scope]?[chatID]?.chat |
There was a problem hiding this comment.
[P1 · logic] hydrateRestoredPath prematurely resets mutation access to false for existing presentations
Confidence: 0.92
When hydrateRestoredPath runs for an existing in-memory conversation, it unconditionally overwrites chatsByScope with allowsMutations: false before checking permissions; if offline or during a transient network error, mutations are left permanently disabled.
Repair: Only apply allowsMutations: false when existing == nil, preserving the existing presentation's mutation authorization during permission revalidation.
| var capturedContext: AidenRemoteRequestContext? | ||
| let attempt = presentationOwner.begin(instanceID: scope.instanceID, deviceID: scope.deviceID, chatID: chatID, fullAccessAllowed: fullAccessActionsAllowed()) | ||
| do { |
There was a problem hiding this comment.
[P1 · logic] hydrateRestoredPath disowns openConversation and triggers duplicate loads on user navigation
Confidence: 0.9
Tapping a conversation invokes openConversation which begins an attempt and sets path, triggering .task(id: restorationID) to run hydrateRestoredPath; hydrateRestoredPath unconditionally calls presentationOwner.begin, replacing current with a new attempt and invalidating openConversation midway through execution.
Repair: In hydrateRestoredPath, check if presentationOwner already has an active attempt matching the scope, chatID, and policy before calling begin, returning early if a load is already in flight.
Hermes Review BotConfidence: 5 Engine: SummaryGuarantees response ownership and prevents stale concurrency races across iOS Bot navigation, live permission publication, workspace chat lists, rename patches, and home summary caching. Navigation attempts and continuations are owned through Confidence Score: 5/5All changed Swift files, concurrency and actor isolation boundaries, cache clock synchronizers, view models, and 26 comprehensive regression tests were thoroughly traced end-to-end across lifecycle, navigation, and storage failure boundaries. 📁 Important Files Changed
FindingsNo findings. Sequence DiagramsequenceDiagram
autonumber
actor User
participant Shell as AidenBotShellView
participant Owner as AidenBotPresentationOwner
participant Server as Aiden Remote API
participant Cache as AidenChatCache
User->>Shell: Tap Bot conversation (openConversation)
Shell->>Owner: begin(chatID, canWrite, fullAccessAllowed, adoptable: true)
Shell->>Shell: path = [chatID] (updates navigation store & triggers restorationID)
Shell-->>Shell: hydrateRestoredPath() runs (.task)
Shell->>Owner: adoptsRestoration(chatID, canWrite, fullAccessAllowed)
Owner-->>Shell: true (in-flight open adopted; duplicate load suppressed)
Shell->>Server: GET /chats/{id}
Server-->>Shell: Chat payload
Shell->>Cache: saveChat(chat, writeToken)
Shell->>Cache: admittedChat(id)
Cache-->>Shell: Admitted winner
Shell->>Server: GET /bots/{id} (check permissions)
Server-->>Shell: Bot details & access mode
Shell->>Owner: ownsPermission(attempt, currentCanWrite, fullAccessActionsAllowed())
Owner-->>Shell: true (same policy preserved)
Shell->>Shell: Publish Presentation.resolved (mutations enabled)
Shell->>Owner: finish(attempt) (adoptable = false)
[]
|
…toration 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
|
Run failed. View the logs →
|
4 similar comments
|
Run failed. View the logs →
|
|
Run failed. View the logs →
|
|
Run failed. View the logs →
|
|
Run failed. View the logs →
|
…#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)
…nership Keep the base's absent-cache cursor retention alongside this branch's row-scoped admission and disk-failure safeguards in saveChatSummaries. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GAkZRgQzUoKWGpgupF3a4D
* Fence Android chat reads and Home summary admission (#225) * 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) * Preserve iOS Bot navigation and live permission ownership (#233) * 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 * test(mobile): cover #217 x #218 run controls on iOS and Android 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 * fix(ios): resolve the 9 failing AidenChatTests on #217 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 * fix(ios): superseded create/send read the admitted chat winner 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) * fix(ios): keep a superseded or failed create's row in the durable list 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 * docs(memory): record the #217 follow-up carry onto main 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>

Bot navigation can start duplicate chat loads through open and restoration. A delayed response or permission result could replace a newer transcript, publish an error after navigation, or restore mutation access after a policy downgrade.
Reserve cache authority before loading and tie continuations to the current navigation attempt. Keep the admitted cache winner in memory through disk failure and reject stale fallback after removal/purge. Permission completion preserves the current transcript and rechecks live write grants and notice policy; policy changes refresh permissions on the existing destination. Path changes invalidate ownership synchronously.
Stacked on PR217 ff777f5. This slice covers Bot navigation/permission responses; workspace rename/list response ownership remains assigned separately.
Validation: four XCTest methods cover held production GET ordering with disk failure/removal/purge, real navigation-store away/back ownership, held write/notice-policy downgrades, and a held create receipt that remains read-only pending live permission resolution. Generic iOS app/XCTest compilation passes;177 Android JVM tests, lint and instrumentation compilation pass; iOS policy31 Node tests plus20 Ruby tests/42 assertions pass. Both independent GPT-5.6 Sol medium final reviews are clear. Physical XCTest execution remains pending the unlocked, coordinated device slot; compiled regressions are not claimed as executed baseline reproductions.
Evidence:
.memory/ios-bot-response-ownership.md. No merge, release or deployment.Final exact-head acceptance
Head
0f94027e0666312b9724d08ea595104ae52779a8: hosted verify and Deterministic Electron E2E passed; Android hosted check skipped by changed-area detection. No unresolved review threads. Local generic iOS app/XCTest compilation, 177 Android JVM tests/lint/instrumentation compilation, and iOS policy checks passed; both independent GPT-5.6 Sol medium reviews clear. Combined integration c74195ccb also passed iOS compilation and157 host tests with both reviews clear (unchanged213 Android evidence retained). Physical XCTest/device acceptance remains unexecuted because the shared iPhone is locked. This is scoped Bot-response acceptance; workspace rename/Home response work remains assigned separately.