Skip to content

[Bug]: Ctrl+G external-editor failure can silently discard saved prompt text #5188

Open

Description

@magoel

Description

Using Ctrl+G from the normal composer to edit a long prompt in Vim can result in the saved prompt text being missing when control returns to Copilot CLI. This has occurred repeatedly but is not deterministic.

Environment

  • Copilot CLI: 1.0.98
  • OS: macOS arm64
  • Editor: Vim

Observed workflow

  1. From the normal composer, press Ctrl+G.
  2. Enter a long prompt in Vim.
  3. Save and exit with :wq.
  4. Return to the composer.

The newly entered text is missing. In an occurrence, the two temporary prompt files were no longer present afterward, and the session draft/history did not contain the text. No visible failure was reported.

Expected behavior

A successful editor save should populate the composer. If the editor exits unsuccessfully or the file cannot be read back, Copilot CLI should retain a recoverable copy and show an error with its recovery location rather than silently discarding the text.

Actual behavior

Prompt text was missing after returning from Vim, with no visible failure report and no remaining temporary copy available for recovery.

Investigation notes

A read-only local investigation indicates that the normal composer imports content only when the external editor operation succeeds, does not surface a nonzero editor exit as an error, and cleans up the temporary file. The incident exit code is unknown; this does not establish the exact cause.

An isolated Vim :wq test using harmless text and -i NONE succeeded with exit code 0, so the exact user trigger was not deterministically reproduced.

Workaround

Before :wq, save a separate permanent copy with :write <backup-path>.

Suggested diagnostics and test

Please consider recording sanitized editor exit status/signal, readback outcome, and the composer state update, and retaining a recovery copy until import is confirmed.

Hypothesis-only maintainer test idea (not executed): use an editor wrapper that writes the prompt file and then exits nonzero; verify that the composer reports the failure and retains the content for recovery.

Related: #5004 concerns Ctrl+G cancelling an ask_user question. This report concerns the normal composer and saved prompt text loss.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:input-keyboardKeyboard shortcuts, keybindings, copy/paste, clipboard, mouse, and text input

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions