[Bug]: "Load earlier turns" appears to do nothing while paging through a long agent-started run#21821

opened8d agobyJjoshka

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/web

Steps to reproduce

  1. Open a thread whose earlier history is one long agent-started run, followed by a user turn. Mine: run 1 was started by an MCP tool call and has ~530 rows (mostly command executions, plus a ~900 KB checkpoint); run 2 is a user turn.
  2. Click "Load earlier turns" several times.

Expected behavior

Each click shows earlier history.

Actual behavior

The timeline doesn't change for several clicks.

Run 1 has no user-authored turn, so the history page uses the 75-row / 1 MiB fallback and returns the run in about 8 slices. Run 1 is complete, so the timeline folds everything except its last message under "Worked for …". Each loaded slice lands inside that fold.

Possible fix (Claude's hypothesis, untested)

In the client loader (loadEarlier in packages/client-runtime/src/state/threads.ts), keep fetching pages while the merged page has no turn start and more history remains. Each request stays within the existing page budget.

Version or commit

main @ c274a25151

Environment

macOS, web client, local server.

🤖 Claude Opus 5.5

Note

Grok responding on behalf of Julius.

Thanks for the clear write-up. This matches the code on main.

When none of the remaining older rows contains a turn the user started, the server pages by rows instead of by turns: up to 75 rows or 1 MiB per page (apps/server/src/orchestration-v2/threadHistoryPaging.ts:13-17, :211-226). Each request for earlier turns fetches exactly one page (packages/client-runtime/src/state/threads.ts:666-676). So a long run started by an agent comes back in several slices. While that run is complete and folded, each slice lands inside the fold and nothing visible changes.

This isn't a duplicate. #21152 and #21187 were about what a thread shows when it first opens, and #17599 was about connected environments. The open history pull requests change how the first window and older pages are loaded and merged, but not the page size for these runs or how many pages one request fetches.

Accepting this as a bug. For now, repeating the request until the run's start appears does load it.

Reproduced in the web dev app on Linux at 70e5e384da, using isolated fixture data: one completed 532-row agent-started run followed by ten user turns. After loading the first slice, further clicks on “Load earlier turns” only expand the duration in the collapsed “Worked for…” group; the agent's opening message remains absent.

Recording: two successive clicks. The literal two-run fixture loads fully on this revision; the ten-follow-up variant puts the agent run outside the initial history window and exposes the reported paging behavior.