Skip to content

fix(chat): restore your reading position after an empty search - #205494

Merged
vincentkoc merged 1 commit into
mainfrom
fix/chat-empty-search-return-c34
Nov 25, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
fix/chat-empty-search-return-c34

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

When a transcript search finds no messages, clearing the query or closing search jumps to the beginning of the chat. This also loses the reader’s place if they scrolled through matching results before narrowing the search.

User Impact

Close or clear an empty search to return to the message you last read at the same screen position. If you were following the latest messages, you return to the end. Searching still takes you to the first match, and opening a result still takes you to the selected message.

Why This Change Was Made

The empty search view removes all virtualized messages. The transcript now records which visible message to restore before the rows disappear and issues the first-result scroll only after a result viewport has mounted.

The message-anchor approach builds on the original work by @vyctorbrzezowski in the closed, unmerged PR #152095.

Evidence

Three focused Chromium regressions failed on the parent and passed on this change. The parent lost both marked messages and left the end follower 7,713 px from the bottom. Across 18 mounted cases covering desktop and portrait, the largest measured message displacement was 0.5625 px. The draft, editor, and loaded message array survived, and the end-follow controls finished at a zero-pixel gap.

Hosted validation

All three Chromium regressions passed: Close returned to the earlier reading position, Clear returned to the deliberately read result, and Close from Latest restored the end follower. Both real-Gateway shards built the runtime and Control UI. Chromium results

The background-work test timed out at 120 seconds while observing the child’s in-flight startup response. The same test, stage and timeout occurred on main. Knip’s script and full-tree reports flagged two known Parallels preflight exports. Its production report passed. The aggregate retained these failures. Gateway job · Main comparison · Dependency job

In a mounted Chromium run with the reply-reveal fix, the original message returned at the identical viewport position after a no-match search closed. Latest then returned to the physical end.

Fixes #151970

@vincentkoc vincentkoc self-assigned this Nov 25, 2026
@clawsweeper

clawsweeper Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. impact:ux-friction User-facing flow adds avoidable confusion or support burden without fully blocking progress. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 25, 2026
@clawsweeper

clawsweeper Bot commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR restores the reader’s message position or end-following state after clearing or closing a search with no matches.

Example: Read Folio 40, search for absent-from-the-transcript, then close search.

  • Before: The conversation returns at the beginning.
  • After: Folio 40 returns at its previous screen position.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The patch is focused and source-consistent, but required current-revision product proof is missing.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Clearing or closing a search with no matches makes readers lose their place in a long conversation.
Reason: Restoring reading continuity has clear user value, and the maintainer-authored direction fits the existing transcript anchoring contract.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR addresses a concrete reading-position bug still present on main, and source review found no definite introduced defect.

Reviewed head: 1251a3a9a0b78cb433e138f75557d4bf6c54c3fa

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: Provide current-revision browser screenshots or a recording with position observations for historical-reader Close, newer-result Clear, and end-follow return; the PR reports red/green regressions, but the inspectable media belongs to earlier code.
Agent review details

How this fits together

The Control UI filters loaded conversation messages into virtualized rows; its session-owned anchor and scroll machinery preserve the visible message as those rows change.

flowchart TD
  A[Loaded messages] --> C[Transcript projection]
  B[Search input] --> C
  C --> D[Message anchor owner]
  C --> E[Virtualized rows]
  D --> E
  E --> F[Reader position]
Loading

Technical review

Best possible solution:

Preserve search-return intent in the existing session-owned message anchor and restore it through the existing measured-row lifecycle.

Do we have a high-confidence way to reproduce the issue?

The no-match shell removes virtualized rows while search closure restores the full projection without a saved search anchor on main; the linked report supplies observed failures, but this read-only review ran no reproduction.

Is this the best way to solve the issue?

The approach is appropriately scoped: it reuses message identity, measurement, and scroll ownership rather than introducing a competing restoration system.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against bf3729e40c48.

Provenance checked

  • Message-anchor ownership keeps the original intent (d70f835: Preserve a visible message across history prepends and row regrouping; subsequent refactors retained measurement and restoration in this owner.)
  • Search first-result positioning keeps the original intent (34e6076: Keep matching results visible instead of allowing end-following to show a live reply below them; this PR retains the positioning while deferring it until the result viewport settles.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 34e6076 adds ui/src/pages/chat/components/chat-thread-view.tsx:95 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 34e607682be5; files: ui/src/pages/chat/components/chat-thread-view.tsx)
  • Josh Lehman: Raw commit d70f835 adds ui/src/pages/chat/components/chat-transcript-prepend-anchor.ts:4 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: d70f83517220; files: ui/src/pages/chat/components/chat-transcript-prepend-anchor.ts)
  • Vincent Koc: Raw commit 671bf96 adds ui/src/pages/chat/components/chat-thread-view.tsx:131 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 671bf969d5dc; files: ui/src/pages/chat/components/chat-thread-view.tsx)

PR surface

Source +88, Tests +103. Total +191 across 6 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 5 99 11 +88
Tests 1 103 0 +103
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 202 11 +191

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #151970
Summary: This PR is a new candidate repair for the established empty-search reading-position report.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Attach current-revision browser evidence exercising the three changed search-return scenarios.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 25, 2026, 1:39 PM ET / 18:39 UTC.

@vincentkoc
vincentkoc marked this pull request as ready for review November 25, 2026 18:46
@vincentkoc
vincentkoc merged commit 95df0c9 into main Nov 25, 2026
222 of 226 checks passed
@vincentkoc
vincentkoc deleted the fix/chat-empty-search-return-c34 branch November 25, 2026 19:31
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui impact:ux-friction User-facing flow adds avoidable confusion or support burden without fully blocking progress. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Chat loses reading position when clearing or closing a search with no matches

1 participant