Skip to content

fix: handle copilot-cli Edit mode in E2E interactive sessions#782

Merged
alishakawaguchi merged 3 commits intomainfrom
fix/e2e-copilot-edit-mode
Mar 26, 2026
Merged

fix: handle copilot-cli Edit mode in E2E interactive sessions#782
alishakawaguchi merged 3 commits intomainfrom
fix/e2e-copilot-edit-mode

Conversation

@alishakawaguchi
Copy link
Copy Markdown
Contributor

@alishakawaguchi alishakawaguchi commented Mar 26, 2026

What broke

TestInteractiveAttributionMultiCommitSameSession flaky timeout for copilot-cli on commit b752a11. The second prompt was typed into copilot-cli's "Edit" mode where Enter inserts a newline instead of submitting. The agent never started processing, causing a 90s timeout.

What was fixed

Added CopilotSession wrapper around TmuxSession that detects Edit mode (via "ctrl+s" in the status bar) and falls back to sending Ctrl+S when Enter doesn't submit. This handles copilot-cli's non-deterministic mode switching between Chat and Edit modes after completing a prompt.

Notes

Auto-generated fix from e2e failure on b752a11 (main)
Failed agent: copilot-cli


Note

Low Risk
Low risk: change is isolated to E2E copilot-cli interactive harness and only alters how prompts are submitted, with minimal impact outside test execution.

Overview
Fixes flakiness in copilot-cli interactive E2E sessions by introducing a CopilotSession wrapper that handles Copilot CLI’s non-deterministic Chat vs Edit input modes.

After sending a prompt and Enter, the session now detects Edit mode via the ctrl+s status hint and sends Ctrl+S to submit when needed; StartSession returns this wrapper instead of the raw TmuxSession.

Written by Cursor Bugbot for commit b18b3b8. Configure here.

Copilot CLI has two input modes: Chat mode (Enter submits) and Edit mode
(Ctrl+S submits). After completing a prompt, copilot may non-deterministically
return to Edit mode, causing the Enter key in TmuxSession.Send() to insert a
newline instead of submitting. This caused flaky timeouts in
TestInteractiveAttributionMultiCommitSameSession.

Add CopilotSession wrapper that detects Edit mode via the "ctrl+s" status bar
indicator and falls back to sending Ctrl+S when Enter doesn't submit.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: 70c848648358
Copilot AI review requested due to automatic review settings March 26, 2026 00:55
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves the reliability of copilot-cli E2E interactive sessions by handling Copilot CLI’s non-deterministic switch between “Chat” (Enter submits) and “Edit” (Ctrl+S submits) modes, preventing tests from hanging when Enter inserts a newline instead of submitting.

Changes:

  • Introduces a CopilotSession wrapper around TmuxSession that overrides Send to detect Edit mode and send Ctrl+S when needed.
  • Updates CopilotCLI.StartSession to return the new wrapper session type for interactive runs.

alishakawaguchi and others added 2 commits March 25, 2026 18:23
- Match full "ctrl+s run command" phrase in status bar lines only (last 3
  lines) to avoid false positives from agent output
- Replace fixed 500ms sleep with 50ms poll loop that breaks early when
  content changes (submission started) or Edit mode is detected

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: 1840e82115a0
…ssions

Copilot CLI's slash-command autocomplete can non-deterministically trigger
when text containing "/" is typed (e.g. "docs/red.md"). When this happens,
the prompt gets stuck in the autocomplete dropdown and times out.

Fix: detect the autocomplete menu after sending input, dismiss it with
Escape + Ctrl+U, and retry. Also use tmux send-keys -l (literal) to
prevent tmux from interpreting prompt characters as special key names.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: 3df16573a469
@alishakawaguchi alishakawaguchi marked this pull request as ready for review March 26, 2026 03:54
@alishakawaguchi alishakawaguchi requested a review from a team as a code owner March 26, 2026 03:54
@alishakawaguchi alishakawaguchi merged commit b5711e2 into main Mar 26, 2026
9 checks passed
@alishakawaguchi alishakawaguchi deleted the fix/e2e-copilot-edit-mode branch March 26, 2026 04:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants