Skip to content

fix(app): load the whole transcript when opening a session - #4695

Merged
yomgui merged 2 commits into
devfrom
fix/session-transcript-full-history
Sep 9, 2026
Merged

yomgui merged 2 commits into
devfrom
fix/session-transcript-full-history

Conversation

@yomgui

@yomgui yomgui commented Sep 9, 2026

Copy link
Copy Markdown
Member

Problem

Opening a long session (e.g. Today: Vercel, Cal.com & Render MCP — support action plans) shows the conversation starting mid-way — the first visible turn was an assistant message, and the user's opening prompt and ~117 earlier messages were nowhere to be found.

Root cause

session-surface.tsx fetched the transcript snapshot with limit: 140. OpenCode's GET /session/:id/message?limit=n returns the newest n messages and only signals older pages through x-next-cursor / Link: rel="next" headers. Nothing in the app ever read those headers or sent before, and there is no "load older" affordance, so every conversation longer than 140 messages opened at message total − 139 with no way back.

Verified against the live engine for the reported session: 258 messages stored; limit=140 returned exactly 140, whose first item is the assistant turn the user saw ("Quality-review edits applied…"); the real first message is the Sep 8 investigation prompt. Locally 40 of 353 sessions exceed 140 messages, so ~11% of sessions were affected.

Introduced with the incremental React session path (#1362) and carried through the SDK refactor (#4193); OpenCode has honoured limit server-side since its cursor-pagination work, which is when the cap started dropping history.

Fix

Drop the limit on the transcript read: without one, OpenCode returns every message. The queue drainer's status-only probes keep their small page (they never render messages). The transcript cache already grows unbounded for live-watched sessions and its merges are union-preserving, so this changes only what a cold open fetches. Payload impact on the largest local session (512 messages): 15 MB served in ~0.2 s vs 1.4 MB for the 140 tail.

Follow-up (not in this PR): cursor-based "load older" + virtualization for very large sessions.

Proof

New journey evals/specs/session-full-history-on-open.e2e.test.ts (world longHistory in evals/worlds/chat.ts): stores 150 messages via the engine (noReply), cold-starts on another session, clicks the long one in the sidebar, and asserts the rendered transcript has all 150 messages (not 140) with the first message visible at the top. It also witnesses the trap: the engine's own limit=140 page lacks the first message.

  • Daytona, fix commit 197c8bfb6: 1 passed, 0 skipped (pnpm evals:e2e session-full-history-on-open --daytona, OPENWORK_EVAL_REF=fix/session-transcript-full-history).
  • Daytona, negative control on unfixed dev (df3b1670b): fails at Timed out waiting for rendered transcript length…; last value: 140.
  • pnpm typecheck clean; bun test tests/opencode-session-native.test.ts 21 pass; channel/boundary ratchets report nothing for the new spec.

Evidence comment follows via evals:e2e --publish.

The session snapshot asked OpenCode for messages with limit 140. OpenCode
pages a limit as the NEWEST n messages and only signals older pages through
a Link header the app never followed, so any conversation longer than 140
messages opened mid-way with no route back to its start.

Drop the limit on the transcript read (no limit returns every message).
The queue drainer's status-only probes keep their small page.
@vercel

vercel Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

4 Skipped Deployments
Project Deployment Actions Updated
openwork-app Ignored Ignored Preview Sep 9, 2026 8:26pm UTC
openwork-den Ignored Ignored Preview Sep 9, 2026 8:26pm UTC
openwork-diagnostics Ignored Ignored Preview Sep 9, 2026 8:26pm UTC
openwork-landing Ignored Ignored Preview Sep 9, 2026 8:26pm UTC

@github-actions

github-actions Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Warden review summary — Clear

Native findings: 0. Blocking policy matches before consolidation: 0. Full finding text remains in Warden's native checks and review threads. This comment retains only native IDs, severity, skill attribution, and safe locations. Analysis run

Reported trigger coverage (not proof of complete repository or context coverage): diff-security-review (20518 ms), confidentiality-review (23731 ms), spec-provenance-review (33550 ms), desktop-den-sync-review (59 ms).

Blockers

  • None.

Advisories

  • None.

Needs recheck

  • None.

Observed review-thread metrics

  • Unique observed run attempts in retained window: 2
  • Distinct heads in retained window: 2
  • Current unresolved Warden threads: 0 of 0 observed
  • Observed resolved/unresolved transitions in retained snapshots: 0 / 0
  • First observed resolved/unresolved (state at first collection, not event time): 0 / 0
  • Precision: unavailable (no adjudications; no TP/FP values are inferred)
  • Observation window: 2/20 run attempts retained; truncated: false
  • Transition snapshot: 0/0 current attributed threads retained (limit 500); truncated: false

Thread states are read-only collection snapshots. These metrics are neither lifetime totals nor exact resolution times, and this summary is not clearance authority.

diff-warden[bot]
diff-warden Bot previously approved these changes Sep 9, 2026

@diff-warden diff-warden Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warden security clearance: clear. No blocking findings (security or desktop↔den sync) in this diff (197c8bfb600cdf0296d82e57f0ce84e5fbc632ea). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run

The unsigned eval desktop legitimately shows a Cloud Sign in control, so the
visual claim must name transcript states only.

@diff-warden diff-warden Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warden security clearance: clear. No blocking findings (security or desktop↔den sync) in this diff (bb2ac12b05e4cb2459b9baea01b7f98de89f87f2). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run

@yomgui

yomgui commented Sep 9, 2026

Copy link
Copy Markdown
Member Author

Test evidence — opening a long conversation shows it from its first message — ✅ passed

SHA bb2ac12 · engine v1

✅ 1/1 screenshots passed · 2 expectations passed · 0 failed · 0 pending

[world] desktop(daytona) · workspace(/tmp/openwork-session-full-history-1788985681085) · session("Long conversation") · [seed:raw] evalIn() · session("Unrelated short task")
[probe] desktopApi(GET /workspace/ws_f30e26d1914a/opencode/session/ses_f7824d967ffeFLq4eET1qPjGiS/message) · desktopApi(GET /workspace/ws_f30e26d1914a/opencode/session/ses_f7824d967ffeFLq4eET1qPjGiS/message?limit=140)
[user] reload · see(label=/^Long conversation/, timeoutMs=60000) · notSee(text=LONG-HISTORY-LAST-MESSAGE 7c31) · notSee(text=LONG-HISTORY-FIRST-MESSAGE 7c31) · label=/^Long conversation/ · click(label=/^Long conversation/) · see(text=LONG-HISTORY-LAST-MESSAGE 7c31, timeoutMs=60000)
[agent] run(session.read_transcript)
[probe] eventually(rendered transcript length)
[agent] run(session.scroll_top)
[user] see(text=LONG-HISTORY-FIRST-MESSAGE 7c31, timeoutMs=30000)
[vision] looks(2 expectations)
steps 1 ✅ the engine stores more messages than one newest-first page holds (0.1s) · 2 ✅ a cold start lands on the other session with no transcript cached for the long one (7.3s) · 3 ✅ clicking the long conversation renders every stored message (1.2s) · 4 ✅ the first message is reachable at the top of the transcript (9.5s)
verdict passed · 6 user observations (see ×3, notSee ×2, looks ×1) · 3 probes · steps 4/4

✅ PASS — 1. The conversation transcript visibly starts with a user message reading "LONG-HISTORY-FIRST-MESSAGE 7c31"

  • ✅ PASS The conversation transcript visibly starts with a user message reading "LONG-HISTORY-FIRST-MESSAGE 7c31" — The topmost visible transcript bubble reads “LONG-HISTORY-FIRST-MESSAGE 7c31”.
  • ✅ PASS The transcript shows no loading indicator, error card, or empty-conversation placeholder — The transcript displays message bubbles and no visible loading indicator, error card, or empty-conversation placeholder.

The conversation transcript visibly starts with a user message reading "LONG-HISTORY-FIRST-MESSAGE 7c31"


Test run created 2026-09-09T20:26:15.373Z · Source: evals/results/test-runs/2026-09-09T20-26-15-372Z-opening-a-long-conversation-shows-it-from-its-first-message/test-run.json · Repro: pnpm --dir evals artifacts:publish -- --pr 4695 --test-run 2026-09-09T20-26-15-372Z-opening-a-long-conversation-shows-it-from-its-first-message

@yomgui
yomgui merged commit de965e2 into dev Sep 9, 2026
27 checks passed
@yomgui
yomgui deleted the fix/session-transcript-full-history branch September 9, 2026 20:49
yomgui added a commit that referenced this pull request Sep 11, 2026
…tended transcript load (#4792)

* fix(app): close the restart prompt and command palette synchronously on dismiss

Base UI keeps a dialog popup mounted (and partially opaque) until its exit
animation or transition finishes, so the restart prompt and the command
palette stayed visible for 100-200 ms after Keep working / Escape. Hide the
popup with display:none as soon as it is closed; Base UI then unmounts it on
the next frame.

* fix(session): keep a focus reveal as the reading position instead of snapping back to the tail

* fix(app): keep the reading position and its saved anchor stable when Find opens or closes

The find bar's clearance toggled padding-top on the scroll container. A padding
change on the scroller is a scroll-anchoring suppression trigger, so the
transcript shifted 48px under the reader with no scroll event and the persisted
reading anchor stayed 48px stale. Render the clearance inside the content
column instead; the browser anchors it and the controller re-saves the anchor.

* test(evals): expect the whole transcript after a cold reload in the long-history journey

`de965e2b1` (#4695) deliberately fetches the session snapshot without a
`limit`, so a cold open renders every message instead of the newest 140.
The step written by #4614 still expected the bounded 97-row tail after
`user.reload()` and failed once #4780 let the lane reach it.

Re-express the claim as `toEqual(world.history)`, keep the reading-anchor
restore and the tool-link checks, and keep the engine's `?limit=140` page as
the negative witness: it still lacks the oldest turn that the reopened
surface must show.

---------

Signed-off-by: Guillaume Loret <[email protected]>
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