Skip to content

feat(chat): undo and edit an aborted first turn - #747

Open
wyx20021207-create wants to merge 1 commit into
agegr:mainfrom
wyx20021207-create:fix/undo-first-turn-746
Open

feat(chat): undo and edit an aborted first turn#747
wyx20021207-create wants to merge 1 commit into
agegr:mainfrom
wyx20021207-create:fix/undo-first-turn-746

Conversation

@wyx20021207-create

Copy link
Copy Markdown

Fixes #746

Summary

Add an “Undo and edit” action for a mistaken first prompt after generation has been stopped.

  • Restore the original text and image attachments to the existing composer.
  • Permanently discard the first user message and its aborted assistant reply.
  • Keep the same session, working directory, and initial settings.
  • Do not create a new session or preserve a history branch.
  • Run directly on click, without a browser confirmation dialog.
  • Reuse the existing composer rather than introducing an inline message editor.

Scope and safety

This is limited to an original, unbranched first turn with one user message and one aborted assistant reply containing only text/thinking.

  • Reject completed turns, later turns, tool calls, and dependent history.
  • Reject running sessions, queued prompts, and active background work.
  • Refuse to overwrite an existing composer draft.
  • Restore the input before the destructive request.
  • Shut down the session wrapper before atomically replacing the file.
  • Reject the operation if the session changes during shutdown.
  • Preserve initial session metadata and configuration.

This operation does not undo filesystem changes or external side effects.

Testing

  • 6 targeted tests pass, including a real SessionManager undo/reopen/resend round-trip.
  • TypeScript checks and lint pass.
  • Full test suite on the standalone PR branch (Windows): 940 passed, 14 failed, 5 skipped. The same 14 failures were previously reproduced on untouched upstream.

Documentation

Document eligibility, destructive semantics, concurrency safeguards, and test coverage.

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.

Support undo/edit for the first message after stopping generation

1 participant