Repository navigation
fix(chat): a search's pick opens the folded failed-requests row its match is in - #3106
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 2 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
|
Reviews at head 4ef2715:
Open review threads: 0. |
|
Local merge gate (owner-approved): |
…in the failed-requests script (#3111) ## What `scripts/chat-request-details-demo-regression.ts` fails on main (Browser regression, other scripts) at line 116 on every phone run: ``` 116 | if (phone) await page.locator(".tab-strip-menu").first().click(); TimeoutError: click: Timeout 30000ms exceeded. - waiting for locator('.tab-strip-menu').first() ``` #3106 added a phone step that opens Search conversation from the tab row's menu button. #3099, merged after it, drops the tab row on phones (the header title lists the tabs) and moves the pane's actions to the header's More. #3099 had already moved `conversation-search-demo-regression.ts` to `.header-more-button`, but it never saw this new step. This PR moves the step the same way. The step still opens the pane's menu, picks Search conversation, and asserts the folded row opens on the pick. No assertion changed. ## Validation - In `herdr-ci-runner:local` (own `HERDR_TEST_SESSION`): main's version of the script fails at line 116 as in CI (`TimeoutError ... waiting for locator('.tab-strip-menu')`); with this change it passes all 8 runs (390 and 1280, light and dark, details on and off). - `bun run check fast`: pass. - Skipped: the rest of the browser suite (only this script changed).
Fixes #3082.
What
With Settings > Chat > Compaction and failed requests on, a run of back-to-back failed requests is one folded row. Conversation search still finds words of those errors (it reads every non-commentary text part), and a pick scrolled the turn into view but left the matching error folded inside the closed row.
Now a pick whose match is in a failed request opens the row it is folded in:
foldedRequestsMatch(src/lib/workBlocks.ts) names the folded row (by its first part's index, the row'sfailed:<index>memory key) that the turn's first match of the picked words lies in. The first match is the one the search's snippet showed. It returns null when that match is drawn outside every such row.matchPart(shared/conversation-search.ts) is the part the first match begins in.matchRownow reads the store row from it, with no change in what it returns.revealTurnplaces the turn,ChatViewsets the row's remembered toggle open, so a row the list draws later starts open, and opens a row that is already drawn in place.chatRowMemory(src/lib/chatRowState.tsx) makes a row's memory before the row is drawn. ChatTimeline uses the same helper.With the setting off nothing changes: there is no row, and the error lines are drawn and searched as before. The server's search is unchanged.
Design: this works like a browser's find-in-page, which opens a closed
<details>when the found text is inside it (Chrome's auto-expand ofdetails/hidden=until-found). The pick reveals what it found instead of pointing at a folded row. The Codex and Claude apps have no folded error rows to compare with.A search for
Erroralso matches theError:prefix that each line in the opened row leaves out. The pick still opens the right row, and the row is the error row.Validation
bun test src/lib/workBlocks.test.tsfailed before the helper existed (export missing). It passes now, together withshared/conversation-search.test.tsandserver/conversation-search.test.ts(76 pass).scripts/chat-request-details-demo-regression.tsnow folds the row again, searchesconnection errorfrom the pane's menu, picks the match and expects the row open with the error visible. It ran at 390 and 1280 px, light and dark, with the setting on and off: 8/8 PASS. With this PR'sChatView.tsxchange reverted, the new step fails (waitForFunctiontimeout: the row stays folded).scripts/conversation-search-demo-regression.ts: all PASS at 1280 and 390.bun run check faston the head merged with origin/main: all ok (typecheck, build, unit 12534 pass / 0 fail).Screenshots (pick of
connection error, row opened by the pick):