fix: handle copilot-cli Edit mode in E2E interactive sessions#782
Merged
alishakawaguchi merged 3 commits intomainfrom Mar 26, 2026
Merged
fix: handle copilot-cli Edit mode in E2E interactive sessions#782alishakawaguchi merged 3 commits intomainfrom
alishakawaguchi merged 3 commits intomainfrom
Conversation
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
Contributor
There was a problem hiding this comment.
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
CopilotSessionwrapper aroundTmuxSessionthat overridesSendto detect Edit mode and sendCtrl+Swhen needed. - Updates
CopilotCLI.StartSessionto return the new wrapper session type for interactive runs.
- 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
evisdren
approved these changes
Mar 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What broke
TestInteractiveAttributionMultiCommitSameSessionflaky 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
CopilotSessionwrapper aroundTmuxSessionthat 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-cliinteractive harness and only alters how prompts are submitted, with minimal impact outside test execution.Overview
Fixes flakiness in
copilot-cliinteractive E2E sessions by introducing aCopilotSessionwrapper 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 thectrl+sstatus hint and sendsCtrl+Sto submit when needed;StartSessionreturns this wrapper instead of the rawTmuxSession.Written by Cursor Bugbot for commit b18b3b8. Configure here.