Skip to content

e2e: answer Posit Assistant AskUser prompts in chat guardrail tests - #18372

Merged
gtritchie merged 1 commit into
mainfrom
test/chat-guardrails-askuser
Jul 27, 2026
Merged

gtritchie merged 1 commit into
mainfrom
test/chat-guardrails-askuser

Conversation

@gtritchie

Copy link
Copy Markdown
Member

Posit Assistant 0.7.8 can pause a turn on an AskUser question instead of acting. The question renders as a form (Pending questions tab strip, radio options, Submit Answers) and the turn stays active until it is answered, so pollWithAllowDialogs -- which waits for the stop button to disappear -- spun until the test timeout.

This showed up as 4: rename from project to outside is denied in chat-guardrails.test.ts failing with a 120s timeout: asked to rename a file to a path outside the project, the assistant asked for confirmation rather than calling file.rename() and hitting the R guardrail.

Changes:

  • chat_pane.page.ts: role-based locators for the question form (pendingQuestions, submitAnswersBtn) and an isPendingQuestionVisible() probe.
  • chat_pane.actions.ts: answerPendingQuestion() selects a matching option and submits, waiting for the form to unmount. pollWithAllowDialogs() takes an optional answerQuestion matcher; without one, a pending question throws immediately with the question text instead of spinning to the timeout.
  • chat-guardrails.test.ts: test 4 pins the prompt to R's file.rename() -- the assistant's own file tools and shell commands are not subject to .rs.chat.withGuardrails, so an unpinned prompt can move the file for real -- and answers affirmatively if asked, since declining would leave the file in place and pass the assertions without exercising the guardrail.

Test-only change; no NEWS entry.

Verification: npm run typecheck passes. These tests are gated on Posit AI credentials (requireAiCredentials), which CI does not provision, so they run locally only.

@gtritchie gtritchie added this to the 2026.08 (Yellow Yarrow) milestone Jul 27, 2026
@posit-snyk-bot

posit-snyk-bot commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues
✅ Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@gtritchie
gtritchie merged commit 873e8cd into main Jul 27, 2026
6 of 11 checks passed
@gtritchie
gtritchie deleted the test/chat-guardrails-askuser branch July 27, 2026 22:13
@github-actions

Copy link
Copy Markdown

RStudio E2E - all platforms

All tests passed!

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

Passed Failed Skipped Flaky
1890 0 357 3
Platform ✅ Passed ❌ Failed ⚠️ Skipped 🔁 Flaky
✅ desktop-linux 469 0 88 1
✅ desktop-macos 473 0 85 1
✅ desktop-windows 473 0 90 1
✅ server-linux 455 0 94 0
✅ setup 20 0 0 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 3882b5a4e3784c37a959519e198720eb57860470 - Run #360

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.

2 participants