Repository navigation
fix(transcript): stop smooth navigation when the reader takes over - #1952
Conversation
When stopping a background task runner on Windows, child processes spawned by the launcher shell could escape the Job Object if they were spawned before or concurrently with AssignProcessToJobObject. This left descendant commands (such as dev servers or long-running watchers) running in the background after the shell exited. ProcessOwnership::terminate now traverses the descendant process tree using a ToolHelp32 snapshot and explicitly terminates all descendant processes under the runner root PID in reverse hierarchy order, ensuring no orphan processes remain when a background task is stopped. Unexpected snapshot, open, or terminate errors are propagated while continuing cleanup. fixes vastsa#1805
Retire browser-owned smooth scrolling when transcript input takes over. Cancelling the follow frame alone leaves minimap navigation free to move the reader during later stream updates. Cover the interruption in real Chromium, including hidden Linux windows, without changing the original long-history assertion.
There was a problem hiding this comment.
🔵 Needs a closer look
Approval should wait for the pending Ubuntu x64 Chromium integration check, which is needed to validate the platform-specific smooth-scroll interruption behavior and reported displacement.
No open issues 🎉
What changed in this PR
This PR stops stale browser smooth-scroll animations when the reader takes control of transcript navigation, adds a Chromium interruption regression, and updates the related interaction documentation.
Changes:
- Cancels active smooth navigation during transcript-owned input.
- Adds
E2E-TRANSCRIPT-scroll-interruptioncoverage. - Documents the updated scroll-ownership behavior.
| File | Summary | Review notes |
|---|---|---|
scripts/e2e/transcript-disclosure-anchor.tsx |
Adds a real Chromium regression for interrupting smooth navigation. | No blocking findings. |
docs/spec/06-delivery/04-e2e-test-plan.md |
Defines the new transcript scroll-interruption E2E scenario. | Nit: parallel component-spec entries should also be updated for consistency. |
docs/spec/04-ux/09-interaction-patterns.md |
Documents smooth-navigation cancellation and input ownership. | No blocking findings. |
apps/desktop/src/features/chat/transcript/hooks/useTranscriptScroll.ts |
Cancels browser smooth navigation when transcript-owned input is detected. | Two moderate findings: control activation can incorrectly cancel navigation, and the delegated useFollowScroll path lacks equivalent cancellation. |
Review effort: Lite
muzimu217
left a comment
There was a problem hiding this comment.
The mechanism is right and the placement is the part that makes it complete.
releaseFollow is documented as the entry point for every reader-driven move, so putting the cancellation there covers wheel, keyboard and scrollbar drag in one place rather than only the wheel handler the regression test exercises. scrollTo({ top: scroller.scrollTop, behavior: "instant" }) is the standard way to retire a browser-owned smooth navigation at its current offset, and doing it after the ownership checks means it cannot fight a pinned follow frame.
It also explains the shape of the longHistory failure better than "history mutations moved rows": the probe runs with reducedMotion: false, so a smooth navigation started by its own setup can still be animating when the stream update lands, and the 262 px displacement is exactly what a continuing animation looks like from the outside. That is consistent with the deterministic 9069 -> 8807 on two heads and with the interruption regression measuring 424 -> 0 without the fix.
One thing to state plainly in the description, because it is the evidence a reviewer needs: you did not reproduce the exact 9069 -> 8807 locally, and the claim rests on the PR's own CI passing the longHistory phase. Given the main failure was byte-identical across c014b3206 and 93620a806, a passing run is meaningful rather than noise — but the description should say that explicitly, and the merge should be followed by one look at the longHistory phase on main to confirm it stays green. If it goes red again with the same numbers, this fix is necessary but not sufficient.
The regression test is well shaped: dispatching the wheel event before yielding to the first animation frame, and asserting no later movement, pins the exact race — including the note that hidden Linux windows can finish a smooth navigation between two rAF callbacks, which is why waiting for a midpoint would have been flaky.
Keep button activation and select keys out of transcript scroll input. Apply the same browser navigation cancellation to delegated scrollers without moving it into completion-driven follow release. Cover control input, nested ownership and both scroll paths in Chromium; retain normal completed-turn navigation and the original history probe.
The unchanged x64 displacement recurred after the input ownership fix. Record browser navigation calls and application offset writes without adding layout measurements before the existing assertion.
Persist review rollback state as a small transcript mutation instead of materializing and replacing the complete session and message index. Cache proven message identities with the layout so historical card lookup reads only its selected record. Invalidate unknown generations, preserve message positions, and replay state across windows and session mutations. Refs vastsa#1836
Collect the same navigation parameters on passing and failing probes. Avoid stack allocation in the hot path so observation has less influence on the scheduling race under investigation.
Reader-driven follow release must stop an existing browser navigation, including disclosure and search moves that do not emit scroll input. Keep completion on a state-only transition so its new prompt navigation is preserved. Cover smooth navigation followed by manual disclosure in both scrollers. Remove temporary tracing and retain the original long-history probe.
Update the existing source contract for the extracted state transition. Keep checks for synchronous disclosure release and completion wiring, while real Chromium regressions verify scroll geometry.
|
@muzimu217 Updated through Reader-driven The additional disclosure case was significant: starting smooth navigation immediately before manually toggling a real title reproduced title displacement on the input-only implementation. That regression now passes in both scrollers. The input matrix also covers nine DOM input cases per scroller, and the normal turn-completion E2E still passes. All six checks on the final head pass. Ubuntu x64's unchanged original The description explicitly retains the evidence limits: the exact |
Document the exact read-overlay and serialization path that preserves review state through transcript rewrites and revision archives. Cover retained-prefix truncation and equal-sized state appends through warm, cold, and sequential reads without relying on timestamps. Refs vastsa#1836
Combine the reader takeover fix with the current Fast-mode main before comparing fixed revisions under the same Ubuntu Chromium environment. Retain both test specifications and all upstream behavior.
Hidden Linux windows delivered animation frames at roughly one hertz, causing both fixed-head completion probes to exceed their deadline. A visible window preserves the existing assertions and timeout. Run the completion probe in normal Electron CI so reader-takeover changes also preserve the new navigation started by a completed turn.
Seven desktop tests passed new URL(..., import.meta.url).pathname where a filesystem path was needed. That string is a usable path on POSIX CI but yields /C:/... on Windows, which fs and child_process reject with ENOENT: 22 tests failed locally and gen-ui-protocol.test.mjs failed to load at all. Production code builds these paths with join() and is unaffected. Convert each URL with fileURLToPath(): the ModelsDevCatalog catalogPath in four provider suites, the forked plugin-host entry in plugin-remote-files (all seven of its tests died with PLUGIN_CRASHED), the spawned sidecar entry in sidecar-history-restore, and the GenUI kit directory. One more assertion pinned a POSIX-joined literal while production joins with path.join (gen-ui-kit.ts), so its expectation now mirrors that expression, identical on POSIX. Verified on Windows 11: every touched file goes from failing (or not loading) to fully passing under node 22.19, with no POSIX change.
Two blockers from review kept this from landing: the PID-only sweep could hit a recycled PID, and the regression spawned the shell directly instead of the runner path that actually ships. Resolve both in a dedicated module. `terminate_tree` opens each snapshot entry with PROCESS_TERMINATE | PROCESS_QUERY_LIMITED_INFORMATION, skips it when the handle's exit code is no longer STILL_ACTIVE, and compares the handle's creation time against a watermark taken right after the snapshot so a process created later — the only kind that can own a recycled PID — is never terminated. Access denied on a live member is reported rather than counted as stopped, and cleanup still continues across the rest of the tree. The regression now drives the production chain through the real background task entry point and asserts the launched command and its own child are both gone. It lives in a sibling module so `background_tasks.rs` stays inside the Rust LOC limit that failed CI.
…ask-process-tree fix(host-core): terminate background task process tree on Windows
The opt-in transcript ring showed icons only and put the active label in a tiny hub label, so an action could not be read before hovering it, and the wedge fill plus a separate button background painted two highlights over one target. Rebuild the surface: every sector carries its icon and label at rest, the active sector fills once with no focus rectangle, the hub is a recessed well the click point sits in, the disc shrinks from 320 to 248 px with hairline separators and the composer shadow, and hover and reveal follow the shared motion tokens. Add the standard marking gesture: a right-press started while the ring is open runs the sector it is released on, releasing in the hub dismisses without running, and the trailing release of the opening right-click is inert. Storage, action vocabulary, and defaults are unchanged.
The ring's switch lived in the AI tab although the surface is a transcript-interaction preference. The card now sits in General right after Sidebar and the settings-search index follows it, so a search for the ring still lands on the owning tab and the settings-search test pins the owner. Resolution, persistence, and the direction pickers are unchanged.
Two capture scenes shoot the opt-in ring over a seeded transcript in both themes with a hovered sector, so the redesigned surface stays reviewable outside the app shell. The capture rig gains a seedRadialMenu fixture that flips the preference in the store the transcript reads, without writing the settings file.
The interaction spec describes the at-rest sector labels, the single wedge highlight, the recessed hub, and the marking gesture; the settings-IA card moves to General in both languages; the E2E scenario covers at-rest labels, the marking release, and hub dismissal; and the decisions log records D678 in English and Chinese.
feat(chat): rebuild the radial context menu and move its settings to General
…Require
The e2e certificate probe's esbuild banner derived __dirname with
new URL('.', import.meta.url).pathname - the same Windows-broken form the
rest of this branch fixes, and the one occurrence outside apps/desktop/test.
The banner cannot declare fileURLToPath (the bundled sources import it from
node:url; a same-scope redeclare is a syntax error), but it already injects
createRequire, so resolve through that instead. Both bundles build and pass
node --check with the new banner.
The Windows path fix used createRequire with a module specifier, which aborts the certificate E2E before any TLS check. Use the injected require function to resolve the URL module and preserve the Windows path conversion.
…athnames fix(tests): resolve test resource URLs to real paths on Windows
…iew-state fix(storage): append review state without rewriting history
vastsa
left a comment
There was a problem hiding this comment.
Verified the browser smooth-navigation takeover defect and the fix on the latest main integration tree. The disclosure E2E retains 424→424 in the main scroller and 244→244 in the delegated scroller, including control and nested-input ownership. Turn-completion and the unchanged long-history render E2Es also pass; 57 targeted tests, desktop typecheck, build, and lint pass. I merged current main into your branch without changing the product diff. The historical 9069→8807 displacement remains unattributed, as the PR description states. Thanks for the careful paired regression evidence.
All six checks pass on current head
3de679fbd40ec163505d93d262e35993850b195a, including the newly added completion E2E. The historical CI failure remains unattributed. This head integrates mainb91f35122f8dea64a610453fd1a9ecf33e57ce1b. The paired product comparison below testedd035130c28059ee34f5965b0bbb69f2b3b1cd7d9; the only subsequent changes are the completion-test window, its CI step, and E2E documentation. Product source is unchanged.Transcript-owned input now stops an outstanding browser smooth navigation at its current offset. Previously, input released disclosure/bookmark ownership but left a minimap or jump animation running independently of the application's follow frame, so a later frame could move the reader toward the old destination.
Both main and delegated transcript scrollers share instant cancellation after input-ownership checks. Button Space activation and select keys belong to those controls, while nested scroll input belongs to its nearest scroll owner. Reader-driven
releaseFollow, disclosure and search also stop prior navigation. Turn completion instead uses a separate state-only follow transition: it starts a new smooth prompt navigation before releasing follow, and that new navigation must survive. History mutations, persistence, row projection, and the original long-history assertion are unchanged.Fixed-head comparison
Full comparison and retained logs: one Ubuntu 24.04 runner, image
20261026.354.1, Node24.18.0, Electron43.6.0, immutable baseline and candidate above. Each original run starts fresh Electron processes/profiles. These are three scheduled runs per arm, not retries until green.b91f35122d035130c2longHistoryAll six original runs report
render,runtimeSlot,smoothText, andlongHistorytrue, with no phase errors. The 10,784-message case retains zero old-body reads and zero unchanged-group rerenders. The original long-history fixture is byte-identical between arms (SHA-2567d59595b13bd547d0dcd8dcfb3dd2b9ff59bbc039ec4ef8dd8f9247a899c8a77); the original disclosure fixture is also shared for this comparison. The added regression is a separate run using the same candidate fixture on both product revisions. It fails on a real assertion on main, not a build/import failure. The fixed run retains424 -> 424in the main transcript and244 -> 244in the delegated scroller, with nine DOM input cases per scroller.The first comparison job remains red: both extra completion probes timed out. Separate frame-delivery diagnostics reproduced that failure on both immutable product revisions. Hidden-window animation frames arrived about 1,016–1,017 ms apart even with
backgroundThrottling: false; showing the window under Xvfb/Openbox let both revisions pass in about three seconds. The fixture and runner hashes match across arms. All assertions and the 60-second deadline were preserved. This second diagnostic used a different Ubuntu image (20261023.334.3), with both arms again sharing one runner.3de679fbdapplies that test-launch correction and adds the existing completion probe to normal Electron CI. It does not change product scrolling code or weaken any assertion. Initial timeout results remain retained rather than being overwritten.Other validation
3de679fbd. Final CI explicitly runs and passes original render/long-history, expanded disclosure, and completion E2E. The final probes report all four render phases true, no phase errors, interruption offsets424 -> 424/244 -> 244, completion prompt top62, and the reader's retained scroll top1610.dd2798bcb35adf2dc45d0e6120cdf7f9c2a3ca76. The paired-tested product source trees are unchanged by the final test-only commit.Evidence limits
Both revisions pass the original test three times, so this comparison does not establish that #1952 caused earlier green runs, prove a timing race, or exclude effects from the Fast-mode merge. It does independently demonstrate the pending-navigation/disclosure defect on current main and that the candidate fixes that regression. The historical
9069 -> 8807displacement has not been causally attributed.The scroll hook has the identical blob
a901d3a623e2fe997a9538f0a8d49a3da48dffdfbefore #1907 (1fa7d1661) and at its merge (c014b3206). The transcript components, hooks, styles, and original probe are also unchanged across that merge. The smooth-navigation cancellation gap predates #1907; whether other changes exposed the historical failure through timing remains unproven.Updates component and interaction specifications plus E2E-TRANSCRIPT-scroll-interruption.
Refs #1907