Skip to content

feat(platform): add chat message editing and conversation branching#1271

Merged
larryro merged 3 commits into
mainfrom
feat/chat-message-edit-and-branch
Apr 9, 2026
Merged

feat(platform): add chat message editing and conversation branching#1271
larryro merged 3 commits into
mainfrom
feat/chat-message-edit-and-branch

Conversation

@larryro

@larryro larryro commented Apr 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Allow users to edit previously sent messages via a dialog, re-submitting the edited content as the latest version
  • Introduce conversation branching: editing a message creates a new branch thread from that point, preserving the original conversation
  • Add a branch navigator component for switching between alternate conversation branches, with selections persisted to thread metadata

Closes #1164

Test plan

  • Send a message, then edit it — verify the edit dialog opens and re-submits correctly
  • Edit a message mid-conversation — verify a new branch is created and the branch navigator appears
  • Switch between branches using the navigator — verify messages update and selection persists across page reloads
  • Edit multiple messages in different positions — verify navigators only show relevant branches
  • Verify "edited" indicator appears on edited messages

Summary by CodeRabbit

  • New Features
    • Added message editing capability—users can now edit their sent messages in conversations.
    • Introduced conversation branching—editing a message creates a new conversation branch, preserving the original thread.
    • Added branch navigation controls—users can switch between alternate conversation branches using previous/next buttons.
    • Added support for multiple conversation paths—track and navigate different responses to the same message edit.

larryro added 2 commits April 10, 2026 01:12
Allow users to edit sent messages and branch conversations from any
point in the chat history, creating alternate conversation threads
with a branch navigator for switching between them.
…ctions

- Fix branch navigator to correctly determine parent thread at each fork
  point, resolving broken navigation when multiple messages are edited
- Only show navigators for direct child branches or sibling branches,
  preventing unrelated branches from appearing
- Persist branch selections to threadMetadata so the last viewed branch
  is restored on next visit
- Preserve scroll position during branch switches by suppressing
  auto-scroll in onContentChange handler
- Use Dialog component for message editing instead of inline textarea
- Fix message ordering in branches by using saveMessage loop instead
  of SDK cloneThread (which processes in DESC order)
- Always show edit button regardless of generation status

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

The ChatMessages component now depends on useBranchContext, which
requires BranchProvider. Add a vi.mock for the branch context module
so existing tests render without the provider wrapper.
@larryro larryro merged commit 40d5ab1 into main Apr 9, 2026
23 checks passed
@larryro larryro deleted the feat/chat-message-edit-and-branch branch April 9, 2026 17:48
@coderabbitai

coderabbitai Bot commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

This pull request implements a message editing feature with branching support for chat threads. It introduces frontend components (BranchNavigator, EditMessageDialog) and context management (BranchContext) for handling alternative conversation paths when users edit messages. The backend adds Convex operations (editAndBranch, createBranchThread) to create and manage branched threads, along with schema tables and queries for storing branch metadata. The chat interface is updated to track the active branch thread, preserve scroll position across branch switches, and expose edit actions on user messages. Database schema extensions support branch tracking and user selections. Internationalization strings are added for edit-related UI labels.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~75 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning All primary objectives from #1164 are addressed: message editing via dialog, re-submission of edited content, and branch navigation. An edited indicator was mentioned but not implemented in the code changes. Implement and display an 'edited' indicator on messages that have been edited, as specified in the linked issue requirements.
Docstring Coverage ⚠️ Warning Docstring coverage is 28.57% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly summarizes the main changes: adding message editing and conversation branching features to the chat platform.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing message editing and conversation branching. No unrelated refactoring or scope creep detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/chat-message-edit-and-branch

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

[UX] Add support for editing previously sent messages

1 participant