Skip to content

e2e: handle assistant AskUser prompts and NES edit batching in the @ai tests - #18380

Merged
gtritchie merged 4 commits into
mainfrom
test/guardrail-outside-write-askuser
Jul 28, 2026
Merged

gtritchie merged 4 commits into
mainfrom
test/guardrail-outside-write-askuser

Conversation

@gtritchie

Copy link
Copy Markdown
Member

Two failures from a full --grep @ai run against 2026.08.0-daily+144 with Posit Assistant 0.7.8.

Filesystem guardrails, test 3 (write outside the project)

The assistant pauses on an AskUser question ("Write outside project folder") instead of running the writeLines() call, and the test passed no answer, so pollWithAllowDialogs failed with "paused on a question and no answer was configured".

The prompt now tells the assistant not to ask, and the test answers affirmatively if it asks anyway, so .rs.chat.withGuardrails is still what denies the write. The affirmative matcher is shared with test 4 (rename to outside the project) and rejects redirect options: something like "Yes, write it inside the project instead" opens with an affirmative but performs an allowed in-project write, which would satisfy test 4's file assertions without the guardrail being consulted. An option set where nothing matches raises an error listing the options the assistant offered.

Code suggestions, NES multiple renames

Copilot batched the last three call-site renames into one multi-edit accept, so the document was fully renamed after two accepts. The loop asked for a third: its guard wait saw the outgoing preview, acceptNesRename re-checked the same locators after the teardown, and the test failed on a 30s timeout waiting for a suggestion that was no longer needed.

The loop now runs on the call sites still holding the old name rather than a count of accepts, and acceptNesRename owns the only wait for a suggestion. A timeout there is logged and falls through to the occurrence assertions, which name the call site that is still wrong. Those assertions also check that each fn(score) form is gone, so a suggestion that duplicates a call instead of replacing it fails.

Verification

Both tests pass on macOS desktop against that daily build. The failures are nondeterministic -- they depend on whether the assistant asks before acting and on how the provider batches NES edits -- so a green run does not by itself exercise the changed paths. The run log shows which path ran: Answered pending assistant question with ... for the guardrail test, and Accepted N NES suggestion(s) with the per-round remaining-occurrence list for the NES test.

Test-only change, so no NEWS.md entry.

The assistant now pauses on an AskUser question before writing outside the
project, so the test threw "paused on a question and no answer was
configured". Tell it not to ask, and answer affirmatively if it does, so
the R guardrail is still what denies the write.

Shares the affirmative matcher with test 4, which needs the same answer.
Copilot batched the last three call-site renames into one multi-edit
accept, so the document was fully renamed after two accepts. The loop
still asked for a third: its guard wait saw the outgoing preview,
acceptNesRename re-checked after the teardown, and the test failed on a
30s timeout waiting for a suggestion that was no longer needed.

Drive the loop off the remaining old-name occurrences and let
acceptNesRename own the only wait. If it does time out, report it and
fall through to the occurrence assertions, which name the missing call
site instead of dumping a combined-locator timeout.
"Yes, write it inside the project instead" opens with an affirmative but
performs an allowed in-project write, so the guardrail is never consulted
and test 4's file assertions pass anyway. Require the option's accessible
name -- label plus description -- not to relocate the operation into the
project.
A suggestion that duplicated a call instead of replacing it would satisfy
the positive check for the renamed form, exit the loop, and pass the final
assertions with the old call still in the document. Filter on the old form
and assert it is gone.
@gtritchie gtritchie added this to the 2026.08 (Yellow Yarrow) milestone Jul 28, 2026
@gtritchie
gtritchie merged commit 603c6c9 into main Jul 28, 2026
1 of 2 checks passed
@gtritchie
gtritchie deleted the test/guardrail-outside-write-askuser branch July 28, 2026 16:35
@posit-snyk-bot

posit-snyk-bot commented Jul 28, 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.

@github-actions

Copy link
Copy Markdown

RStudio E2E - all platforms

All tests passed!

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

Passed Failed Skipped Flaky
1873 0 375 2
Platform ✅ Passed ❌ Failed ⚠️ Skipped 🔁 Flaky
✅ desktop-linux 461 0 97 0
✅ desktop-macos 464 0 94 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 8b9d1ddce6d6301eb44b289f41d24c8541b6743a - Run #370

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