Repository navigation
test(copilot): take the follow-up turn through New messages when the opened output left the end - #3654
Conversation
…opened output left the end
## Change
Fixes a flaky browser script, `scripts/copilot-chat-browser-qa.ts`
("TimeoutError: waitFor: Timeout 15000ms exceeded"). It needed a second
run 10 times in 30 h of CI (`bun scripts/ci-flakes.ts`), most recently
run 42954642665. Nine of those timed out on the wait for
`Follow-up answer.`, and one on the next turn, `Autopilot finished this
task.`. All ten came after #3504.
## Cause
The script opens the shell call, its detail and its whole output before
it appends the follow-up turn. Opening a tool or an output counts as
reading there (#1388): the chat stops following the end, and a turn
written meanwhile shows the New messages button. The timeline is a
virtual list (drawDistance 400 px), so a row that far below the view is
not mounted, and `getByText(...).waitFor()` never finds it. Whether the
new row still fell inside the draw distance depended on where the list
had settled after the clicks, so the wait passed most of the time.
A traced failure under load showed the server is right. The push came
52 ms after the append, the read after it returned 200 with the
follow-up turn, the New messages button was shown, and the mounted rows
stopped at `Follow-up prompt` (scrollTop 1146, scrollHeight 2621,
clientHeight 589).
## Fix
The script waits for either the answer or New messages. When the
button shows, it clicks it, as a reader would, and then waits for the
answer. Back at the end, the chat follows the turns after it as well.
There is no sleep and no longer timeout, and nothing in the product
changes.
## Validation
- In the CI runner image (`herdr-ci-runner:local`) on 3 CPUs, next to
loops of copilot-image, chat-fallback and chat-virtual browser QA:
main's script failed 7 of 30 runs (all at `Follow-up answer.`), the
fixed script none of 30, interleaved run for run under the same load.
A separate earlier run of main's script failed 4 of 20. With the final
locator, 15 of 15 more runs passed, 2 of them through New messages.
- `bun run check fast`: everything passes but one unit file,
`server/machine-core-choice.test.ts` ("default herdr older peer"),
which this change does not touch and which passes 44/44 run alone.
|
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
Merge passMerged head
Test-only PR ( It closes a 15 s Left, LOW (Claude, not run): if the "New messages" button goes away between the script's |
…e 0.5.3 release (#3693) ## Change The low-priority review findings left for after the 0.5.3 release, from the reviews of #3653, #3654, #3656, #3663, #3666, #3668 and #3682. One commit each: **Product (changelog fragment `post-release-lows.md`)** - `fix(opencode)`: a verified pane keeps the right OpenCode pid. A pid herdr did not report is unknown, not `-1`; an older verification ending after a newer one does not put its older pid back, nor a pid over the newer one's empty reading; a read with nothing in front clears the pid, as before. (#3653; the #3653 suggestion to keep the pid on an empty read was dropped in review: a still-running pid is no proof it is the pane's job.) - `fix(opencode)`: a known OpenCode pid is followed up its parents to the shell, so a shell with more than 256 processes still finds its stopped OpenCode. Checked on a real `/proc` with 301 children. (#3653) - `fix(ssh)`: a failed forward's error leaves out the lines `ssh -v` writes without the debug prefix (`Authenticated to`, transfer totals, some builds' banner). (#3666) - `fix(ci)`: the runner route asks the Actions API again only after a server error or no answer (a 4xx ends it), each attempt bounded to a minute. (#3682) **Tests and docs** - `test(ssh)`: which ssh's word a forward waits for is its own function, with a test for Git for Windows', Windows' own and other OpenSSH. (#3666) - `test(chat-fallback)`: the two waits on the chat's callbacks fail with a reason after 10 s instead of hanging. (#3668) - `test(copilot-chat)`: New messages is looked up and clicked in one page step. (#3654) - `test(machines)`: the tunnel fixture matches a relay by both of its ports. (#3663) - `test(pages)`: the stale-deploy gate is checked on the parsed `pages.yml`. (#3656) - `docs(pages)`: `docs/development.md` describes the `current` / `deploy` split. (#3656) Left out on purpose: a test seam for `MachineManager.verify` (60 tests already reach its privates the same way), cancelling the move-badge read in `MachineManager.stop()` (its answer is already dropped and the read is bounded at 30 s), and `quietPort` across processes (a 1-in-~12k pick collision; it needs cross-process claims). Workflow changes from those reviews wait for the owner. ## Validation - Each commit's own tests (ssh 35, opencode/status 443, route 25, pages 57, machine tunnel 70) and `bun run typecheck`: pass. - `scripts/chat-fallback-browser-qa.ts`: pass locally. `scripts/copilot-chat-browser-qa.ts`: **not run locally** (this host's node names the fixture process `MainThread`, so the script stops before the changed line); CI runs it. - `bun run check fast` on the branch rebased onto 1f4368e: pass (16152 pass, 0 fail).
Change
Fixes a flaky browser script,
scripts/copilot-chat-browser-qa.ts, which timed out waiting forFollow-up answer.(TimeoutError: waitFor: Timeout 15000ms exceeded). In about 30 h of CI, 10 runs needed a second attempt for it: 9 at that wait and 1 at the next turn,Autopilot finished this task.. The latest was run 42954642665.Cause
A race in the script, not a product bug. Before the follow-up turn is written, the script opens the shell tool's whole output. The chat treats that as reading (#1388): it stops following the end and shows "New messages" for turns that arrive. The list draws rows only within 400 px of the view, so the answer row was never created and the wait could not find it. Whether the row landed inside that window depended on where the list settled after the clicks.
A failure traced in the self-hosted CI runner image shows this:
Follow-up prompt, 886 px above the end.The CI logs show no conversation-read failures either.
Fix
The script waits for either the answer or the pane's own "New messages" button. If the button shows, it clicks it as a reader would, then waits for the answer. Back at the end, the chat follows the next turn too. No sleep, no longer timeout, no product change.
Validation
herdr-ci-runner:local, the script ran next to three other looping browser scripts, withmain's script and the fixed one alternating in the same container:mainfailed 7 of 30 runs, all atFollow-up answer.; the fix passed 30 of 30. The final version, which looks for the button only inside the chat's own pane, passed 15 of 15, 2 of them through New messages.#3504(merged before every failure) did not fix this, and no open PR touches the script.bun run check faston this branch, rebased on main fbcf093: every step passed except one unit test unrelated to this change,server/pc-install.test.ts"starting a stopped server again as it was > starts nothing when its address is taken by a live server, and keeps its log this account's alone" (:1079). This diff does not touch that file, so it is the same as onmain. Run alone it failed 1 of 5 times, so it is a separate flake; it is being tracked on its own.check full, other browser scripts. Test-only, so no changelog fragment.