Skip to content

fix(sidebar): keep the last of two row-window entries - #18539

Merged
iamwhatever merged 1 commit into
kirodotdev:mainfrom
Pearcekieser:fix/sidebar-bare-title-rows
Oct 10, 2026
Merged

iamwhatever merged 1 commit into
kirodotdev:mainfrom
Pearcekieser:fix/sidebar-bare-title-rows

Conversation

@Pearcekieser

Copy link
Copy Markdown
Contributor

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

  • Changing the row window's margin, initial-mount budget or stub height.
  • Changing content-visibility on .session-row or the folder collapse.

What changed (motivation → approach → change)

The stuck rows are the row-window stubs from #15090. WindowedSlot in website/src/pages/chat/sessionRowWindow.tsx compared each IntersectionObserver entry against nearRef, which every render reset to the rendered near. 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.

nearRef now holds the value of the last setNear call, and only setNear writes 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.tsx adds "acts on the last of two entries that arrive before React renders the first". It delivers "far" then "near" for a live row inside one act and 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 in ChatSidebar.rowWindow.test.tsx pass.

Manual verification

In a Dev Fleet pod with 240 sessions in one folder, Chromium CPU throttled 20x, the tree lane's scrollTop set 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.

before

After, this branch: the same run, every visible row renders fully.

after

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

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

Fixes #18538

@Pearcekieser
Pearcekieser requested review from a team and KiroCrewCaptain as code owners October 9, 2026 17:18
@Pearcekieser
Pearcekieser requested a review from buluoray October 9, 2026 17:18
@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Oct 9, 2026
@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5, fork) — ✅ PASS

Design-level review of 1cf9665818021589c7fad12d1f63d3c3e44d2591 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5, fork) — ✅ PASS

UX-level review of 1cf9665818021589c7fad12d1f63d3c3e44d2591 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review (fork) — ✅ no blocking findings

Reviewed 1cf9665818021589c7fad12d1f63d3c3e44d2591 via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 1cf9665

@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review (fork) — ✅ no blocking findings

Reviewed 1cf9665818021589c7fad12d1f63d3c3e44d2591 via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 1cf9665

@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5, fork) — ✅ PASS

Premise-level review of 1cf9665818021589c7fad12d1f63d3c3e44d2591 via the fork AI-review pipeline — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

First-Principles-Verdict: PASS

Nothing to check.

What this change ships

Inventory (2 items) — 2 justified

Intent: 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).

  1. A visible row that gets "far" then "near" before React renders now mounts as a full row instead of staying a title-only stub. — justified
  2. A stub that gets "near" then "far" before React renders now stays a stub instead of mounting far from the viewport. — justified

[FIRST-PRINCIPLES-REVIEWED] 1cf9665

Description read

[DESCRIPTION-READ] b6430b6d2d8dddaaca26ff7f7315a37828413c56a5efa6f766e2d955b5db7893

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

note (non-blocking): Backend Tests (Windows) shard 6 failed on a test this diff does not reach.

The failure is test/test_instances.py::TestRunMarkerSidecarReadRetry::test_concurrent_rewrites_never_fold_to_a_false_absence, which races concurrent rewrites of the run-marker sidecar file. This PR changes only website/src/pages/chat/sessionRowWindow.tsx and its vitest file, and every other backend shard passed on the same run. A fork contributor cannot rerun upstream jobs, so could a maintainer run gh run rerun 37965358937 --failed?

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 9, 2026
@Pearcekieser
Pearcekieser force-pushed the fix/sidebar-bare-title-rows branch from cc64319 to af1998f Compare October 9, 2026 23:03
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

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.

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Oct 9, 2026
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.
@Pearcekieser
Pearcekieser force-pushed the fix/sidebar-bare-title-rows branch from af1998f to 1cf9665 Compare October 9, 2026 23:30
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

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.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention labels Oct 9, 2026

@iamwhatever iamwhatever left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@iamwhatever
iamwhatever enabled auto-merge (squash) October 10, 2026 07:56
@iamwhatever
iamwhatever merged commit 61073f3 into kirodotdev:main Oct 10, 2026
104 checks passed
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork Pull request from a fork (external contributor)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sidebar rows stay title-only stubs until reload

2 participants