Repository navigation
fix(chat): keep the focus on a todo update its run folds in, and show each update's own input and output (#1601) - #2161
Conversation
… each update's own input and output (#1601) When the next todo update turned the single row the reader was on into a Plan row, the button holding the keyboard's focus left the page and the focus fell to <body>. A row head now records that it holds the focus in the timeline row's memory, and the head drawn in its place (the same update inside the opened run, or the run's own head) takes it back when the focus fell to the page; focus the reader moved elsewhere is never taken. An update opened inside the Plan row showed the parsed list again, which the run already shows. It now shows the input the agent sent (JSON indented) and the output it got back.
…the window is away Review follow-up. A head that left with no head drawn in its place in the same render kept its record, so a row remounted later (scrolled back, opened again) could take the focus from the page. The record is now one object per focus and ends a microtask after its head leaves unless a replacement took it. A blur from the window losing the focus no longer ends it, so a fold that happens while the reader is in another app still keeps the focus on their row.
…nmount StrictMode runs an effect's cleanup and the effect again on the same element; the record's cleanup now ends it only when its head has really left the page.
…not only on the event With the window in the background the browser moves the focus to the restored head but sends its focus event only when the reader comes back, so the record was not renewed and the old head's cleanup ended it; the next regrouping before the reader returned dropped the focus.
|
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 9 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. Comment |
|
Fast checks on 12c0c34 failed on one test outside this PR: |
|
The rerun failed on the same test again ( |
|
Fast checks passed on the rerun of 12c0c34, so every required check on this head is green. I am not pushing the merge of main I mentioned: it would only restart green CI. A local merge with current main (d9050a0, which includes #2169) merges cleanly, and |
|
Merging 12c0c34: omo-native-code-reviewer and Codex both pass this head, and the new input/output test fails on main. The required checks are green; Fast checks first failed on #2150's new CPU-ratio test in |
Change
Fixes the two gaps #1601 still had after #1846 folded contiguous todo updates into one Plan row.
<body>(expansion already carried over since fix(chat): keep a tool you opened in place while GJC streams, and through its rewrites #1937). A row head now records in its timeline row's memory that it holds the focus (useRowFocus,src/lib/chatRowState.tsx). The head drawn in its place in the same render takes the focus back: the same update inside the opened run, or the run's own head when it is folded. Focus the reader moved elsewhere is never taken, a head that leaves with no replacement ends its record (a row scrolled back or reopened later never grabs the focus), and a fold while the reader is in another app keeps it too.Design: the Codex and Claude apps keep one row per action under the turn and keep the reader's place while a turn streams. This follows that, as #1846's DESIGN.md entry does; the entry now records both rules. "Input" is translated into Korean, Japanese and Chinese. A
changelog.d/fragment is included.Closes #1601.
Validation
scripts/chat-gjc-streaming-browser-qa.ts(browser lane): its todo scenario now asserts the focus is on the opened update inside the Plan row after the next update arrives. On main all four variants (1440/390 × append/rewrite) failed with the focus on BODY; on this branch all pass.src/components/ChatTurn.test.ts: an opened two-update run shows each update's raw input and output.scripts/todo-snapshots-demo-regression.ts: 21/21 pass (1440/390, light/dark, Korean), including "open, focused run through append and poll".bun run check fast: green on b4d51fd (unit tests 7886 pass, 0 fail). On the final head 12c0c34 (one line added touseRowFocus), typecheck, build and generated files pass; the unit tests had one timeout in an untouched file,scripts/ci-browser.test.ts"creates evidence under .ci when CI has no CHECK_DIR" (5029 ms on a 5 s limit at host load ~66). Rerun on its own, it passes in 3.4 s (7/7).