Skip to content

fix(build): hold autoplay while a Cody primitive-suggestion nudge is unactioned (#1019) - #1030

Merged
developer-ainative merged 1 commit into
mainfrom
fix/1019-nudge-autoplay-timing
Oct 8, 2026
Merged

developer-ainative merged 1 commit into
mainfrom
fix/1019-nudge-autoplay-timing

Conversation

@developer-ainative

Copy link
Copy Markdown
Contributor

Summary

  • CodyNudge.tsx's accept/dismiss card was visible for max(HANDOFF_MS, generation latency) — not a fixed 550ms as originally suspected. Confirmed with real timestamped Playwright runs against a live local generation: a slow generation gave ~4.3s, but a fast/cached one would still collapse to the raw 550ms floor with zero guaranteed reaction time, since the card's lifetime was coupled to generation speed rather than to whether a human had acted on it.
  • Fixed by holding state.view in place (Option 1 from the issue) whenever the current view has an unactioned nudge and autoplay is about to move past it — a deterministic guarantee independent of generation speed, rather than tuning the constant.
  • The hold is scoped to never block track completion (MVP_DONE/COMPANY_DONE) on a trailing/last-view nudge, and correctly releases on either accept or dismiss.

Verified live (not just unit tests)

Real Playwright run against the real dev server and real /api/build/artifact generation (no mocks): a nudge card held visible and clickable past the previous ~550ms-4.5s window on both the accept path (held to t=6.01s, then correctly resumed autoplay) and the dismiss path (held past t=3.18s, resumed cleanly, no stall).

Known gap — flagged, not fixed here

A pre-existing race between CodyNudge.tsx's own manual GOTO_VIEW (500ms after accept) and autoplay's natural next-view search existed before this change, on preview's and landing's nudges specifically. Left untouched as out of scope — may be worth a follow-up issue, since this fix makes the hold window open-ended where it was previously bounded either way.

Test plan

  • npx vitest run __tests__/lib/build/useAutoplay.test.ts __tests__/lib/build/useAutoplay-hook.test.ts — 77/77 pass (5 new, TDD red confirmed first)
  • Full suite — same pre-existing failures as baseline, no new ones
  • npx tsc --noEmit — clean
  • Real browser verification (Playwright, live dev server, real generation) — both accept and dismiss paths confirmed with timestamps

Closes #1019

CodyNudge ("Cody suggests · {primitive}") was keyed off state.view in
CodyFeed, but useAutoplay advanced state.view HANDOFF_MS (550ms) after
an artifact finished generating, with no regard for whether its nudge
card had been read or acted on. Live-verified against a real autoplay
run (Playwright, /build deep-link + real generation): the actual
visible window is max(HANDOFF_MS, generation latency) and is never
floor-protected for reaction time — on a fast/cached generation it can
still collapse to the raw 550ms floor, exactly the reported symptom.

Hold autoplay's view-advance while the CURRENT view has an unactioned,
done nudge and autoplay is actually about to move past it. Accepting
or dismissing the nudge (nudgeState, now in the effect's dependency
array) releases the hold and autoplay resumes exactly where it left
off — confirmed live for both the accept and dismiss paths, no
permanent stall.
@developer-ainative
developer-ainative merged commit 8b8df9a into main Oct 8, 2026
1 check passed
@developer-ainative
developer-ainative deleted the fix/1019-nudge-autoplay-timing branch October 8, 2026 16:11
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.

CodyNudge primitive-suggestion card disappears before a founder can read it — autoplay advances views in 550ms

1 participant