Skip to content

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

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

feat(desktop): preserve transcript continuity across bounded ranges#4560
Sun-GLiang wants to merge 13 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. Gap actions reuse the current loadBefore, loadAround, and loadLatest paths; scrolling remains owned by the existing scroll authority.

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

Fixes #4123

Verification

  • Exact active-overlay Desktop E2E: while the final Turn is streaming, jump to the oversized first Turn, verify the durable gap, page through it, return to the tail, and complete overlay → durable handoff without duplicate/missing Turns or scroll jump (partial-history-notice.spec.ts, 2/2 repeated runs 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.
  • Candidate spot run after the final navigation refactor: TaskDuration 815.973 ms, RecalcStyleDuration 5.286 ms, frame p95 18.4 ms, LoAF >50 ms 0.
  • npm run typecheck, npm run lint, npm run format:check, npm run check:renderer-architecture, npm run check:asf-headers, npm run check:third-party-notices, and git diff --check passed.
  • Full parallel npm test: 1,583 passed, 12 skipped, with two unrelated Runtime Host peer-mesh timing failures under concurrent load; the complete peer-mesh.test.js file then passed serially (20/20).

UI evidence

Active overlay beside a durable history gap:

Active overlay remains visible after jumping to the first Turn, with the unloaded durable range represented as a gap

Returned tail after overlay → durable settlement:

Settled tail preserves the historical Turn and the active Turn without duplication or failure state

Review focus

  • Schema v37 migration and bounded lazy position backfill
  • Fixed-watermark and revision semantics for position cursors
  • Desktop position-only retry and failure isolation
  • Gap classification around active overlay handoff

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
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