Skip to content

fix(ios): preserve chat activity timeline order - #7382

Open
me2seeks wants to merge 1 commit into
mainfrom
fix/ios-activity-timeline-order
Open

me2seeks wants to merge 1 commit into
mainfrom
fix/ios-activity-timeline-order

Conversation

@me2seeks

@me2seeks me2seeks commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes three ordering bugs in iOS ChatScreen's collapsible thought process (CollapsibleActivity) and live streaming preview:

  1. Preserve true interleaved order of thinking, tool calls, and intermediate assistant messages: Replaces the three separate type buckets (thinking, tools, bodies) with a single chronological activity timeline so thinking 1 → tool A → thinking 2 → tool B and work A → intermediate body → work B → final reply render in their actual event order while keeping quote/copy actions intact. Late tool results update their original call entry in place rather than moving to the end.
  2. Prevent folded work group inversions and summary miscounts: Expands loaded folded work details at their original timeline position instead of concatenating outer items ahead of older folded details, keeps history summaries bound to the authoritative Host projection (so Code Mode parent calls aren't double-counted and collapsed summaries update live when work.tools grows), and merges overlapping/replayed history chunks idempotently by source row and UTF-8 byte range.
  3. Preserve streaming interleaved order and UTF-8 byte-range merge semantics: Exports ordered interleaved activity entries from LivePreviewAccumulator (app/streaming.ts), tracks actual held UTF-8 byte ranges so replayed short prefixes never truncate text and full recovery slices restore missing prefixes after handoff, and prevents stale same-attempt cuts from cancelling pending handoffs. Also wires products/maka/ios-shell/tests/streaming.test.mjs into scripts/ci/run.mjs.

Verification

  • maka-ios-shell: 82 passed (12 lib, 66 behavior including chronological y-coordinate ordering, folded work + intermediate body ordering, cross-boundary tool dedup, narrow-screen wrapping, and 4 language tests).
  • streaming.test.mjs: 7 passed (interleaved ordering, replay prefix protection, post-handoff recovery, plus 1,365 UTF-8 slice combinations verified during review).
  • aarch64-apple-ios --locked check, TypeScript tsc --noEmit, CI tooling-tests, ASF license headers, migration lock, 12-locale i18n, Biome, cargo fmt --check, and git diff --check origin/main..HEAD all passed.

Known test gaps

  • Verified in headless NSH / Rust behavior suites; no physical iPhone manual visual pass was performed.

Screenshots

Captured on iPhone 18 Pro Simulator (iOS 27.2, integrated preview build):

Expanded thought process preserving chronological interleaved order of thinking and tool calls

@github-actions github-actions Bot added the effort/XL Under 2500 readable lines label Nov 27, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/XL Under 2500 readable lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant