Skip to content

Match chat messages by role testid, not data-message-id - #18781

Merged
gtritchie merged 1 commit into
mainfrom
fix/e2e-message-locator-turn-footer
Sep 10, 2026
Merged

gtritchie merged 1 commit into
mainfrom
fix/e2e-message-locator-turn-footer

Conversation

@gtritchie

Copy link
Copy Markdown
Member

Intent

The Posit Assistant chat suite fails on every platform against PA 1.4.0. The release gate
run for 1.4.0 (34528484543)
failed six tests on Linux, macOS and Windows, on every retry:

  • chat-messaging.test.ts:50 multi-turn conversation
  • chat-guardrails.test.ts:206 write to project directory is allowed
  • chat-user-skills.test.ts:243 both custom skills are discovered
  • conversation-history.test.ts:23 history preserves and restores conversations
  • detachable-sidebar.test.ts:29 conversation continuity across detach and reattach
  • shiny-app-r.test.ts:110 create and run R Shiny tip calculator

ChatPane.messageItem was [data-message-id]. That is an application attribute the
assistant stamps on anything tied to a message, not a marker for messages, and PA 1.4.0
(posit-dev/assistant#2395) began stamping it on a per-turn footer rendered as a sibling
after the message row. messageItem.last() therefore resolved to a cost and timing row:

Expected substring: "23"
Received string:    "8:54 PM"
locator resolved to <div class="-mt-3 mb-4" data-testid="turn-footer-row" data-message-id="…">

The same shift made isLastMessageSubstantive() read those footers as non-substantive,
so askAssistant reported the failures as the provider appears to be dropping turns mid-stream — which sent triage after a provider problem that did not exist.

Approach

Match the two hooks that mark message content — the ChatMessage row wrapper, which
carries the role testid, and the MessageRenderer content div nested inside it:

'[data-testid="chat-message-user"], [data-testid="chat-message-assistant"], [data-message-id].message-content'

Both hooks are present unchanged in the released assistant and in 1.4.0, so the matched
set is identical against the current GA build and the suite runs against either. Being an
allowlist keyed on what a message is, rather than on a shared id, it also does not admit
whatever gets decorated with data-message-id next.

Both clauses are load-bearing:

  • The content div carries the assertion. Scoping to the row instead would pull in
    TurnRetryCallout, whose "Retry" / "Continue" button text counts as reply content in
    isLastMessageSubstantive() — reporting a genuinely dead turn as substantive and
    disabling the retry that predicate exists to trigger.
  • The row wrapper keeps the count complete. Messages that render no MessageRenderer
    (application events, attachment-only) have no content div, and would drop out of
    getMessageCount() so waitForResponse waits on growth that never arrives.

conversation-history.test.ts built the same locator inline twice, bypassing the page
object; those now use chatPane.messageItem so there is one definition to keep correct.

Automated Tests

This is a change to the test suite. Verified by driving Chromium against fixtures of both
DOM shapes, built from ChatMessage.tsx, MessageRenderer.tsx and ConversationViewport.tsx
at the released and 1.4.0 tags, using the selector read back out of the edited file:

Scenario before after
Released assistant, normal turn count 4, last = reply content unchanged: count 4, last = reply content
1.4.0, normal turn count 5, last = "8:54 PM" footer count 4, last = reply content
1.4.0, dead turn with retry callout last = footer last = empty content, substantive false, retry still fires
1.4.0, application-event message last = footer last = row, message still counted

npm run typecheck in e2e/rstudio passes.

Not yet confirmed by a live suite run — that needs the gate, which can run against the
1.4.0 build already published to the test manifest.

QA Notes

None. Test-only change; no product code is touched.

Documentation

None required.

Checklist

  • If this PR adds a new feature, or fixes a bug in a previously released version, it includes an entry in NEWS.md
  • If this PR adds or changes UI, the updated UI meets accessibility standards
  • A reviewer is assigned to this PR (if unsure who to assign, check Area Owners list)
  • This PR passes all local unit tests

PA 1.4.0 (#2395) added a per-turn footer that carries data-message-id and
renders after the message row, so messageItem.last() resolved to a cost and
timing row reading "8:54 PM" instead of the reply. Every chat test that
asserts on the last message failed on all three platforms, and the dead-turn
detector read those footers as non-substantive, reporting them as the provider
dropping turns mid-stream.

Match the ChatMessage row wrapper and the MessageRenderer content div instead,
so the locator tracks what a message is rather than what shares its id. The
matched set is unchanged against the currently released assistant, so the
suite runs against both it and the pre-release builds the gate exercises.

Route the two inline [data-message-id] locators in conversation-history
through the page object so there is one definition to keep correct.
@github-actions

Copy link
Copy Markdown

RStudio E2E - all platforms

All tests passed!

#################### 100% pass rate

Passed Failed Skipped Flaky
2674 0 193 4
Platform ✅ Passed ❌ Failed ⚠️ Skipped 🔁 Flaky
✅ auth-teardown 2 0 10 0
✅ desktop-linux 675 0 38 0
✅ desktop-macos 671 0 42 1
✅ desktop-windows 677 0 39 3
✅ server-linux 621 0 44 0
✅ setup 28 0 20 0
View / download the full report

View report online -- opens in the browser, no download needed. Available for 14 days.

Download playwright-report.zip -- extract and open index.html

Includes screenshots, traces, and step-by-step details for every test. Expires in 15 days.


All platforms - commit 647bfa35bd8846b1fdf9ec5c07b76d9c475ab2ca - Run #935

@gtritchie
gtritchie merged commit 9bae5ac into main Sep 10, 2026
34 checks passed
@gtritchie
gtritchie deleted the fix/e2e-message-locator-turn-footer branch September 10, 2026 23:36
gtritchie added a commit that referenced this pull request Sep 12, 2026
* Match chat messages by role testid, not data-message-id (#18781)

PA 1.4.0 (#2395) added a per-turn footer that carries data-message-id and
renders after the message row, so messageItem.last() resolved to a cost and
timing row reading "8:54 PM" instead of the reply. Every chat test that
asserts on the last message failed on all three platforms, and the dead-turn
detector read those footers as non-substantive, reporting them as the provider
dropping turns mid-stream.

Match the ChatMessage row wrapper and the MessageRenderer content div instead,
so the locator tracks what a message is rather than what shares its id. The
matched set is unchanged against the currently released assistant, so the
suite runs against both it and the pre-release builds the gate exercises.

Route the two inline [data-message-id] locators in conversation-history
through the page object so there is one definition to keep correct.

(cherry picked from commit 9bae5ac)

* Tolerate U+200E in the skill-selection e2e assertion (#18782)

Posit Assistant 1.4.0 began prefixing every tool-call caption with U+200E
(LEFT-TO-RIGHT MARK) so that an rtl-truncated file path keeps its leading
slash on the left, in posit-dev/assistant d6d3901e7.

JavaScript's \s character class spans \u2000-\u200a and so does not match
U+200E. The assertion therefore failed against a rendered string that is
visually identical to what it expected, deterministically on Windows,
Linux and macOS in the 1.4.1 release gate.

Match the mark explicitly. The class also accepts the bare whitespace that
1.3.1 and earlier emit, so the test passes against both released versions.

(cherry picked from commit 904450a)

* e2e: keep a slow posit ai sign-in from failing the whole shard (#18780)

A slow redirect after submitting the password on login.posit.cloud was
classified as a credential failure (the step was marked fatal), which
failed the auth setup project and left every dependent test as "did not
run". Click with noWaitAfter so the 30s URL wait owns that budget instead
of the runner's 10s actionTimeout, and only treat the step as fatal when
the page actually shows a rejection message; a stalled redirect now falls
through to the transient path and the @ai tests skip.

Also give the readline-notification test the same settle window the rest
of the suite gives an assistant turn (the agent keeps working after
readline() returns), size its timeout for two turns, and spell out in the
prompt that the code must be run with the executeCode tool rather than
written to a file.

(cherry picked from commit 2309310)

---------

Co-authored-by: Kevin Ushey <[email protected]>

This branch was previously deployed

1 inactive deployment
e2e-playwright — 647bfa35 Deployed Sep 10, 2026 by gtritchie via windows / e2e-desktop-windows (6) #935
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