Skip to content

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

Open
cooooooooooode wants to merge 3 commits intoanomalyco:devfrom
cooooooooooode:opencode/crisp-harbor
Open

feat(app,ui): add undo/fork buttons on user messages and agent description placeholder#13266
cooooooooooode wants to merge 3 commits intoanomalyco:devfrom
cooooooooooode:opencode/crisp-harbor

Conversation

@cooooooooooode
Copy link
Copy Markdown
Contributor

@cooooooooooode cooooooooooode commented Feb 12, 2026

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

@github-actions
Copy link
Copy Markdown
Contributor

Hey! Your PR title feat(app,ui): add undo/fork buttons on user messages and agent description placeholder doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

See CONTRIBUTING.md for details.

@github-actions
Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Based on my search, I found two potentially related PRs (excluding the current PR #13266):

  1. PR feat(app): add fork and revert functionality #8914: feat(app): add fork and revert functionality

    • Directly related as it implements fork and revert functionality, which overlaps with the undo/fork button feature in the current PR
  2. PR feat: message edit (undo) with confirm/cancel flow #12952: feat: message edit (undo) with confirm/cancel flow

    • Related to the undo functionality with confirmation flow mentioned in the current PR
  3. PR feat: use agent description as prompt placeholder #8788: feat: use agent description as prompt placeholder

    • Directly related to the agent description placeholder feature in the current PR

These PRs may represent earlier implementations or iterations of similar features. You may want to review them to ensure there's no duplicate work or to understand how previous attempts were handled.

Display the current agent's description in the prompt input placeholder
using the format 'I am {name}, {description}' with full i18n support
across all 16 locales.
- Undo: aborts running session and reverts the message
- Fork: creates a new session branching from the selected message
- Two-step confirmation with forceOpen tooltip and 3s timeout reset
- Full i18n support across all 16 locales
After reverting a user message, extract its parts and fill the original
text back into the prompt input via a pendingRestore signal in DataProvider,
consumed by session.tsx through extractPromptFromParts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add undo/fork buttons on user messages and show agent description in prompt placeholder

1 participant