Skip to content

test(copilot): take the follow-up turn through New messages when the opened output left the end - #3654

Merged
devswha merged 1 commit into
mainfrom
fix/copilot-chat-qa-flake
Nov 11, 2026
Merged

devswha merged 1 commit into
mainfrom
fix/copilot-chat-qa-flake

Conversation

@devswha

@devswha devswha commented Nov 11, 2026

Copy link
Copy Markdown
Owner

Change

Fixes a flaky browser script, scripts/copilot-chat-browser-qa.ts, which timed out waiting for Follow-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:

  • The server was right: its change push came 52 ms after the append, and the next read returned the turn.
  • The page showed "New messages", and its drawn rows stopped at 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

  • In herdr-ci-runner:local, the script ran next to three other looping browser scripts, with main's script and the fixed one alternating in the same container: main failed 7 of 30 runs, all at Follow-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 fast on 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 on main. Run alone it failed 1 of 5 times, so it is a separate flake; it is being tracked on its own.
  • Not run: check full, other browser scripts. Test-only, so no changelog fragment.

…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.
@coderabbitai

coderabbitai Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Tests
    • Browser-based chat checks now account for a visible “New messages” prompt after a follow-up message, opening it before checking for the response. This improves validation of follow-up conversations when the response appears behind that prompt. No user-facing product behavior is changed by this update.

The browser QA test now waits for the follow-up answer or a visible “New messages” button. If the button appears, the test clicks it before waiting for the answer.

Changes: Copilot chat browser QA

Layer / File(s) Summary
Follow-up answer check
scripts/copilot-chat-browser-qa.ts
After adding the follow-up turn, the test waits for the answer or the “New messages” button. If the button is visible, it clicks the button and then waits for the answer.

Estimated code review effort: 2 (Simple) | ~5 minutes

Change: Other

Possibly related PRs

Suggested reviewers: yuuuxie

Merge Risk: Minimal · up to b41a0

This is a test-only change that makes a flaky browser QA script more reliable. It does not affect product behavior, so merge risk is minimal.

Pre-merge checks: Passed 5

Check name Status Explanation
Title check Passed The title clearly identifies the test change: handling the Copilot follow-up turn through the "New messages" control when the output no longer follows the end.
Description check Passed The description includes the required Change and Validation sections. It explains the flaky behavior, cause, fix, test results, skipped checks, unrelated test failure, and why no changelog fragment is…
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description includes the required Change and Validation sections. It explains the flaky behavior, cause, fix, test results, skipped checks, unrelated test failure, and why no changelog fragment is needed.

Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 1 files.

Finishing Touches

Generate docstrings

  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between fbcf093 and b41a064.

Files selected for processing: 1

  • scripts/copilot-chat-browser-qa.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review.

@devswha
devswha merged commit 856ef33 into main Nov 11, 2026
13 checks passed
@devswha

devswha commented Nov 11, 2026

Copy link
Copy Markdown
Owner Author

Merge pass

Merged head b41a06434e3d as 856ef33a10ad on GitHub's checks, with no unresolved review threads.

Reviewer Verdict Note
claude CLEAR
codex CLEAR

Test-only PR (scripts/copilot-chat-browser-qa.ts, seven lines). Two reviewers at this head: Claude (Opus) CLEAR, Codex Terra CLEAR with no findings.

It closes a 15 s waitFor flake in that browser script: opening the shell tool's whole output counts as reading, so the follow-up answer arrived under "New messages" and its row was never drawn. The author's runs in the runner image were 7 of 30 failed on main and 0 of 30 with the fix. The evidence that the script passes at this head is its own Browser regression job.

Left, LOW (Claude, not run): if the "New messages" button goes away between the script's isVisible() and its click, the click waits its full 15 s; a far narrower window than the flake it replaces. Sent to the author's lane.

@devswha
devswha deleted the fix/copilot-chat-qa-flake branch November 11, 2026 08:45
devswha added a commit that referenced this pull request Nov 12, 2026
…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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant