[PR #13266] feat(app,ui): add undo/fork buttons on user messages and agent description placeholder #14590

Open
opened 2026-02-16 18:19:22 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/13266

State: open
Merged: No


Closes #13265

Summary

  • Add undo (revert) and fork (branch) action buttons on user messages with two-step confirmation
  • Undo restores the original message content back into the prompt input
  • Show current agent's description as prompt input placeholder with i18n support

Changes

UI layer (packages/ui):

  • UserMessageDisplay: new fork/undo/copy button group with click-to-confirm (3s timeout reset + forceOpen tooltip)
  • New undo icon SVG
  • DataProvider: wraps undoMessage to capture message parts before revert, exposes pendingRestore signal + consumeRestore() for prompt restoration
  • 5 new i18n keys across all 16 locales

App layer (packages/app):

  • directory-layout.tsx: undoMessage (abort + revert) and forkMessage (find next message ID as truncation point → session.fork) callbacks
  • session.tsx: watches data.pendingRestore, extracts prompt via extractPromptFromParts, and fills it back into the input
  • placeholder.ts: agent description placeholder via prompt.placeholder.agent i18n key

Verification

  • All placeholder tests pass
  • Typecheck passes
  • Undo aborts running session, reverts, and restores original text into prompt input
  • Fork preserves the target message in the new session
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/13266 **State:** open **Merged:** No --- Closes #13265 ## Summary - Add undo (revert) and fork (branch) action buttons on user messages with two-step confirmation - Undo restores the original message content back into the prompt input - Show current agent's description as prompt input placeholder with i18n support ## Changes **UI layer (packages/ui):** - `UserMessageDisplay`: new fork/undo/copy button group with click-to-confirm (3s timeout reset + forceOpen tooltip) - New `undo` icon SVG - `DataProvider`: wraps `undoMessage` to capture message parts before revert, exposes `pendingRestore` signal + `consumeRestore()` for prompt restoration - 5 new i18n keys across all 16 locales **App layer (packages/app):** - `directory-layout.tsx`: `undoMessage` (abort + revert) and `forkMessage` (find next message ID as truncation point → `session.fork`) callbacks - `session.tsx`: watches `data.pendingRestore`, extracts prompt via `extractPromptFromParts`, and fills it back into the input - `placeholder.ts`: agent description placeholder via `prompt.placeholder.agent` i18n key ## Verification - All placeholder tests pass - Typecheck passes - Undo aborts running session, reverts, and restores original text into prompt input - Fork preserves the target message in the new session
yindo added the pull-request label 2026-02-16 18:19:22 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#14590