Skip to content

Stabilize fresh-agent transcript scroll timing#493

Merged
danshapiro merged 5 commits into
mainfrom
fix/fresh-agent-scroll-flake
Jul 2, 2026
Merged

Stabilize fresh-agent transcript scroll timing#493
danshapiro merged 5 commits into
mainfrom
fix/fresh-agent-scroll-flake

Conversation

@danshapiro

Copy link
Copy Markdown
Owner

Summary

  • move FreshAgentTranscript's auto-scroll-to-bottom DOM write from a passive effect to a layout effect
  • add a deterministic regression test that flushes passive effects after an imperative page scroll
  • keep the FreshAgentView keyboard scroll contract unchanged

Root Cause

The flaky PageUp/PageDown failures observed scrollTop = 1000, matching the mocked scrollHeight. The only non-user-action writer that can set the transcript scroller to scrollHeight was the passive auto-scroll effect, which could run after the test/user had already performed an imperative page scroll.

Verification

  • Negative control: npm run test:vitest -- run test/unit/client/components/fresh-agent/__intentional_missing_file__.test.tsx exited 1 with No test files found
  • RED/GREEN: npm run test:vitest -- run test/unit/client/components/fresh-agent/FreshAgentTranscript.test.tsx -t "does not let a deferred initial auto-scroll clobber an imperative page scroll"
  • npm run test:vitest -- run test/unit/client/components/fresh-agent/FreshAgentView.test.tsx -t "transcript keyboard scroll"
  • 50-run focused FreshAgentView transcript keyboard scroll loop
  • npm run test:vitest -- run test/unit/client/components/fresh-agent/FreshAgentView.test.tsx test/unit/client/components/fresh-agent/FreshAgentTranscript.test.tsx
  • FRESHELL_TEST_SUMMARY='verify fresh-agent scroll flake stabilization' npm run check
  • git diff --check HEAD

@danshapiro danshapiro merged commit 4d88980 into main Jul 2, 2026
1 check passed
@danshapiro danshapiro deleted the fix/fresh-agent-scroll-flake branch July 2, 2026 07:18
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.

2 participants