microsoft / microsoft/intelligent-terminal

Autofix card not dismissed by Esc (intermittent; E2E-discovered)

Open
#346 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area-AgentPane Area-AutoFix Issue-Bug Needs-Tag-Fix
Dominant language
C++
Stars
2k
Forks
159
Avg merge
21h 42m
Merged PRs (30d)
120

Description

Discovered by the ItE2E end-to-end suite (test/e2e/), running against the Store package Microsoft.IntelligentTerminal_8wekyb3d8bbwe (v0.1.1681.0) with the copilot agent. Filing for triage — it is unclear yet whether this is a product bug or an E2E assertion weakness; both hypotheses are below.

Summary

The autofix suggestion card ("[ Run command ] / Insert in Terminal") sometimes fails to disappear after the user presses Esc. The E2E "reject/dismiss" check pressed Esc up to 5 times (800 ms apart) and the card text was still present, so the assertion that the card is gone failed.

This is intermittent: the same test has passed in prior runs (it is counted among the green feature cases in test/e2e/README.md), and failed in this session's run — i.e. it is flaky, which on its own is worth fixing because a release-gating E2E should be deterministic.

Failing test

  • File: test/e2e/tests/Feature.AutofixPane.Tests.ps1:41-43
  • Checklist item: doc/release-check-list.md §3 "Reject/dismiss works" (tagged [UT✓] [E2E]).
It 'Reject/dismiss works (Esc closes the card)' {
    for ($i = 0; $i -lt 5 -and (& $script:CardShown); $i++) { Send-AgentKey -App $script:app -Key Escape | Out-Null; Start-Sleep -Milliseconds 800 }
    (& $script:CardShown) | Should -BeFalse
}
# $script:CardShown = { (Get-AgentPaneText -App $app -MaxLines 60) -match 'Run command|Insert in Terminal' }

Observed vs expected

Expected After Esc (at most twice), the autofix card is dismissed and no longer rendered in the agent pane.
Observed After 5× Esc (4 s total), the pane buffer still matches Run command|Insert in Terminal. Assertion failed: Expected $false, but got $true at line 43.

Run evidence (this session): Tests Passed: 9, Failed: 1 for Feature.AutofixPane.Tests.ps1; the only failure was this case. All other autofix cases (render, insert, run, stashed, split, cleanup) passed.

Reproduction

pwsh -File test/e2e/Invoke-ItE2EReport.ps1 -Path test/e2e/tests/Feature.AutofixPane.Tests.ps1
# (requires the Store/Dev IT package installed + an authenticated `copilot` on PATH)

Because autofix de-dupes identical failures and a displayed card suppresses the next autofix, reproduction is timing-sensitive; re-run a few times.

Code pointers / hypotheses

The agent pane (wta-helper ratatui TUI) handles Esc as an ordered match with guards in App::handle_key (tools/wta/src/app.rs). The relevant arms, in evaluation order:

  1. KeyCode::Esc if self.show_notification_bannerdismiss_notifications()app.rs:6567
  2. KeyCode::Esc if recommendations().is_some() || (autofix.pane_id.is_some() && !turn.is_idle())turn_cancel() (dismisses the armed fix card) — app.rs:6570
  3. KeyCode::Esc if autofix.suggested_pane_id.is_some() → clears suggested_pane_idapp.rs:6606
  4. KeyCode::Esc =>clear_input()app.rs:6611

Because arm (1) precedes the card-dismiss arm (2), the first Esc only dismisses the notification banner; the card needs a second Esc. That matches the known "Esc needs up to 2 presses" behavior. But 5 presses still not clearing the card points to one of:

  • Hypothesis A — product bug: the bottom-bar notification banner (show_notification_banner) is re-raised every frame while the card is armed, so every Esc is consumed by arm (1) and arm (2) is never reached → the card is undismissable by Esc. If so, fix the arm ordering / guard so a single Esc that has an armed card routes to turn_cancel (or don't re-arm the banner while the card owns dismissal).
  • Hypothesis B — E2E false positive: Esc does dismiss the active card, but the dismissed card leaves its text ("Run command" / "Insert in Terminal") in the chat transcript / scrollback, so the CardShown regex over the last 60 lines still matches stale text. If so, the test should assert on the active card region (e.g. the bordered card / button row) rather than a substring of the whole buffer — and the product is fine.

Triage should determine which. A quick check: after pressing Esc, capture the pane and see whether the matched text is inside the live card border or in the scrolled-back transcript.

Suggested labels

Issue-Bug, Area-AutoFix, Area-AgentPane

Notes for whoever picks this up

  • Related UT (logic half is unit-covered): trigger_echo_pane_clears_when_state_returns_to_idle and turn_cancel in tools/wta/src/app.rs. The gap is specifically the interactive Esc → dismiss path end-to-end.
  • If Hypothesis B is confirmed, please also update test/e2e/tests/Feature.AutofixPane.Tests.ps1:41-43 to scope CardShown to the active card so the E2E stops flaking.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with tools/wta/src/app.rs:6567-6611 and the Esc handling order, then run test/e2e/Invoke-ItE2EReport.ps1 -Path test/e2e/tests/Feature.AutofixPane.Tests.ps1. Capture the pane after Esc to determine whether the active card remains or only stale transcript text matches. Done means identifying whether the product or Feature.AutofixPane.Tests.ps1:41-43 needs correction and making the reject/dismiss check deterministic.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell, rust
Domain
cli, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.