Skip to content

test(webui): wait for the fork title's suggestion before typing it - #247

Merged
modacker merged 1 commit into
webuifrom
test/webui-fork-title-prefill-race
Oct 23, 2026
Merged

modacker merged 1 commit into
webuifrom
test/webui-fork-title-prefill-race

Conversation

@modacker

Copy link
Copy Markdown
Collaborator

The forked session's title came out as the suggested title with the typed name appended to it:

"title": "1 - Message actions before refresh.synthetic-message-fork"

instead of "synthetic-message-fork".

Playwright's fill() is not one assignment on a text input. The injected fill() falls through to selectText(element) and answers "needsinput", and the server then inserts the text with keyboard.insertText() in a second round trip. The suggested title arrives with the fork options, so it can land between those two steps. The HTML value setter moves the text entry cursor position to the end of the control, so the selection collapses and the insert appends to the suggestion instead of replacing it.

The client is right to keep a name a person typed: the late reply is skipped once the field has been edited. But this case typed nothing until the suggestion had already landed, and it typed through fill()'s two steps, so the suggestion was still unwritten when the guard looked at it.

Wait for the fork options' reply, and for the suggestion to be in the field, before typing. The assertion is unchanged: the fork request must carry the typed name and must not carry the suggestion.

The forked session's title came out as the suggested title with the typed
name appended to it: "1 - Message actions before refresh.synthetic-message-fork"
instead of "synthetic-message-fork".

Playwright's fill() is not one assignment on a text input. The injected
fill() falls through to selectText() and answers "needsinput", and the
server then inserts the text with keyboard.insertText() in a second round
trip. The suggested title arrives with the fork options, so it can land
between those two steps. The HTML value setter moves the text entry cursor
position to the end of the control, so the selection collapses and the
insert appends to the suggestion instead of replacing it.

The client is right to keep a name a person typed: the late reply is
skipped once the field has been edited. But this case typed nothing until
the suggestion had already landed, and it typed through fill()'s two steps,
so the suggestion was still unwritten when the guard looked at it.

Wait for the fork options' reply, and for the suggestion to be in the field,
before typing. The assertion is unchanged: the fork request must carry the
typed name and must not carry the suggestion.
@modacker
modacker merged commit f0ec72c into webui Oct 23, 2026
8 checks passed
@modacker
modacker deleted the test/webui-fork-title-prefill-race branch October 23, 2026 18:32
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