Repository navigation
fix(apple): cut full chat-history downloads from 13 to 1 across refreshes - #171950
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: needs maintainer review before merge. What this changesThis PR reuses Gateway history cursors and shares overlapping Apple chat refreshes while preserving canonical transcript recovery. Example: An iOS conversation receives eleven appended messages and then checks unchanged history.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: current main still downloads full Apple chat history on refresh, and this PR provides a useful cursor-based repair. The previous anchored-order finding is resolved; no actionable findings remain. Exact-head CI is pending. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe shared Apple chat view model receives refresh and transport events, requests history through the iOS or macOS adapter, and publishes reconciled messages and canonical cache updates. flowchart LR
A[Refresh and transport events] --> B[Shared history refresh owner]
B --> C[Apple transport adapter]
C --> D[Gateway chat history]
D --> E[Delta or canonical response]
E --> F[Transcript reconciliation]
F --> G[Visible chat and existing cache]
Technical reviewBest possible solution: Use the shared refresh owner and existing Gateway cursor contract, retaining canonical reloads for resets and unsupported anchored placement. Do we have a high-confidence way to reproduce the issue? Current-main source confirms cursorless refreshes; the contributor's inspected native comparison demonstrates the resulting repeated full downloads without running target code during this review. Is this the best way to solve the issue? The patch uses the existing Gateway contract, carries decoded rows to publication, and consolidates refresh ownership; its additional lifecycle state protects demonstrated ordering, route replacement, and local-message retention cases. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against ee855ce57341. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +395, Tests +995. Total +1390 across 13 files. Added test files: 0. View PR surface stats
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 HistoryReview history (3 earlier review cycles)
Reviewed October 24, 2026, 4:39 AM ET / 08:39 UTC (Revision 4). |
2de7c65 to
8fb912c
Compare
8fb912c to
c752c09
Compare
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review The completed review on the current head rates overall readiness, proof, and patch quality at platinum (4/6), with sufficient proof and no findings, but the PR still carries the older |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Refresh request ordering for a still-current caller before its wire read, even when the intervening refresh left visible rows unchanged. Preserve session, route, invalidation and publication guards. Add the deterministic subscription-overlap regression. The unchanged probe fails on the original PR and passes on the control and repair; all 57 focused history and unread tests pass.
|
Merged via squash.
|
…shes (openclaw#171950) Reuse the existing Gateway history cursor contract for Apple chat refreshes and share overlapping reads through one publication owner. Retain canonical reloads for reset and unsupported anchored activity placement, preserving nested completion order. Re-admit still-current bootstrap requests at the shared history owner after a foreground refresh supersedes their captured request order, so successful activation completes unread acknowledgement and remaining setup. Validation: inspected contributor production-adapter live Gateway evidence records 633,120 versus 131,529 response-frame bytes for the supplied append-only workload (79.23% less; not a universal tool-heavy or latency claim). The repair commit reports the unchanged bootstrap probe failing on the original PR and passing on the control and repair, with all 57 focused tests passing. Native Swift tests were not independently executed by the landing agent. Exact-head hosted checks passed, including the recovered Periphery pipeline. Co-authored-by: Marvinthebored <[email protected]> Co-authored-by: Solvely-Colin <[email protected]> Co-authored-by: Marvinthebored <[email protected]> Co-authored-by: Colin <[email protected]>
Related: #100197
What Problem This Solves
Fixes repeated full-history downloads when Apple chats refresh after small updates or check unchanged history.
User Impact
Users download new chat rows instead of repeatedly downloading messages already on screen.
Why This Change Was Made
Reuse accepted Gateway history cursors and share overlapping refreshes through one read-and-publication owner. Session, route, and transcript replacements invalidate the cursor and reload canonical history. Incremental rows are decoded once and reused when publishing the transcript. Deltas carrying anchored activity placement use the existing canonical reload so nested completions retain the same order as a full read. This narrow fallback avoids duplicating the Gateway display composer and leaves ordinary append-only and empty deltas on the fast path.
Evidence
The app-hosted Swift Testing case
realGatewayHistory()passed against a live isolated Gateway using the production iOS adapter and shared chat view model. A transparent wire relay observed the successful app connection and actual delta RPCs.Response bytes fell 79.23%; both runs retain all nineteen messages. The 31 captured exchanges also verify active-run recovery, an empty sequence-gap delta, final completion, and stale-cursor reset followed by canonical reload.
Native proof and iOS adapter suite: 35 tests in 2 suites passed. Focused shared-kit validation after the anchored-placement fix: 673 tests in 22 suites passed. Removing prepared-message reuse makes the identity regression fail; restoring it passes 1 test in 1 suite.
Native harness, redacted wire trace, source hashes, measurements, and terminal results.
The anchored-completion regression captures the cursor after
exec, wait, then receives a later completion anchored afterexec. It fails on the prior head and passes with canonical fallback, yieldingexec, completion, wait; a subsequent empty delta preserves that order. The existing real-Gateway measurements above cover the unchanged ordinary-delta path.AI-assisted.