Skip to content

feat(desktop): preserve transcript continuity across bounded ranges - #4560

Draft
Sun-GLiang wants to merge 18 commits into
apache:mainfrom
Sun-GLiang:codex/issue-4123-bounded-continuity
Draft

feat(desktop): preserve transcript continuity across bounded ranges#4560
Sun-GLiang wants to merge 18 commits into
apache:mainfrom
Sun-GLiang:codex/issue-4123-bounded-continuity

Conversation

@Sun-GLiang

@Sun-GLiang Sun-GLiang commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Preserve transcript continuity while durable bodies remain bounded to the existing 512 KiB and 10-Turn range.

This adds a lightweight per-Turn position index, pages it through the existing Runtime Host transcript subscription, carries a bounded position sidecar through DesktopTranscriptReplica, and projects unloaded ranges as gap rows after the existing Turn materialization. Historical paging is serialized per transcript and resolves only after the requested range is delivered to the renderer, so repeated visible anchors can advance page by page without duplicate requests or stale acknowledgements.

Scrolling now prefetches symmetrically near both resident edges and retains a semantic visible-Turn anchor across bounded range replacement. The dock arrow loads the real latest range before pinning to the tail. The in-flow “正在查看较早的消息 / 返回最新消息” notice has been removed; the existing dock arrow is the single return affordance.

No full-history snapshots, generations, leases, second body protocol, byte scanner, or second transcript replica are introduced.

Fixes #4123

Verification

  • Bidirectional bounded-history Desktop E2E: real mouse-wheel input traverses every Turn from latest → oldest and oldest → latest, requires overlap across every bounded page, rejects reaching the physical bottom while newer history remains, and verifies the exact oldest/latest edges (transcript-bidirectional-scroll.spec.ts; 20/20 repeated runs passed after the final fix).
  • Scroll and partial-history Desktop regression suite: 12/12 passed, including semantic anchor retention, real-tail dock navigation, nested scrollers, streaming growth, and session restoration.
  • Focused UI/Desktop tests for projection, scroll authority, anchoring, range delivery, paging coordination, observation, and WorkHub projection: 124/124 passed.
  • 640-Turn two-sweep stress: mounted Turns max 10, position sidecar max 128, gap rows max 2; projected heap growth 4.39% and 6.41% (both below the 10% limit).
  • Native seven-pair A/B sweep against PR base 6c8e749d3: median TaskDuration 883.385 ms → 880.742 ms (-0.30%); median RecalcStyleDuration 6.733 ms → 6.707 ms (-0.39%); candidate Long Animation Frames over 50 ms: 0/7; mounted Turns remained 10.
  • npm run format:check, npm run lint, npm run typecheck, renderer architecture check against upstream/main, npm run build, and git diff --check passed on the final tree.

Review focus

  • Per-transcript history-load serialization and latest-range escalation
  • Explicit renderer-delivery acknowledgement and cancellation across reload/session changes
  • Semantic Turn anchoring across bounded prepend/evict commits
  • Dock-arrow ownership of return-to-latest behavior and removal of the in-flow notice

AI use

Select exactly one:

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope: Codex implemented the storage, Runtime Host, Desktop, renderer, test, and review-fix changes. Each affected commit includes a Generated-by: Codex trailer.

Checklist

  • Tests cover the change and fail without it
  • Lint, format, typecheck and the affected suites pass locally

Does this PR entail a change in behavior?

  • Yes — described under Summary above
  • No

@github-actions github-actions Bot added the effort/XL Over 1000 readable lines label Sep 2, 2026
Resolve the Runtime Host protocol conflict by assigning bounded transcript position paging compatibility epoch 97 after main's epochs 95 and 96.

Generated-by: Codex
@Sun-GLiang
Sun-GLiang marked this pull request as ready for review September 2, 2026 16:40
@Sun-GLiang
Sun-GLiang marked this pull request as draft September 2, 2026 16:44
Keep state-only backfill metadata from materializing empty historical Turns, consume search restoration once, and clear reading anchors before paging or returning to the live tail. Cover the exact active-overlay handoff and make native transcript performance evidence reproducible.

Generated-by: Codex
The model label updates before the Host-backed composer gate settles. Wait for the actual Send control before pressing Enter so the Session-switch anchor E2E does not race model persistence.

Generated-by: Codex
The model picker label reflects its optimistic overlay before the Host-backed Session catalog commits. Wait for the authoritative Session summary so the composer cannot remount between filling and sending the transcript-scroll fixture prompt.

Generated-by: Codex
The transcript-scroll suite does not exercise keyboard submission, and the editor intentionally consumes Enter while transient popups close. Click the real submit control so Playwright waits for the remounted composer and the test remains focused on Session scroll behavior.

Generated-by: Codex
@Sun-GLiang
Sun-GLiang marked this pull request as ready for review September 2, 2026 19:17
…unded-continuity

# Conflicts:
#	apps/desktop/e2e/transcript-scroll.spec.ts
#	apps/desktop/src/main/e2e-fixture.ts
#	apps/desktop/src/renderer/app-shell.tsx
#	packages/runtime-host/src/protocol/index.ts
#	packages/ui/src/chat-view.tsx
@Sun-GLiang
Sun-GLiang marked this pull request as draft September 3, 2026 06:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/XL Over 1000 readable lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(desktop): preserve transcript continuity across bounded ranges

1 participant