perf(cmux-next): avoid duplicate older-history loads

Merged
TE
20d ago
+20-4

Summary

  • avoid issuing duplicate older-history requests on every VirtualTranscript commit while the reader remains near the top
  • key each request to the session and first loaded row, reset when leaving the threshold or when history loading is disabled, and retry transient failures

Why

Streaming, resize, and scroll-follow commits can happen many times while the transcript is near the top. The existing no-dependency effect called onLoadOlder() for each one; the direct client deduplicated in-flight requests, but completed pages could still trigger another request before the next page was needed. The keyed guard preserves page-in behavior while removing that repeated work.

Validation

  • bun run typecheck
  • bun run lint
  • bun test src/agent-session/acpmux (48 passed)
  • React Doctor was attempted locally with the repository's --fail-on none command but exceeded the bounded 120s local window; fleet CI remains the source of the full React Doctor report.

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Prevents the transcript from issuing duplicate older-history requests when the reader stays near the top during streaming, resizing, or scroll-follow commits.

  • Older-history loads are now keyed to the session and first loaded row, so only one request fires per page while the view remains in the threshold.
  • The guard resets when the reader leaves the threshold, when history loading is disabled, or after a transient failure, so failures stay retryable without turning every render into a request.