Skip to content

Fix native stream replay and optimistic send recovery - #217

Closed
sambitcreate wants to merge 27 commits into
mainfrom
feature/mobile-stream-recovery
Closed

sambitcreate wants to merge 27 commits into
mainfrom
feature/mobile-stream-recovery

Conversation

@sambitcreate

@sambitcreate sambitcreate commented Sep 22, 2026 •

Copy link
Copy Markdown
Owner

What changed

Relaunching during a response previously resumed from a persisted sequence without the matching partial text. iOS and Android now reconstruct cold streams from zero while keeping warm reconnect cursors in memory, removing per-event disk writes. Refreshes cannot replace pending optimistic messages, Android stops on terminal frames even when transcript reconciliation retries, and Send waits until the prior stream has reconciled. Recovery warnings and title refresh preserve their ownership across sends.

No REST/SSE contract or UI styling change. PR #119 was inspected and its unrelated acceptance fixes remain untouched. Hermex fixes were verified against upstream and adapted conceptually to Aiden's implementation.

Validation

  • 177 Android JVM tests pass; lintDebug and instrumentation-test compilation pass.
  • New regressions fail on the original Android ViewModel in four cases (three optimistic-message losses, one cold-replay timeout), then pass with the fix.
  • iOS generic build-for-testing passes, including all new XCTest methods. This is compilation, not XCTest execution.
  • iOS release policy: 31 Node tests and 20 Ruby tests / 42 assertions pass.
  • Held-I/O follow-up covers status recovery admission, post-cache-write callback ownership, and stale HTTP loads after terminal settlement. The new Android held-load regression fails against the initial PR head, then passes fixed.
  • Accepted iOS cache writes carry monotonic tokens reserved before actor hops; per-chat/installation fences reject reordered stale writes and invalidate reservations on removal/purge. Regression delivers an admitted old write after terminal settlement and reopens disk, plus deletion/recreation and installation isolation coverage.
  • Caller-level rejection coverage holds accepted writes across deletion/newer snapshots and verifies stream, detail, workspace and Bot presentation handling. Valid create/rename/navigation and accepted-turn recovery survive supersession; only a newly admitted snapshot starts stream companions.
  • Stream companions carry the same deletion authority as their accepted chat, with retention checks before consumer startup. Held stream-write deletion and parent/sidebar removal propagation have caller regressions.
  • Independent GPT-5.6 Sol medium blast-radius and adversarial reviews completed; all actionable findings fixed and re-reviewed clear.
  • Physical iOS execution is blocked by the locked shared iPhone 13 Pro: preceding coordinated run reported com.apple.dt.deviceprep Code=-3: Unlock Sambit’s iPhone to Continue. No simulator or unlock bypass used.

Implementation/source pins and evidence are in .memory/mobile-stream-recovery.md.

Current head d3e34e6ccd265d34ed3f8d768334cf298dec6fc6 retains completed uploads through explicit chat removal, purge, and unpair cleanup. A reference-ID registry separates lifetime ownership from visible composer state; cancellation, explicit removal, and deletion share one cleanup task per reference. Successful turn receipts transfer ownership only if removal has not already won. The original client targets cleanup to the accepting server/device after local unpairing. Metadata writes are blocked throughout any pending chat cleanup, before the persistent deletion floor is installed.

Added held-I/O coverage includes completed uploads, explicit cleanup overlap, unpairing, successful/failed sends, receipt-versus-removal ordering, invalid references, and metadata writes during pending cleanup with the deleted row absent. Both independent Sol medium re-reviews are clear. Generic iOS XCTest compilation, Android 177 JVM tests/lint/instrumentation compilation, and iOS 31 Node plus 20 Ruby tests/42 assertions pass. Physical XCTest remains unexecuted. Remote network failures retain existing best-effort/expiry semantics; ordinary navigation deallocation is not a new cleanup contract.

The previous head 057dc7574d3c47d03e2a720e5f90003fd56a1771 passed every hosted CI check, including Electron E2E. Fresh hosted CI and review are required for this current native-code head.

Two separable test-harness fixes remain included: real-helper stdin EPIPE handling tolerates only EPIPE with exact normal failure exit 1; capacity assertions use the typed error’s own observation and allow large finite baseline statfs values. Focused tests and lint pass. PR221’s different production capacity contract is outside this change.

Broader cross-owner response/list/rename/Bot ownership remains assigned in a separate worktree; it is not claimed complete by this PR. No merge, release, or deployment.

Latest metadata cleanup correction: invalidation records its origin atomically, and cleanup completion invalidates every token reserved during removal. Metadata for unrelated chats remains writable as a partial upsert, preserving omitted cached rows and pagination cursor; pending purge remains fully fenced. Per-file authority protects fresh replacements, and cleanup does not mint a token that suppresses pending unrelated updates.

Two new XCTest methods cover18 held cleanup/writer combinations plus fresh full-snapshot precedence after remove/purge and installation isolation. Generic XCTest compilation passes (execution on the physical device remains pending), as do177 Android JVM tests/lint/instrumentation compilation and iOS policy31Node+20Ruby42 assertions. Both independent GPT-5.6 Sol medium final reviews are clear. Partial summary writes also avoid model-local generation poisoning; both generation999/1 delivery orders are covered. Fresh hosted acceptance is required for the corrected head.

Final acceptance at 62fa352

Exact head 62fa352d34e4baa11a95bb7bcf9ebcf773e71fb6: hosted verify, Android build/APK, Deterministic Electron E2E and Pullfrog all passed; all19 review threads resolved. Final cursor correction passed generic iOS app/XCTest compilation, applicable Android JVM/lint/instrumentation checks and iOS policy31Node+20Ruby42 assertions, with both independent GPT-5.6 Sol medium reviews clear. Combined integration a1f520680 also accepted this correction; subsequent combined cee0462a0 includes PR234 and passed fresh iOS compilation/157 host checks and both reviews, retaining unchanged213 Android evidence.

This is scoped PR217 acceptance. Physical XCTest/device acceptance remains unexecuted because the shared iPhone is locked and requires a coordinated slot. Separate iOS rename and Home response ownership remain assigned; no merge or release was performed.

@greptile-apps greptile-apps 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.

sambitcreate has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Important

This PR still has reachable ownership and stale-publication races in native recovery; please address them before merging.

Reviewed changes

This review covers the Android and iOS stream-recovery, optimistic-send fencing, terminal reconciliation, and focused regression coverage changes.

  • Cold replay and cursor ownership. Both clients rebuild process-local response buffers from sequence zero after a cold restore and keep warm cursors in memory instead of persisting every event.
  • Send and reload fencing. Generation checks protect optimistic messages during POST, while title-refresh cleanup is cancelled and restarted around sends.
  • Terminal settlement. Native consumers stop at terminal frames, retry authoritative transcript reconciliation, clear recovery warnings, and keep Send disabled while stream ownership remains active.
  • Regression coverage and project records. Android/iOS focused tests plus the mobile memory, papercut, and plan records were updated for the new behavior.

⚠️ Missing concurrency coverage

The new regression tests cover the happy path and the early return while a send is active, but they do not force a status probe, cache write, or reload to suspend across a new send or terminal settlement. Without those barriers, the ownership and stale-snapshot races called out inline can pass the focused suites.

Technical details
# Recovery interleavings are not exercised

## Affected sites
- `ios/AidenOnTheGoTests/AidenChatTests.swift:343-364` — `load()` is called after `send()` has already set `isStarting`, so it does not exercise an in-flight reload.
- `ios/AidenOnTheGo/Features/Remote/AidenChatFeature.swift:2068-2118` — the status-probe ownership handoff is not delayed across a new send.
- `android/app/src/test/java/sbtbiswas/AidenOnTheGo/AidenChatTest.kt:46-129` — the replay test does not overlap the initial `loadChat()` response with terminal settlement.

## Required outcome
- Add deterministic barriers for the iOS status-probe/send race, the iOS cache-write/send publication race, and the Android/iOS stale-load-after-terminal race; assert that the old stream remains owned or is safely reconciled and that the final transcript cannot be replaced by an older snapshot.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using GPT Luna | 𝕏

@greptile-apps greptile-apps 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.

sambitcreate has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.

@greptile-apps greptile-apps 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.

sambitcreate has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Important

The follow-up still leaves a possible stale iOS cache snapshot after terminal reconciliation.

Reviewed changes The incremental review covers the held-I/O regressions and the new native transcript-generation and recovery-ownership fences added since the prior Pullfrog review.

  • Added held-I/O coverage. Android and iOS now exercise status admission, cache publication, and stale transcript loads across sends and terminal settlement.
  • Fenced transcript ownership. Both clients advance transcript generations around terminal reconciliation and gate recovery and load publication; iOS also gates Send while stream restoration is in progress.
  • Hardened terminal cleanup. Native stream consumers stop at terminal frames, retain ownership while reconciliation retries, and clear ephemeral buffers on settlement.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using GPT Luna | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Important

The new cache-write fence can be bypassed by callers that ignore a rejected write, allowing deleted stream state and stale chat state to reappear.

Reviewed changes The incremental review covers the iOS accepted-transcript write fence added since the prior Pullfrog review.

  • Added accepted-write fencing. Reserved a cache-owned monotonic token before detailed iOS chat persistence and rejected older per-installation/chat writes across removal and purge.
  • Updated persistence callers. Applied tokenized writes to workspace chat mutations, accepted turns, reconciliation/title refresh, and Bot-shell hydration.
  • Extended cache regressions. Added reversed-write, removal/purge, recreation, and installation-isolation coverage.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using GPT Luna | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Important

The latest caller-level fencing still leaves two deletion-ownership gaps: an accepted turn can recreate active stream state after deletion, and a workspace parent can retain a deleted sidebar summary.

Reviewed changes The incremental review covers the iOS caller-level handling added after the accepted transcript write fence.

  • Propagated rejection outcomes. Gated accepted-turn companions, detail publication, workspace mutation callbacks, and Bot presentation on admitted chat snapshots.
  • Rebased superseded receipts. Merged an accepted server message into the winning cached chat before starting its stream consumer, without another network read or POST.
  • Added caller regressions. Covered deletion, newer-snapshot supersession, workspace list interleavings, and Bot presentation admission with held cache writes.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using GPT Luna | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Important

The latest iOS delta still permits a deleted turn to start an in-memory stream consumer and can resurrect deleted workspace rows from the list cache. Both are user-visible ownership regressions and should be fixed before merging.

Reviewed changes This incremental review covers the latest iOS cache-admission and workspace-removal follow-up since the prior Pullfrog review.

  • Added stream-companion fences. Accepted turns now carry deletion and purge authority into active-stream persistence and recheck retention before companion startup.
  • Propagated workspace removal. Rejected no-winner mutations now remove the child row and notify the parent summary/sidebar when the local presentation generation is still current.
  • Added caller regressions. Held stream-write, cache-fence, workspace supersession, and parent-removal scenarios are covered by the native XCTest additions.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using GPT Luna | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Important

The latest iOS deletion boundary still lets composer work outlive the removed chat, so removal can trigger late attachment I/O and stale composer persistence. This can leave deleted-chat draft or attachment state behind and publish completion/error state from a detail that is no longer admitted.

Reviewed changes This incremental review covers the iOS lifetime and offline-list changes added after the previous Pullfrog review.

  • Registered per-chat lifetimes. Removal and purge now synchronously invalidate weakly registered detail consumers, cancel stream-side work, and block cache admission while cleanup runs.
  • Rewrote deleted workspace rows. Matching workspace list envelopes are rewritten without removed identities, and delayed list saves remain tombstone-filtered through failed fresh-detail writes.
  • Added deletion interleaving regressions. Held POST, stream, consumer-admission, workspace-list, and failed-readmission cases now cover the new removal boundary.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using GPT Luna | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ℹ️ No critical issues — one portability suggestion is inline.

Reviewed changes This incremental review covers the capacity-regression assertion added after the prior Pullfrog review.

  • Relaxed capacity snapshot matching. Replaced the exact free-space equality check with bounds derived from the InsufficientDiskSpaceError report.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using GPT Luna | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes This incremental review covers the capacity-test correction added since the prior Pullfrog review.

  • Accepted large finite observations. Updated the typed-denial predicate to avoid assuming filesystem free-space values are safe integers, while retaining the admission shortfall and error-shape checks.
  • Added boundary coverage. Added regression cases for values above Number.MAX_SAFE_INTEGER and malformed non-finite or negative observations.

Pullfrog  | View workflow run | Using GPT Luna | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The latest head still has two deletion-boundary races that can leave stale offline metadata or server-side attachment references after removal. The later managed-worktree capacity-test commits and the focused inbox-harness test are otherwise covered; node --test scripts/bot-inbox-writer.test.mjs passes 5/5.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using GPT Luna | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Important

The latest iOS deletion follow-up still leaves two ownership gaps: completed temporary uploads can survive chat removal, and stale metadata can be admitted while removal cleanup is pending. Both can leave user-visible or server-side state after deletion.

Reviewed changes This incremental review covers the iOS deletion-boundary follow-up at 057dc757 since the prior Pullfrog review.

  • Added metadata deletion floors. Added an instance-scoped floor so delayed workspace-list and home-summary writes remain rejected when the deleted row or file is already absent.
  • Joined upload cleanup. Made lifetime deletion and purge await an in-flight upload worker, deferred credential-revocation handling until worker completion, and added held remote-cleanup regressions.
  • Extended native coverage. Added absent-metadata, upload-cleanup, purge, and revocation interleavings to the existing XCTest coverage.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using GPT Luna | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Important

The latest iOS deletion delta still leaves a stale-metadata race and can silently lose unrelated offline metadata updates during cleanup.

Reviewed changes This incremental review covers the changes since the prior Pullfrog review: completed attachment ownership and cleanup across retained chat lifetimes, broader pending-removal metadata admission fencing, and their native interleaving regressions.

  • Added independent attachment ownership. Completed upload references now survive the upload worker and are transferred only when a turn receipt succeeds, while removal, purge, unpairing, cancellation, and explicit discard share cleanup tasks.
  • Changed metadata admission. Workspace and home writes now reject while any removal is pending for the installation, in addition to the persistent deletion floor.
  • Extended native coverage. Added held cleanup, receipt-ordering, invalid-reference, pending-metadata, and installation-isolation scenarios.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using GPT Luna | 𝕏

sambitcreate and others added 3 commits September 26, 2026 01:49
* 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
* 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>
Integrate #218's native approval/Stop hardening with this branch's stream
recovery and removal fences: iOS stop(), respondToApproval() and
restorePendingApproval() keep main's acknowledgement, no-resurrection and
snapshot-generation safeguards and add the removal fence on entry and after
every await. Android Detail keeps canStop gating and blocks Send while a
prior stream reconciles. Test harness conflicts keep the stricter EPIPE and
finite capacity assertions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GAkZRgQzUoKWGpgupF3a4D
@pullfrog

pullfrog Bot commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

Run failed. View the logs →

Pullfrog  | Rerun failed job ➔ | View workflow run | via Pullfrog | Using GPT Luna | 𝕏

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. Main's tests pass the now-required chat write token, and
  the mismatched-receipt test delivers the newer approval through the
  snapshot read because #217 keeps reopen from re-probing a live stream.
- 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.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GAkZRgQzUoKWGpgupF3a4D

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Important

The iOS control-lifecycle coverage was run only on an iPhone simulator, which ios/AGENTS.md prohibits; there is no policy-compliant physical-device result for this delta. Run the focused XCTest cases on an explicitly selected physical device before merging.

Reviewed changes Reviewed the incremental merge and control integration from ccb64152 through d41ad06c.

  • Fenced iOS Stop, approval-response, and approval-snapshot continuations against chat removal while preserving acknowledged-control recovery.
  • Blocked Android Send while a recovered stream remains active, and corrected test JSON to omit null fields absent from Mac wire responses.
  • Added held-I/O regressions for iOS removal/cancellation and Android unpairing/dropped-Stop outcomes.

⚠️ iOS physical-device execution is missing

The recorded iOS run produced 174/183 on an iPhone 17 Pro simulator, but the repository explicitly prohibits simulator acceptance; the nine failures also occur on pre-merge ccb64152. This does not provide the required physical-device validation for the new iOS removal guards.

Technical details
# Physical iOS validation is still required

## Affected sites
- `ios/AidenOnTheGo/Features/Remote/AidenChatFeature.swift:2230-2299` — Stop and approval-response continuations suppress results after chat removal.
- `ios/AidenOnTheGo/Features/Remote/AidenChatFeature.swift:2645-2696` — approval-snapshot publication is also fenced after awaits.

## Required outcome
- Execute the focused `AidenChatTests` on an explicitly selected physical iPhone per `ios/AGENTS.md` and record the result. The simulator run does not satisfy this verification policy.

Pullfrog  | Fix it ➔ | View workflow run | Using GPT Luna | 𝕏

@very-hermes-bot

very-hermes-bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Collaborator

Hermes Review Bot

Confidence: 5

Engine: agy/gemini-3.8-flash-high
Review mode: full
Head: 1ad6af1fec519d424a170826be10940b7c30df6f
Generated: 2026-09-26T15:42:33+00:00
Reviews: 1

Summary

Hardens native stream recovery, cold replay, and optimistic send reconciliation across iOS and Android without modifying the underlying REST/SSE wire protocol or UI appearance. Cold stream restarts now reconstruct live partial buffers from sequence zero while process-local warm reconnects maintain cursors in memory, eliminating per-event disk serialization. Send actions are strictly fenced until active stream replay or reconciliation completes, and both clients serialize cache writes using monotonic reservation tokens to prevent held reads or stale HTTP loads from superseding newly admitted snapshots or deleted records. A maintainer should double-check that the updated AidenChatCache.ChatLifetime actor synchronization and attachment upload cleanup properly cover offline network timeouts during device unpairing.

Confidence Score: 5/5

The full cross-platform implementation (Swift and Kotlin ViewModels, models, cache actors, and shell views) and test-harness adjustments were inspected end-to-end against concurrency lifecycles and regression suites.

📁 Important Files Changed
  • ios/AidenOnTheGo/Persistence/AidenChatCache.swift: Introduces ChatLifetime tracking, monotonic cache write clocks, rename title overlays, and fence-protected metadata/summary admission across deletion and purge lifecycles.
  • ios/AidenOnTheGo/Features/Remote/AidenChatFeature.swift: Updates iOS AidenChatViewModel and AidenWorkspaceChatsModel to reconstruct cold streams from sequence zero, gate canSend behind active stream reconciliation, handle rebased turn receipts, and recheck lifetime deletion before mutations.
  • ios/AidenOnTheGo/Features/Remote/AidenProductShellView.swift: Adds AidenBotPresentationOwner to deduplicate and sequence concurrent openConversation and hydrateRestoredPath attempts, preventing duplicate loads from rolling back granted permissions.
  • ios/AidenOnTheGo/Features/Remote/AidenWorkspaceShellView.swift: Integrates AidenHomeModel with token-admitted summaries, replay of local mutations since load start, and cursor preservation.
  • android/app/src/main/java/sbtbiswas/AidenOnTheGo/persistence/AidenChatCache.kt: Implements monotonic reservation tokens, turn-receipt acceptance, and stream persistence safeguards to match iOS cache semantics.
  • android/app/src/main/java/sbtbiswas/AidenOnTheGo/features/chat/AidenChatViewModel.kt: Restructures stream consumption to stop at terminal frames, isolates recovery warnings from modal errors, and blocks sends until stream settlement.
  • android/app/src/main/java/sbtbiswas/AidenOnTheGo/features/workspaces/AidenWorkspaceHomeViewModel.kt: Adopts tokenized summary mutations and protects visible lists against stale page overwrites.
  • main/services/managed-worktree-lifecycle.test.ts & scripts/bot-inbox-writer.test.mjs: Test harness hardening for large statfs observations and robust child process EPIPE lifecycle handling.

Findings

No findings.

Sequence Diagram

sequenceDiagram
    autonumber
    participant UI as Detail View
    participant VM as ChatViewModel
    participant Cache as ChatCache
    participant Server as Remote Server / SSE

    UI->>VM: send()
    Note over VM: Reserve writeToken, display optimistic turn, fence Send
    VM->>Server: prompt(chatId, request)
    Server-->>VM: Prompt Response (streamId, message)
    VM->>Cache: acceptTurnReceipt(candidate, message, stream, writeToken)
    Cache-->>VM: AcceptedTurn (rebased snapshot, active stream)
    Note over VM: Reconstruct buffers from sequence 0 (cold start)
    VM->>Server: streamEvents(streamId, after: 0)
    loop Event Stream
        Server-->>VM: SSE event delta
        VM->>UI: Update liveText / reasoning / tools
    end
    Server-->>VM: Terminal frame (done / error / cancelled)
    Note over VM: Terminate SSE consumption immediately
    VM->>Server: chat(chatId) [reconcile authoritative transcript]
    Server-->>VM: Authoritative AidenChat
    VM->>Cache: saveChat(remoteChat, writeToken)
    VM->>Cache: removeActiveStream(streamId)
    VM->>UI: Update reconciled chat, re-enable Send
Loading
[]

Last reviewed commit: 1ad6af1fec51
Reviews (1) · Comment /hermes review to trigger a new review · /hermes review full for full re-review

@very-hermes-bot very-hermes-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Inline review — 2 finding(s) anchored to the diff. See the pinned summary comment for the overview.

Comment on lines +735 to +736
func removeChatSummary(instanceId: String, chatId: String, writeToken: UInt64? = nil, beforeWrite: (@Sendable () -> Void)? = nil) throws {
let removalToken = reserveSummaryWrite(instanceId: instanceId)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[P2 · logic] Summary deletion cleanup mints a new token and suppresses in-flight unrelated updates
Confidence: 0.92

removeChatSummary ignores the passed writeToken parameter and unconditionally calls reserveSummaryWrite, bumping summaryAuthority and causing concurrent in-flight summary requests for unrelated chats to be rejected by admitSummary.

Repair: Use writeToken when supplied, falling back to reserveSummaryWrite only when nil.

// does not depend on another network read or resend POST.
// Reserve before loading so removal/new writes still win.
let retryToken = cache.reserveChatWrite()
guard var current = await cache.loadChat(instanceId: instanceId, chatId: chat.id),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[P2 · logic] Receipt rebase and mutation recovery read disk instead of admitted in-memory winner
Confidence: 0.9

Calling loadChat on write rejection inspects only disk storage, returning nil if disk IO failed or is pending and causing the turn receipt rebase to abort and drop the turn.

Repair: Call cache.admittedChat instead of cache.loadChat to read the in-memory winner before checking disk.

Suggested change
guard var current = await cache.loadChat(instanceId: instanceId, chatId: chat.id),
guard var current = await cache.admittedChat(instanceId: instanceId, chatId: chat.id),

sambitcreate and others added 2 commits September 26, 2026 04:44
Executed on the iPhone 17 Pro simulator for the first time, the stacked
ownership changes exposed real interaction bugs with #217:

- load() kept Send blocked through draft restoration with nothing to
  recover; resolve the cached stream reservation first.
- A list admitted while create's detail write was held dropped the
  accepted chat from the durable list; admit only that row.
- 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).

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

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Important

The new iOS test guidance contradicts the repository's verification policy and should be corrected before merging.

Reviewed changes This incremental review covers the iOS recovery, cache-admission, and regression-test corrections added since d41ad06.

  • Released idle recovery blocking. Checked the persisted stream identity before draft restoration so Send remains available when no stream needs recovery.
  • Preserved cache ownership. Kept successful Workspace creates through concurrent list omission, filtered pre-removal lists from later detail re-admission, and retained deletion authority for cleanup-era summary writes.
  • Corrected iOS regression expectations. Fixed whole-second date fixtures, disk-failure setup, and assertions for fresh detail ownership after removal.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using GPT Luna | 𝕏

Comment thread .papercuts/troubleshooting.md Resolved
…dance

The simulator runs for #217 were owner-directed for this session only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GAkZRgQzUoKWGpgupF3a4D

@very-hermes-bot very-hermes-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Inline review — 2 finding(s) anchored to the diff. See the pinned summary comment for the overview.

// does not depend on another network read or resend POST.
// Reserve before loading so removal/new writes still win.
let retryToken = cache.reserveChatWrite()
guard var current = await cache.loadChat(instanceId: instanceId, chatId: chat.id),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[P1 · logic] Rebase and persist fallbacks bypass admitted in-memory winner via loadChat
Confidence: 0.95

During collision recovery in send and workspace persistence, cache.loadChat reads from disk rather than memory, dropping turns or overwriting concurrent updates when disk IO fails or lags.

Repair: Call cache.admittedChat instead of cache.loadChat to rebase against the in-memory admitted winner.

Suggested change
guard var current = await cache.loadChat(instanceId: instanceId, chatId: chat.id),
guard var current = await cache.admittedChat(instanceId: instanceId, chatId: chat.id),

await cache.removeChat(instanceId: instanceId, chatId: chat.id)
await AidenChatDraftStore.shared.remove(instanceId: instanceId, chatId: chat.id)
try? await cache.saveChats(chats, instanceId: instanceId, workspaceId: workspaceId)
try? await cache.saveChats(chats, instanceId: instanceId, workspaceId: workspaceId, writeToken: metadataWriteToken)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[P2 · logic] AidenWorkspaceChatsModel.remove invokes saveChats with stale token invalidated by deletion fence
Confidence: 0.92

saveChats is called with metadataWriteToken reserved prior to removeChat, which is unconditionally rejected by metadataWriteIsRetained after removeChat advances the deletion clock.

Repair: Remove the redundant saveChats call, or reserve a fresh token after removeChat if list re-persistence is needed.

Resolve scripts/bot-inbox-writer.test.mjs by keeping #217's strict stdin
outcome check (EPIPE tolerated only when the helper rejected with exit 1)
with main's Linux EPIPE rationale; papercuts keeps both appended notes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GAkZRgQzUoKWGpgupF3a4D

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ℹ️ No critical issues — one Linux test-coverage suggestion inline.

Reviewed changes This incremental review covers the merge correction at adf25095 since the prior Pullfrog review.

  • Preserved strict stdin validation. Updated the writer harness to wait for child and stdin completion and accept EPIPE only when the helper exits with status 1 and no signal.
  • Recorded merge troubleshooting. Added notes from the main merge without changing application runtime behavior.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using GPT Luna | 𝕏

const result = await completion;
await inputCompletion;
// Invalid metadata is rejected before the helper reads stdin, so macOS and
// Linux can report that intentional early close as EPIPE while end() flushes.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This comment says Linux can also produce EPIPE from this early-close path, but the real-helper regression still returns early on every non-Darwin platform. Since test:linux-native runs this suite, the Linux lane never exercises that platform-specific path; please run the integration case on Linux too or narrow the claim if it is intentionally unsupported there.

@very-hermes-bot very-hermes-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Inline review — 1 finding(s) anchored to the diff. See the pinned summary comment for the overview.

let writeToken = cache.reserveChatWrite()
do {
guard try await cache.saveChat(chat, instanceId: instanceId, writeToken: writeToken) else {
guard let current = await cache.loadChat(instanceId: instanceId, chatId: chat.id),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[P1 · logic] Superseded chat persist and send rebase read disk directly instead of admitted cache
Confidence: 0.88

When saveChat is superseded by a newer write token whose disk write failed or is pending, calling loadChat returns nil or stale data from disk rather than the in-memory admitted winner, causing workspace chat removal at line 888 or aborted stream startup at line 1872.

Repair: Call cache.admittedChat(instanceId: instanceId, chatId: chat.id) instead of cache.loadChat(...).

Suggested change
guard let current = await cache.loadChat(instanceId: instanceId, chatId: chat.id),
guard let current = await cache.admittedChat(instanceId: instanceId, chatId: chat.id),

sambitcreate and others added 2 commits September 26, 2026 06:02
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
# Conflicts:
#	.papercuts/troubleshooting.md

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Important

The superseded-create fallback can publish an accepted chat that is missing from the persisted Workspace list after a detail-file write failure, so offline Workspace navigation can omit it after restart.

Reviewed changes This incremental review covers the superseded cache-write recovery correction and its failed-disk-write regressions since adf25095.

  • Adopted admitted chat winners. Changed workspace-create persistence and accepted-send rebasing to read the cache's admitted winner instead of potentially stale or missing disk state.
  • Added failed-write coverage. Added missing-file and stale-file schedules to validate create publication and stream startup against the in-memory winner.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using GPT Luna | 𝕏

do {
guard try await cache.saveChat(chat, instanceId: instanceId, writeToken: writeToken) else {
// The winner is admitted in memory even if its disk write failed.
guard let current = await cache.admittedChat(instanceId: instanceId, chatId: chat.id),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The new admittedChat fallback can return a winner here, but this early return skips the workspace-list write below. When the winner's detail-file write failed and the separate list cache is writable, the accepted create is shown only in the current model and is absent from the cached Workspace list after an offline cold reopen; please reconcile it into the list without overriding newer removal or authoritative-list ownership.

Technical details
# Keep superseded creates in the workspace-list cache

## Affected sites
- `ios/AidenOnTheGo/Features/Remote/AidenChatFeature.swift:887-900` — the rejected create write adopts `admittedChat` and returns before workspace-list persistence.
- `ios/AidenOnTheGo/Features/Remote/AidenChatFeature.swift:912-920` — the list write and created-row fallback are skipped by that return.
- `ios/AidenOnTheGo/Persistence/AidenChatCache.swift:441-456` — the existing created-row helper is called only after the normal detail-save path.
- `ios/AidenOnTheGo/Persistence/AidenChatCache.swift:348-359` — a cold workspace load reads the admitted/disk list; it does not synthesize the list from detail-cache rows.
- `ios/AidenOnTheGoTests/AidenChatTests.swift:968-1008` — the new failure regression checks live publication but does not reopen and assert the workspace list.

## Required outcome
- Preserve a successfully created row in the workspace-list cache when adopting a newer admitted detail winner and list admission still permits it, while respecting later authoritative omissions, removal, and purge.
- Add a held-write regression with a failed detail-file write and writable list cache; reopen the cache and verify the admitted creation remains available offline.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Fixed in 1ad6af1.

  • The superseded branch of persist() now calls the existing created-row helper, admitCreatedWorkspaceChat, after it adopts the admitted winner. The disk-failure catch branch had the same early return (when the create's own detail write fails), so it now calls the helper too.
  • The helper used to accept only a create that still owned the detail (generation == writeToken). It now also accepts a newer detail winner, but only while that winner is newer than the current workspace list token. A list admitted after the winner that omits the chat therefore still wins. Removal, purge, hidden and pending-removal checks are unchanged, and the list token is still not advanced.
  • Regression: testSupersededCreateKeepsAdmittedWinnerRowWhenItsDiskWriteFails now reopens a fresh cache on the same root and checks the durable list:
    • "missing": the winner's detail write fails with no file left; the row survives reopen.
    • "stale": the winner's detail write fails with an older file left; the row survives reopen.
    • "own": the create's own detail write fails; the row survives reopen.
    • "omitted": a newer empty list omits the chat; the row stays absent.

Verification so far: iOS build-for-testing passes. The simulator run of AidenChatTests is still pending, because the simulator currently won't start test runs; I'll report results once it has run.

sambitcreate added a commit that referenced this pull request Sep 26, 2026
…ssions (#242)

* fix(mobile): preserve stream recovery and optimistic send ownership

* fix(mobile): fence recovery handoffs and terminal publications

* docs: record held-I/O recovery regression evidence

* fix(ios): fence accepted transcript cache writes

* fix(ios): honor rejected transcript writes at callers

* fix(ios): fence stream companions and propagate removal

* fix(ios): couple chat deletion to consumer lifetime

* fix(ios): fence all chat cache writes across deletion

* test(bots): handle stdin closure after native rejection

* fix(ios): finish draft and attachment lifetime cleanup

* Assert capacity denial against its own filesystem observation

* test(worktrees): allow large finite capacity observations

* fix(ios): complete deletion metadata and upload cleanup fences

* fix(ios): retain completed uploads through deletion cleanup

* Fence cleanup-era cache writes while preserving unrelated metadata

* fix(ios): retain incoming cursor for absent partial summary cache

* WIP: native ownership integration (merge #217 onto 0.43.0 main)

* Fix native integration cache ordering and confirmed run controls

* Allow simulator verification and preserve deletion fences in list merges

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GAkZRgQzUoKWGpgupF3a4D

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Important

A failed create's fallback can overwrite a newer authoritative Workspace-list omission, so this recovery remains incomplete.

Reviewed changes This review covers the iOS durable-list correction added in 1ad6af1 since Pullfrog reviewed fd217a31.

  • Retained failed creates. Called created-row admission when a create detail save was superseded or failed.
  • Expanded failure schedules. Added cold-cache checks for missing, stale, own-write, and newer-omission outcomes.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using GPT Luna | 𝕏

!isChatHidden(instanceId: instanceId, chatId: chatId),
// The create owns the detail, or a newer detail winner superseded
// it and no list admitted after that winner omitted the chat.
owner == writeToken || (owner > writeToken && owner > (workspaceWriteTokens[instanceId]?[workspaceId] ?? 0)),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The owner == writeToken arm bypasses any newer workspace-list authority. If the create's own saveChat admits its detail and then throws on disk, the catch branch awaits this helper, so an authoritative empty list can commit during that suspension and have the row re-added to disk for offline reopen. Please also require the create owner to remain newer than list admission and add a held regression for this ordering.

Technical details
# A failed create can overwrite a newer list omission

## Affected sites
- `ios/AidenOnTheGo/Persistence/AidenChatCache.swift:449` — the original detail owner bypasses the workspace-list token check.
- `ios/AidenOnTheGo/Features/Remote/AidenChatFeature.swift:905-909` — the failed-create catch path calls the helper after `saveChat` throws.
- `ios/AidenOnTheGoTests/AidenChatTests.swift:968-1025` — `own` and `omitted` are tested separately, without holding helper admission across a newer omission.

## Required outcome
- A failed create must not resurrect its row after a newer authoritative workspace list omits it; verify the ordering by reopening the durable list.

sambitcreate added a commit that referenced this pull request Sep 26, 2026
* 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>
@sambitcreate

Copy link
Copy Markdown
Owner Author

Superseded: most of this branch landed through #242 (squash-integrated via 62fa352), and the remaining mobile stream-recovery commits landed through #255. Closing as superseded.

🤖 Generated with Claude Code

@sambitcreate
sambitcreate deleted the feature/mobile-stream-recovery branch September 26, 2026 17:53
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.

2 participants