Repository navigation
fix: preserve failed Apple chat messages across partial history pages - #205404
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: passed. What this changesThis PR prevents partial Apple chat history and its subsequent deltas from automatically restoring potentially delivered messages into the composer. Example: The failed outbox message “already delivered” has key landed:user, but its canonical echo is on an older history page.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this maintainer-authored draft open: it addresses a source-confirmed restoration bug still present on main, and inspection found no definite introduced defect. Reviewed head: Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe shared Apple chat view model consumes Gateway history snapshots and deltas, reconciles visible messages, and supplies evidence used by the existing SQLite outbox-to-draft operation. flowchart TD
A[Gateway history] --> B[Shared Apple history reconciler]
B --> C[Visible transcript]
B --> D[Restore evidence]
D --> E[Outbox restore owner]
E --> F[SQLite outbox and composer draft]
Technical reviewBest possible solution: Keep absence decisions in the existing reconciler, invalidate evidence for partial snapshots, and let deltas inherit their snapshot’s coverage. Do we have a high-confidence way to reproduce the issue? Source establishes the trigger: a nonempty newest page with older history advances restore evidence, allowing an eligible failed row whose echo remains unread to enter the draft; no target code was executed during this read-only review. Is this the best way to solve the issue? The patch is a small repair at the existing decision owner, reuses its evidence state, preserves manual Edit and canonical confirmation, and adds a distinct persistence regression without parallel machinery. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 645643d0fa45. Provenance checked
TestingProof path: none. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +7, Tests +52. Total +59 across 2 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 25, 2026, 10:26 AM ET / 15:26 UTC. |
|
Merged via squash.
|
* commit 'fd681ab8786e062045fa5ec6261b1b06f60832eb': (2115 commits) fix: keep doctor --fix pending checks from creating SQLite sidecars (#206485) fix(ci): update iOS screenshot reducer gate (#206497) fix: keep chat photo previews sharp within their byte limits (#206461) fix: let agents use short Workboard card IDs fix(tui): run provider sign-in in the local TUI (#200605) improve(config): reduce repeated directory checks for larger agent rosters (#206494) perf(test): reuse the Periphery producer workflow snapshot (#189681) fix(ci): keep locale assets within the installed package budget (#206492) fix: preserve failed Apple chat messages across partial history pages (#205404) improve: avoid merging unrelated settings for agent directory lookups (#206489) fix: show typing while a queued follow-up turn runs (#201920) fix: stop 2026-11-17 main Git checkouts from half-switching on a schema update (#206341) refactor(codex): centralize native completion delivery (#206447) fix(subagents): finish claimed stops after session rotation (#206405) fix: let owners fork a chat with exec after a subagent or exec completion (#206483) test(cli): gate agent --local cold-start processes and workers (#206466) perf(ci): skip baseline inventory when line-cap debt is empty (#189909) refactor(test): share core process-result fixtures (#174149) refactor(ci): reuse canonical budget flag parsing (#189480) fix: recover Codex chats after oversized requests (#206475) ...
* commit 'fd681ab8786e062045fa5ec6261b1b06f60832eb': (923 commits) fix: keep doctor --fix pending checks from creating SQLite sidecars (#206485) fix(ci): update iOS screenshot reducer gate (#206497) fix: keep chat photo previews sharp within their byte limits (#206461) fix: let agents use short Workboard card IDs fix(tui): run provider sign-in in the local TUI (#200605) improve(config): reduce repeated directory checks for larger agent rosters (#206494) perf(test): reuse the Periphery producer workflow snapshot (#189681) fix(ci): keep locale assets within the installed package budget (#206492) fix: preserve failed Apple chat messages across partial history pages (#205404) improve: avoid merging unrelated settings for agent directory lookups (#206489) fix: show typing while a queued follow-up turn runs (#201920) fix: stop 2026-11-17 main Git checkouts from half-switching on a schema update (#206341) refactor(codex): centralize native completion delivery (#206447) fix(subagents): finish claimed stops after session rotation (#206405) fix: let owners fork a chat with exec after a subagent or exec completion (#206483) test(cli): gate agent --local cold-start processes and workers (#206466) perf(ci): skip baseline inventory when line-cap debt is empty (#189909) refactor(test): share core process-result fixtures (#174149) refactor(ci): reuse canonical budget flag parsing (#189480) fix: recover Codex chats after oversized requests (#206475) ...
What Problem This Solves
When an Apple chat reopened or refreshed, a nonempty newest history page could move a failed message from the outbox into the composer. The matching user message could still be on an older page. Scrolling back then showed the delivered message, and reopening the chat also showed it as a saved draft.
User Impact
A paginated history response leaves the failed message available for manual editing. When a complete history read establishes that the message is absent, automatic restore puts it back in the composer once. A canonical match confirms delivery.
Why This Change Was Made
The history reconciler now tracks whether the live snapshot covered the start of the session before using a tail delta as evidence of absence. An empty unanchored refresh preserves valid evidence from a previous complete read.
Evidence
Both frozen Swift/SQLite replays reproduced the premature restore. Both passed with this change. Thirteen focused controls covered one-row and 200-row pages, the older canonical echo, presentation changes, tail deltas, exhausted history, and the draft after reopening the database. All 168 existing controls passed.
The new SwiftPM regression drives the view model through a newest-page refresh, an older-page read, a tail delta, and a real SQLite close and reopen. Both changed Swift files passed compiler parsing. On macOS, the new regression passed in 0.079 seconds. The OpenClawKit package passed all 2,706 tests across 246 suites. Hosted SwiftPM job.