Repository navigation
Live dictation test: wait for the box to empty after Send, and answer the composer's reads - #2911
Merged
Merged
Conversation
… the composer's reads "Send while listening stops, waits for the last words, and sends them in one press" failed the 1.2.10 publish: it read the box straight after seeing the message sent, and found the whole message still there. The composer empties its state before it hands the message on, but the box's text is written by prompt-area's own effect a few scheduler turns later, so the test raced it. It now waits for the box to empty, as it waits for everything else. The file also let the composer's free-trial line read the plan and the signed-in person for real, at port 80 on the runner: two ECONNREFUSED per test. Those reads are answered in the test now, as a self-hosted OpenBot answers them, and any other request fails the test that made it.
davidmckayv
marked this pull request as ready for review
December 3, 2026 23:35
davidmckayv
requested review from
MikeRyanDev,
dustywusty,
guidovizoso,
mxmzb,
samjulien and
tylerslaton
as code owners
December 3, 2026 23:35
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
A test-only fix for the flake that failed the 1.2.10 publish:
app/tests/composer-live-dictation.test.tsx, "default desktop: Send while listening stops, waits for the last words, and sends them in one press", which read the whole message still in the box (Expected: "",Received: "Existing draft book a table for two tonight").Why it was flaky. The test saw the message sent, then read the box at once. The composer empties its state before it hands the message on, but prompt-area writes the box's text in its own effect, a few of React's scheduler turns after
onSubmitruns. ThewaitForon the sent message can resolve on a DOM change in between, while the box still shows the words, and after that the test only had twosetTimeout(0)drains (fromwaitForandfindByRole) before it read the box. Whether React's turns land before those drains is down to timing, so on a busy runner the read came first. The product is fine: the box empties a moment later. The race is inside the test itself: it reproduces with the file run alone, so nothing leaks in from another test.The ECONNREFUSED in the log are real, but they are not the cause. Every test in the file made two real requests to port 80 on the runner: the composer's free-trial line (
TrialNote) reads the plan (/api/v2/organizations/default/plan) and the signed-in person (/people/me), and the page is addressed athttp://127.0.0.1/. Passing tests logged them too, and the race happens with those requests answered.The changes:
await waitFor(...)), as it waits for everything else.plan-free-trial.test.tsxanswers its own: no plan needed and a member signed in, as a self-hosted OpenBot answers. Any other request fails the test that made it. The file no longer touches the network.No app code changes.
Where it runs
Test only. Answers to the checklist: none on every point.
Boundary and audit
API and database
api/, no app's requests, no database change and norelease-policy.json.Changelog
none
Proof
Red before, green after, made deterministic. A busy runner delays React's scheduler. To get that without loading the machine, a scratch preload (put first, so it runs before
app/tests/react-teardown.tscapturessetImmediate) makes each immediate the scheduler posts wait 3 ms:Expected: ""/Received: "Existing draft book a table for two tonight".waitForchange, still failed both tests, which is how the requests were ruled out as the cause.Repeat runs (this branch):
bun test app/tests/composer-live-dictation.test.tsx --rerun-each=30: 570 pass, 0 fail, 0 ECONNREFUSED.--randomize --seed=20261203): 2690 tests ran, 1 failure, and it is in another file.composer-live-dictation.test.tsxpassed every test there, with 0 ECONNREFUSED. The failure is "New Bot is a fixed action outside the auto-highlighted recipient options" inchannel-new-error-state.test.tsx. That file is untouched here and fails the same way run alone with that seed, so it depends on test order inside its own file. CI doesn't shuffle, so it isn't the 1.2.10 flake. It is left for its own fix.--seed=7):composer-live-dictation.test.tsxpassed again, with 0 ECONNREFUSED. The one failure was again inchannel-new-error-state.test.tsx("+ with only one Bot opens To: empty, ..."), and it fails the same way with that file run alone with seed 7.biome format,biome lint --error-on-warningsand the app'stsc --noEmitare clean.There is no screen to show: nothing under
app/srcchanges, so there are no Chrome or Safari screenshots.