Skip to content

Add Fork conversation action to assistant messages #1025

Description

@paullizer

Summary

Add a Fork conversation action to persisted assistant messages in personal conversations. Forking creates a new personal conversation containing the visible conversation history from the beginning through the selected assistant message, inclusive. Messages that come after the selected message are not copied, and the source conversation remains unchanged.

User Value

Users sometimes want to take a conversation in a different direction after a useful assistant response. Today, continuing along an alternate path means deleting later work or manually recreating the earlier context. A fork preserves the complete original while giving the user a clean branch from the point they choose.

Proposed Behavior

  • Add a Fork conversation action to the existing action or overflow menu for eligible assistant messages.
  • Limit the initial implementation to personal conversations and persisted assistant messages. Shared and group conversations are out of scope for this issue.
  • When selected, create a new personal conversation owned by the current user.
  • Copy the authoritative message sequence from the start of the source conversation through the selected assistant message, including that message exactly once.
  • Exclude every message, thread child, artifact, or transient turn record that occurs after the selected message in the active conversation timeline.
  • Preserve continuation-relevant conversation settings and message metadata needed to render and use the copied history, including supported citations, attachments, and assistant output metadata, while revalidating access to referenced resources.
  • Assign new conversation and message identifiers so the fork shares no mutable records with the source.
  • Give the fork a clearly distinguishable title, such as Fork of <source title>, and open it after creation so the user can continue immediately.
  • Treat the operation as atomic from the user's perspective: a failed copy must not leave a partially usable conversation.

Acceptance Criteria

  • A Fork conversation action is available on persisted assistant messages in personal conversations and is unavailable while a message is still streaming or otherwise not committed.
  • The backend verifies that the current user owns the source conversation and that the selected message belongs to it and is an assistant message.
  • The new conversation contains all eligible messages before the selected message plus the selected message itself, in the same deterministic order.
  • No message or dependent record that follows the selected message is included in the fork.
  • The fork receives new record identifiers and can be modified or deleted without changing the source conversation.
  • The original conversation, including all messages after the fork point, remains unchanged.
  • Conversation context and referenced resources are copied only when the user remains authorized to use them; inaccessible or transient state is not leaked into the fork.
  • On success, the new conversation appears in the conversation list and becomes the active conversation.
  • Concurrent source changes, missing messages, and copy failures return a clear error and do not leave partial data.
  • Backend tests cover the inclusive boundary, exclusion of later messages, deterministic ordering, independent IDs, source immutability, invalid message IDs, and unauthorized access.
  • UI tests cover action visibility, confirmation, success navigation, duplicate-click prevention, and failure feedback.

Notes

  • Initial scope is personal conversations only. Forking shared or group conversations should be handled separately because their ownership, participants, and referenced-resource permissions require a distinct product and security design.
  • Prefer a server-side copy based on persisted message identity and deterministic ordering rather than trusting a client-supplied timestamp or message list.
  • Relevant implementation areas include route_backend_conversations.py, functions_simplechat_operations.py, static/js/chat/chat-messages.js, and the conversation-list modules.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    Pending Assignment

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions