Repository navigation
Integrate native stream recovery and repair persistence/control regressions - #242
Conversation
# Conflicts: # .papercuts/troubleshooting.md # android/app/src/main/java/sbtbiswas/AidenOnTheGo/features/chat/AidenChatDetailScreen.kt # android/app/src/test/java/sbtbiswas/AidenOnTheGo/AidenChatTest.kt # ios/AidenOnTheGo/Features/Remote/AidenChatFeature.swift # ios/AidenOnTheGoTests/AidenChatTests.swift # main/services/managed-worktree-lifecycle.test.ts
There was a problem hiding this comment.
✅ No new issues found.
Reviewed the changed iOS and Android stream recovery, cache ordering/deletion fencing, draft and attachment lifetime, control paths, and regression tests. The Android chat test task completed successfully locally; iOS XCTest could not be run in this Linux environment because xcodebuild is unavailable, so hosted iOS checks remain the validation source for that platform.
GPT Luna | 𝕏
Hermes Review BotConfidence: 5 Engine: SummaryIntegrates native stream recovery across iOS and Android while resolving concurrency and persistence ordering regressions uncovered during merged chat suite execution. Partial event stream text, reasoning, and tool state are now maintained in process-local buffers reconstructed from sequence zero on cold resume, eliminating disk I/O per streaming event while preserving warm cursors in memory. Cache mutations are sequenced through monotonic write tokens and deletion floors so that delayed workspace list updates or companions cannot overwrite newer authoritative detail writes or resurrect deleted chats. Stop operations and approval decisions preserve current authority under cancellation without resurrecting stale state or prematurely releasing control. Maintainers should double-check that future metadata writers consistently reserve tokens prior to any asynchronous boundary to prevent stale snapshot admission. Confidence Score: 5/55/5: Fully traced end-to-end state transitions, concurrency actor boundaries, and token sequencing across iOS and Android implementations, verified all sibling call sites against modified cache APIs, and confirmed edge-case handling under cancellation, failed writes, and deletion races. 📁 Important Files Changed
FindingsNo findings. 📊 Sequence DiagramsequenceDiagram
autonumber
participant UI as Client UI
participant VM as AidenChatViewModel
participant Cache as AidenChatCache
participant Host as Remote Host (Mac)
Note over UI,Host: Stream Recovery Flow (Cold Start)
UI->>VM: load()
VM->>Cache: loadActiveStream(instanceId, chatId)
Cache-->>VM: cached active stream (streamId, deviceId)
VM->>Host: streamStatus(streamId)
Host-->>VM: status (running)
VM->>Host: openStream(streamId, lastEventId=0)
loop Event Stream (Replaying from Seq 0)
Host-->>VM: SSE event (text_delta, reasoning, etc.)
Note over VM: Apply in-memory buffer without per-event disk write
end
Host-->>VM: SSE terminal event (DONE)
VM->>Host: chat(chatId) [authoritative transcript]
Host-->>VM: remoteChat
VM->>Cache: reserveChatWrite() -> writeToken
VM->>Cache: saveChat(remoteChat, writeToken)
Cache-->>VM: accepted (true)
VM->>Cache: removeActiveStream(streamId)
Note over VM: Clear ephemeral buffers & release activeStreamID
VM-->>UI: Update UI state (canSend = true)
Machine-Readable Findings[]
|
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.
Reviewed changes Re-reviewed the latest merge into feature/native-ownership-integration against the prior Pullfrog review, with focus on newly integrated activity presentation and agent-role contract updates across iOS and Android.
- Integrated activity presentation updates Merged compact-context disclosure behavior into both native clients and verified the corresponding regression coverage.
- Preserved recovery integration Rechecked the native stream recovery, persistence ordering, and run-control paths after the
mainsync; no regressions were found. - Ran focused checks Android chat/progress tests and the Bot inbox writer harness passed. The harness's macOS-only native-helper cases returned early on this Linux runner.
GPT Luna | 𝕏
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.
Reviewed changes Re-reviewed the seven commits since the prior Pullfrog review, focusing on the latest main merge's paired-desktop terminology, approval guidance, and native-test updates.
- Replaced Mac-specific guidance Updated iOS and Android approval, Bot, speech, and workspace copy; iOS now explains the specific capability that blocks an approval response.
- Enabled Linux regression coverage Expanded native inbox-writer tests to Linux and added a worktree-inclusion no-op regression for unsupported transfer helpers. The built Bot writer suite passed locally; Android
AidenChatTestcould not be rerun because offline Gradle resolution lackedorg.gradle.toolchains.foojay-resolver-convention:1.0.0, and the online retry timed out. - Refreshed mobile terminology and integration records Updated activity-summary expectations to the current Computer Use terminology and incorporated the Linux desktop plan and troubleshooting notes.
GPT Luna | 𝕏
Bring in native stream recovery (#242). ios/AGENTS.md takes main's simulator/physical-device guidance and keeps real audio routes and interruption handling in the hardware-dependent list. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GAkZRgQzUoKWGpgupF3a4D
…lone Keeps both sides: - vision-analysis-tool: the PR's wrapper plus main's normalizeContext in the core. - package.json: test scripts are the union of both sides (test:compaction gains memory-shared; the PR's test:cli wiring is kept). Aligns the standalone CLI with root pi 0.87.1 (#246): - Bump packages/cli @earendil-works/pi-coding-agent 0.84.4 -> 0.87.1 and add @earendil-works/chord 0.87.1, which is no longer hoisted. - btw wraps its context in normalizeContext. The child beforeTool context drops systemPrompt. Re-vendor the advisor runtime. - The build's external check falls back to ESM resolution for import-only subpath exports, and allowlists the optional lazy kerberos import. - Session import accepts storage-v1 `v: 4` and 0.84.4 `version: 4` headers. - Commit the CLI themes regenerated for #199's new presets. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GAkZRgQzUoKWGpgupF3a4D
Main landed #246 (pi 0.87.1 transcript-owned system prompts), #242, #199 and #254. - pi-agent-runtime-harness: keep main's installCompactedMessages and emit the meter projection from the installed (system-preserving) messages after preflight and per-turn compaction. - agents-instructions: withAgentsInstructionsEstimate builds a one-message transcript, applies the section-patching refresher and reads getCurrentSystemPrompt; the block stripper also handles a block rendered without a base prompt. - llm-client: register the generation context profile after the initial AGENTS.md apply so the captured prompt and tracker baseline agree. - agents-instructions.test: union of both import sets; meter tests use AgentContext transcripts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GAkZRgQzUoKWGpgupF3a4D
…e-go midflight ops iOS: stop()/Redirect share cancelStreamOnce, now carrying #242's cached active-stream ownership check and isRemoved guards; handleRemoval also clears the run-input receipt. Stream restore follows #242's overlapped restoration. Android: keep both flow imports. 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>

Change
Integrate #217's native stream recovery with current main and repair the regressions exposed by executing the merged chat tests. Includes the preserved conflict resolution across iOS and Android.
Workspace lists now preserve a detail write that commits after an intervening list refresh, while stale lists and companions cannot undo a later authoritative omission. Successful persistence receipts distinguish those orderings and exclude failed writes. Empty stream-cache admission releases Send before unrelated draft I/O. Stop remains pending until host confirmation and is reserved before cache access; canceled approval responses cannot resurrect an older card. Explicit approval reload preserves the existing stream consumer.
Seven new iOS regression tests cover cache ordering, failed persistence, cancellation and duplicate Stop. Android's recovery fixture now omits absent fields forbidden by the wire projection; production validation is unchanged.
Validation
build-for-testingalso pass for generic iOS with signing disabled.Testing guidance
The owner authorized simulator testing and requested the policy update included in
ios/AGENTS.md. Physical devices remain required for hardware-specific checks and release acceptance. The six skipped tests require opt-in physical pairing, signed Keychain, or Image Playground configuration. No physical-device or release acceptance is claimed.The first simulator execution caught an additional deletion-era overlay violation; the final merge now enforces per-chat deletion fences on retained detail rows too. Existing regression coverage and the full suite pass after that correction.
Evidence:
docs/testing/aiden-on-the-go/native-ownership-integration-repair.md.