Repository navigation
Description
Context
Found while fixing #3417. The ghost handoff ends on a wall-clock timer, setTimeout(() => setArriving(false), HANDOFF_MS) (useArrival, packages/ui-kit/src/internal/GhostText.tsx:181-194; the timer at :190, HANDOFF_MS = 600 at :38). The outgoing fade runs on the animation clock: .bk-ghost-out { animation: ghost-out 600ms ease both; } (packages/ui-kit/src/tokens.css:1399-1401, with the GhostBand combination at :1403). The timer starts at the arrival commit. The fade starts on the first frame the browser renders after the commit.
The outgoing class is applied at four call sites, all driven by useArrival:
packages/ui-kit/src/internal/GhostText.tsx:222(Ghosted)packages/ui-kit/src/states/Placeholder.tsx:215packages/ui-kit/src/internal/GhostBand.tsx:60packages/ui-kit/src/conversation/StreamingAnswer.tsx:139
When that first frame is late (a loaded runner, a long task right after the commit), the timer still removes the ghost 600 ms after the commit, part-way through its fade. In the pinned Chromium image, at one CPU shared with six busy loops, a traced ActionCard handoff started its ghost-out fade 209 ms after the commit. Its last frame was at 283 ms of fade time, and the timer cancelled it at about 390 ms. The ghost disappears from partial opacity instead of fading out, which D53 (docs/decisions/design-kit/loading.md) says it should do.
This was the likely mechanism behind the intermediate-opacity and mid-sample signatures recorded under #1946 (closed not planned). Under heavy load the old playHandoff mid-handoff sample (a 300 ms wall-clock sleep, then an outgoing-opacity read) failed with expected NaN to be greater than 0 in 3 of 4 runs: the ghost was already gone. Sampling at the fade's own 300 ms midpoint instead, frame by frame, still failed 3 times in 4 runs, because the timer cancels the fade before it reaches its midpoint.
Measurement evidence from #3777 (merged 2026-11-09, harness only, folded in from #3804). #3777 moved the story's mid-fade sample onto the page's own rendered frames (watchHandoff, packages/ui-kit/stories/_handoff-clock.ts, used by playHandoff in packages/ui-kit/stories/_ghost.tsx:46): it records both layers' opacity in the first frame whose ghost-out fade is running and at least a tenth through. On a CPU-loaded host (16 busy loops on 16 cores, load average 26–38) it recorded:
- waiting until 300 ms after arrival on the wall clock read out = 1 and in = 0, because the browser had not started the CSS animation yet;
- waiting until the fade's own
currentTimereached 300 ms failed 6 of 10 runs, because the component removes the ghost on the 600 ms commit timer, not onanimationend, so a late-starting fade is cut off before its midpoint; - its PR left exactly this product defect open ("Anything left open"). The frame-count budget from test(ui-kit): StreamingAnswer 'Loading To Ready' fails on a 700 ms wall-clock handoff bound under runner load #3417 still guards removal past the fade, not before it ends.
Out of scope
- Changing the approved 600 ms fade, the easing or the ghost-out keyframes.
- The removal bound itself: test(ui-kit): StreamingAnswer 'Loading To Ready' fails on a 700 ms wall-clock handoff bound under runner load #3417 made it count rendered frames (test(ui-kit): count the ghost handoff in rendered frames, not wall-clock ms #3426, merged 2026-11-03).
- The story harness's measurement (
stories/_handoff-clock.ts), which test(ui-kit): sample the ghost handoff's mid-fade on the page's own frames #3777 settled: the wall-clock sleep is already gone. - Weakening or deleting the mid-handoff opacity assertions, or retrying.
Scope
End the arrival handoff on the outgoing fade's own end (its animationend), with the timer kept as a fallback only where no fade runs: reduced motion, animation: none, or a document that does not render frames. Every useArrival consumer is affected: StreamingAnswer, Placeholder, and the Ghosted and GhostBand callers (ActionCard, FileRow, QueueItemRow, SearchResultCard), across the four bk-ghost-out call sites above.
Acceptance criteria
- With the fade's start delayed by a forced long task right after the arrival commit, the ghost stays mounted until its fade has ended (it reaches opacity 0 before removal). A native Chromium control shows it, failing first on main. (test(ui-kit): sample the ghost handoff's mid-fade on the page's own frames #3777's fade-
currentTime300 ms anchor, which failed 6 of 10 under load, is one suitable failing-first control.) - Under reduced motion, and with
animation: none, the ghost is still removed afterHANDOFF_MS. It never waits for ananimationendthat does not come. Tests prove both. - The existing handoff stories (test(ui-kit): sample the ghost handoff's mid-fade on the page's own frames #3777's frame-clock sample, mid-opacity, geometry and test(ui-kit): StreamingAnswer 'Loading To Ready' fails on a 700 ms wall-clock handoff bound under runner load #3417 frame-count assertions) and
tests/visual/ghost-handoff.visual.tsxandtests/visual/streaming-handoff.visual.tsxkeep passing in both themes. - A mutation that removes the ghost at the timer regardless of the fade fails the new control.
Verification
Pinned mcr.microsoft.com/playwright:v1.63.0-noble, network disabled, real Chromium. Run the LoadingToReady stories (the stories/decisions and stories/rows projects) in storybook and storybook-light, plus tests/visual/ghost-handoff.visual.tsx and tests/visual/streaming-handoff.visual.tsx, under a CPU-starved container. No API key, no network.
Contract impact
None. Internal hook timing only; no public prop or --json shape changes.
Triage 2026-11-03: added blocked with Blocked by #3417; re-verified citations; kept priority: p3. Second pass: raised to p2 (product defect against D53 with a recorded failure); milestone 0.45.0; no epic parent.
Triage 2026-11-10 at main 3aadc8df5: Decision (maintainer, 2026-11-10): #3804 is folded into this issue and closed as its duplicate. Moved in #3804's four bk-ghost-out call sites and #3777's measurement evidence, and its animation: none fallback criterion. Blocker #3417 closed completed and #3426 merged on 2026-11-03, so Blocked by #3417 became a reference and blocked was removed. #3777 already removed the wall-clock sleep from playHandoff, so that part left the scope. Corrected tokens.css to :1399-1401. Still agent-ready, p2, 0.45.0.
Activity
schlessera commentedon Nov 3, 2026
Triage 2026-11-03: added
blockedwithBlocked by #3417. The acceptance criteria keep #3417's frame-clock assertions passing, and those exist only in draft PR #3426. Also corrected the_ghost.tsxcitation to main (:95sleep,:98read).schlessera commentedon Nov 3, 2026
Triage 2026-11-03 (second pass): every citation re-verified at main
d990c0ab3, unchanged. Raisedpriority: p3top2: this is a product defect against D53 with a recorded failure, and the mechanism behind #1946's mid-handoff signature. Its blocker #3417 is p2, so the blocker rule holds. Milestone 0.45.0, as a direct, small follow-up of #3417. No epic parent: like #3417 this is a product fix that lands on main, outside #1849's test-cost outcome. Stillagent-readyandblocked.schlessera commentedon Nov 10, 2026
Decision (maintainer, 2026-11-10): fold #3804 into this issue and close #3804 as a duplicate of it. One implementation of the
useArrivalfix lands here.2026-11-10 triage at main
3aadc8df5: the body now carries #3804's fourbk-ghost-outcall sites (GhostText.tsx:222,Placeholder.tsx:215,GhostBand.tsx:60,StreamingAnswer.tsx:139), #3777's measurement evidence (the fade-currentTime300 ms anchor failed 6 of 10 under load because of the commit timer), and #3804'sanimation: nonefallback criterion. #3417 closed completed and #3426 merged on 2026-11-03, soblockedis removed andBlocked by #3417is now a reference. #3777 already took the wall-clock sleep out ofplayHandoff, so that part left the scope. Corrected thetokens.csscitation to:1399-1401. Stillagent-ready, p2, milestone 0.45.0.schlessera commentedon Nov 15, 2026
Claimed for implementation. Claim token:
claim-657baba6. Branch:fix/3425-ghost-fade-animationend.collisions: closure-only overlaps with open PRs via shared test closures; no path collisions
test: count the ghost suite's three new arrival tests in the descript…
fix(ui-kit): end the ghost handoff on its fades' own end (#3425) (#4065)
schlessera commentedon Nov 16, 2026
Merged in #4065 as
e66cf4c8fthrough the integration lease (orchestrator merge queue for 0.45.0). Candidate confirmation passed on the exact head; the squash's own main run carries the post-merge heavy categories.