Repository navigation
fix(sidebar): keep the last of two row-window entries - #18539
Conversation
Design Review (Opus 5.5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS Check that the screenshots show the same throttled-scroll run on main and on this branch, since jsdom can't reproduce real observer timing. [DESIGN-REVIEWED] 1cf9665 Description read[DESCRIPTION-READ] 1acca1f39256be9fe111bc48c2939a1858484999fe5763f5c8814a360b10e1ac That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
UX Review (Opus 5.5, fork) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing to check. [UX-REVIEWED] 1cf9665 Description read[DESCRIPTION-READ] d08092b181ab7835c0a850b75b12519845604ef89594acb8f8439d7b8ba9f5a4 That sha256 names everything this verdict read: the PR description, plus the 5 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Opus 5.5 Review (fork) — ✅ no blocking findingsReviewed |
GPT 6.1 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
First Principles Review (Opus 5.5, fork) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing to check. What this change shipsInventory (2 items) — 2 justifiedIntent: when a person looks at the session sidebar, every visible row should show in full (agent, time, status, PR chips) without reloading the page. This is a FIX (#18538).
[FIRST-PRINCIPLES-REVIEWED] 1cf9665 Description read[DESCRIPTION-READ] b6430b6d2d8dddaaca26ff7f7315a37828413c56a5efa6f766e2d955b5db7893 That sha256 names the PR description this verdict read. Recompute it with |
|
note (non-blocking): Backend Tests (Windows) shard 6 failed on a test this diff does not reach. The failure is |
cc64319 to
af1998f
Compare
|
chore (non-blocking): rebased on main, no behaviour change. Same single commit, now af1998f. This re-runs CI because the only red, Backend Tests (Windows) (6) on test_concurrent_rewrites_never_fold_to_a_false_absence, sits in backend code the website-only diff does not touch, and the fork cannot re-run jobs. |
A windowed session row compared each IntersectionObserver entry against the near state React had last rendered. When two entries for one row arrived before React rendered the first, for example "far" then "near" while the lane jumped away and back on a busy main thread, the second matched the stale rendered value and was dropped. The queued "far" then committed, so the row stayed a title-only stub inside the viewport. The observer sends no further entry while the row stays within the 1200px window, so scrolling did not repair it and only a page reload did. The row now compares against the value of its last setNear call, which only setNear writes. The mirror case, a stub told "near" then "far", now ends as a stub instead of staying mounted far from the viewport.
af1998f to
1cf9665
Compare
|
chore (non-blocking): rebased on main, no behaviour change. Same single commit, now 1cf9665. The SAST (Semgrep) finding on af1998f was test-autouse-shared-monkeypatch at test/test_readiness_poll_gate_max_age_14857.py:83, which main gained in decba81. The diff-only scan counted that main commit as new because this branch's base predated it; the new base includes it. |
iamwhatever
left a comment
There was a problem hiding this comment.
This fixes sidebar rows stuck as title-only stubs until reload. When two IntersectionObserver entries for one row arrived before React rendered the first, the second was compared against the stale rendered near and dropped. The root cause is fixed: nearRef now holds the value of the last setNear call, and only setNear writes it. I read the head file and checked every setNear call site (observer, focus, keyboard and mouse activation). All of them go through the new wrapper with plain booleans, so none breaks without a functional updater, and the effect dependency lists were updated. The new test delivers far→near and near→far inside one act. Per the description its first assertion fails on main, and the mirror case covers the opposite drift. The diff is small, base is main, checks are green, three AI lanes PASS, and nobody has requested changes. — crew-pr-reviewer
Problem / Motivation
Goal: Every session row inside the visible sidebar list renders as a full row, without a page reload.
Sidebar rows sometimes render as bare titles: a larger, non-bold title with no agent name, time, status line or PR chips. They sit inside the visible list next to normal rows. Scrolling and switching sessions do not fix them; only a reload does.
Why it matters
A stuck row hides the session's agent, activity time, status and PR chips, so the person cannot tell what that session is doing. It happens on long lists while the main thread is busy, which is when the sidebar is in heaviest use, and it lasts until a reload.
Not a goal
content-visibilityon.session-rowor the folder collapse.What changed (motivation → approach → change)
The stuck rows are the row-window stubs from #15090.
WindowedSlotinwebsite/src/pages/chat/sessionRowWindow.tsxcompared each IntersectionObserver entry againstnearRef, which every render reset to the renderednear. Two entries for one row can arrive before React renders the first, such as "far" then "near" when a busy lane jumps away and back. The second entry matched the stale rendered value and was dropped, the queued "far" committed, and the row stayed a stub in the viewport. The observer sends nothing more while the row stays within its 1200px window, so it never mounted again.nearRefnow holds the value of the lastsetNearcall, and onlysetNearwrites it. Each entry is compared against the state the row is about to have, so the last entry always wins. The mirror case, a stub told "near" then "far", now ends as a stub instead of staying mounted far from the viewport.Backwards compatibility
Compatible: the row window's inputs, outputs and DOM are unchanged; only the order in which two quick entries are resolved changes.
Removes nothing: no path, record, key or function is taken away.
Tests
website/src/test/sessionRowWindow.test.tsxadds "acts on the last of two entries that arrive before React renders the first". It delivers "far" then "near" for a live row inside oneactand expects the real row, then "near" then "far" for a stub and expects a stub. The first assertion fails on main and passes with the fix. The other 21 cases in that file and the 5 inChatSidebar.rowWindow.test.tsxpass.Manual verification
In a Dev Fleet pod with 240 sessions in one folder, Chromium CPU throttled 20x, the tree lane's
scrollTopset to 6000 and back to 0 every frame for 30 rounds. With main's build, the fifth round left 9 rows inside the viewport as stubs, and they stayed stubs through further small scrolls. With this build, 10 rounds left 0 stubs in the viewport and the mounted count held at 41 rows. Main's mounted count drifted between 44 and 92 over the same rounds, which is the mirror case keeping far rows mounted.Screenshots / video
Before, main: 9 rows in the viewport stuck as title-only stubs.
After, this branch: the same run, every visible row renders fully.
Related Issues
Follows #15090, which added the row window.
Pattern harvest
Rule candidate: review-prompt
Pattern: a ref mirrored from rendered state on every render, then compared against in an event callback to skip "unchanged" updates, drops the second of two events that arrive before the next render.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Fixes #18538