Repository navigation
fix(build): hold autoplay while a Cody primitive-suggestion nudge is unactioned (#1019) - #1030
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CodyNudge.tsx's accept/dismiss card was visible formax(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.state.viewin 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.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/artifactgeneration (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 manualGOTO_VIEW(500ms after accept) and autoplay's natural next-view search existed before this change, onpreview's andlanding'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)npx tsc --noEmit— cleanCloses #1019