Skip to content

Fix timeline stabilization after turn completion - #1568

Open
ymichael wants to merge 1 commit into
mainfrom
bb/investigate-thread-completion-issue-thr_yi3cwyni4w
Open

Fix timeline stabilization after turn completion#1568
ymichael wants to merge 1 commit into
mainfrom
bb/investigate-thread-completion-issue-thr_yi3cwyni4w

Conversation

@ymichael

Copy link
Copy Markdown
Collaborator

Summary

  • supersede in-flight timeline reads and cancel paced trailing refetches when turn/completed arrives, preventing a stale active-turn projection from landing after the canonical completed projection
  • snap the authoritative active-to-completed timeline height replacement while preserving normal streaming height transitions
  • add regression coverage for the terminal invalidation race and height handoff

Problem

Long streaming responses can cross the timeline event budget while active, then change from a budget-cut in-turn projection to a canonical completed-turn projection. The normal streaming invalidation path deliberately avoids cancelling active reads and schedules a paced trailing refetch. At the terminal boundary, that allowed an older active response to briefly overwrite the completed shape before the trailing refetch corrected it. Animating the whole timeline height made the replacement look like the response was streaming in reverse.

This change keeps the non-cancelling behavior for ordinary stream events. Only the authoritative turn/completed boundary cancels obsolete work and immediately requests the terminal shape.

Testing

  • pnpm exec turbo run test --filter=@bb/app --force -- --run src/hooks/realtime-cache-effects.test.ts src/components/ui/height-transition.test.tsx — 46 tests passed
  • pnpm exec turbo run typecheck --filter=@bb/app
  • full @bb/app test suite — 340 files and 2,704 tests passed before the final rebase; the affected tests were rerun afterward
  • Prettier and git diff --check

AGENT GENERATED: by GPT-5.6

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