Skip to content

fix(mobile): unblock history first paint and avoid quadratic replay reads - #569

Merged
huichen merged 2 commits into
mainfrom
claude/mobile-latency
Sep 12, 2026
Merged

huichen merged 2 commits into
mainfrom
claude/mobile-latency

Conversation

@huichen

@huichen huichen commented Sep 12, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Render cold-open history before active-run replay finishes, without claiming a complete prefix or losing retry/cursor correctness.
  • Stop rereading the full remaining Agent event tail on every remote page. Keep the first snapshot for the existing fixed watermark, then use bounded Agent pages for cursor continuations.
  • Preserve native full-tail consumers, legacy offset clients, byte-budget pagination and termination at the pinned watermark.

Reproduction and verification

  • Actual retained 7,290-event task, local gRPC probe: baseline 269,370 event reads / 6,649 ms; fixed read strategy 14,480 reads / 496 ms. This isolates the local read path, not physical-phone end-to-end latency.
  • Actual Mobile SyncEngine with simulated 350 ms/page and 4,800 events: first history commit moves from 16.8 seconds to immediate history availability; full replay still completes correctly.
  • Regression tests cover slow replay, replay failure/retry, 15-second hook timeout prevention, bounded Agent reads, continuation hasMore, and a task growing beyond the original watermark.

Checks

  • Mobile typecheck + ESLint passed; 49 Jest suites / 702 tests passed.
  • Desktop cargo fmt --check and clippy --all-targets -- -D warnings passed.
  • Desktop replay-focused tests and binary test passed.
  • Full Windows Desktop library tests: 1,110 pass / 26 fail. Verified against unmodified c5e87ee in the same worktree/environment: 1,108 pass / the identical 26 failures (path/readonly-file-time/platform fixtures and fake-server scheduling). No new failures; the two new Rust tests pass. Linux CI remains required.

See docs/mobile-latency-diagnosis.md for measured scope, exact limitations and baseline comparison. No running user services or credentials were changed. Both updated Mobile and Desktop builds are needed for the full improvement.

@huichen
huichen enabled auto-merge (squash) September 12, 2026 06:15
@huichen
huichen merged commit a5117d5 into main Sep 12, 2026
12 checks passed
@huichen
huichen deleted the claude/mobile-latency branch September 12, 2026 06:20
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.

1 participant