Skip to content

feat: gpt5.2, conversation branch#79

Merged
Junyi-99 merged 13 commits intomainfrom
feat/gpt-5.2
Jan 19, 2026
Merged

feat: gpt5.2, conversation branch#79
Junyi-99 merged 13 commits intomainfrom
feat/gpt-5.2

Conversation

@Junyi-99
Copy link
Member

@Junyi-99 Junyi-99 commented Jan 8, 2026

This pull request introduces significant improvements to the conversation branching system, adds support for new GPT-5 models, and refines how conversations and their branches are managed and returned via the API. The main changes include implementing a robust branching mechanism for chat conversations, updating the API to support branch selection and history, and expanding the list of supported language models.

Conversation Branching and API Enhancements:

  • Added a Branch struct to Conversation in models/conversation.go, enabling multiple branches per conversation for edit history, and migrated legacy fields for backward compatibility.
  • Refactored conversation message handling in create_conversation_message_stream_v2.go to append messages to the correct branch, support branch creation on message edits, and ensure all API methods use the active or specified branch for chat history and LLM calls. [1] [2] [3] [4] [5] [6] [7]
  • Updated the conversation-to-proto mapping in mapper/conversation_v2.go to allow explicit branch selection, include branch metadata in API responses, and ensure backward compatibility with legacy conversations. [1] [2]
  • Modified the GetConversation API to allow branch selection via a branch_id parameter, returning the correct branch's history and metadata.

Supported Models Expansion:

  • Added support for new GPT-5.1, GPT-5.2, and GPT-5.2 Pro models (with corresponding context sizes and pricing) in the supported models API, both for users with and without a custom OpenAI API key. [1] [2]

Other Changes:

  • Commented out two default prompts in the user prompts list, possibly for deprecation or future updates.
  • Cleaned up unused imports in the user prompts handler.

Note

Implements multi-branch conversations across backend, API, and UI, adds reasoning streaming, and expands model support.

  • Backend/API (v2): introduce Branch model and per-branch histories; editing a message creates a new branch via parent_message_id; use active branch for LLM calls; migrate legacy data with EnsureBranches; GetConversation/ListConversations support branch selection and return branch metadata; mapper updated to include branches, current_branch_id, indices
  • Protobuf/gateway: add BranchInfo, branch fields on Conversation, branch_id on GetConversationRequest, parent_message_id on streaming request; add ReasoningChunk and optional assistant reasoning; normalize message IDs (remove openai_ prefix)
  • Frontend: branch switcher UI and edit-to-branch flow; handle/display reasoning deltas; pass branchId in getConversation; minor UI/UX tweaks (prompt picker visibility, settings text size, drag shadow)
  • Models: add GPT-5.1/5.2/5.2 Pro to supported models (with context/pricing)
  • Toolkit: re-enable/register file/LaTeX tools; placeholder create/delete now return errors; adjust file search path check; GA error API updated; Office adapter selection polling tuned

Written by Cursor Bugbot for commit 25dfd0c. This will update automatically on new commits. Configure here.

Copilot AI review requested due to automatic review settings January 8, 2026 07:34
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request implements a comprehensive conversation branching system that enables users to edit messages and create alternative conversation paths, along with adding support for new GPT-5 models and reasoning display features. The implementation spans both frontend (React/TypeScript) and backend (Go) with protocol buffer schema updates.

Key changes:

  • Implements conversation branching architecture with Branch struct for tracking edit history
  • Adds GPT-5.1, GPT-5.2, and GPT-5.2 Pro model support with pricing information
  • Introduces reasoning token display for AI responses with streaming support

Reviewed changes

Copilot reviewed 32 out of 32 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
internal/models/conversation.go Adds Branch struct and methods for branch management, migration from legacy format
internal/api/chat/create_conversation_message_stream_v2.go Updates message streaming to use branches, handles parent message IDs for edits
internal/api/mapper/conversation_v2.go Maps conversation model to proto with branch selection support
internal/api/chat/get_conversation_v2.go Supports optional branch_id parameter for retrieving specific branches
internal/api/chat/list_supported_models_v2.go Adds GPT-5.x model definitions with context sizes and pricing
proto/chat/v2/chat.proto Adds BranchInfo, reasoning field, ReasoningChunk, and parent_message_id
pkg/gen/api/chat/v2/*.go Generated Go code from proto changes
webapp/_webapp/src/components/branch-switcher.tsx New UI component for navigating between conversation branches
webapp/_webapp/src/components/message-entry-container/user.tsx Adds message editing interface with edit button and textarea
webapp/_webapp/src/components/message-entry-container/assistant.tsx Displays reasoning content in expandable card format
webapp/_webapp/src/hooks/useSendMessageStream.ts Handles parentMessageId for branching, truncates messages client-side
internal/services/toolkit/handler/stream_v2.go Adds HandleReasoningDelta for streaming reasoning tokens
internal/services/toolkit/client/completion_v2.go Parses reasoning_content and reasoning fields from streaming responses
webapp/_webapp/src/stores/conversation/handlers/handleReasoningChunk.ts New handler for processing reasoning chunks in streaming messages
Multiple handler files Removes "openai_" prefix from message IDs for cleaner identifier format
webapp/_webapp/src/views/settings/*.tsx Reduces label text size from text-sm to text-xs
webapp/_webapp/src/main.tsx Adds URL patterns to Faro monitoring ignore list

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +47 to +61
const handlePrevious = () => {
if (currentIndex <= 1) return;
const prevBranchId = branches[currentIndex - 2]?.id;
if (prevBranchId) {
switchToBranch(prevBranchId);
}
};

const handleNext = () => {
if (currentIndex >= totalBranches) return;
const nextBranchId = branches[currentIndex]?.id;
if (nextBranchId) {
switchToBranch(nextBranchId);
}
};
Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

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

The component should handle the case where conversation.branches array length doesn't match conversation.totalBranches. If the arrays are out of sync, accessing branches[currentIndex - 2] or branches[currentIndex] could return undefined even when the navigation should be valid, or conversely allow navigation when it shouldn't be possible.

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Copilot AI commented Jan 8, 2026

@Junyi-99 I've opened a new pull request, #80, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

This PR is being reviewed by Cursor Bugbot

Details

You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

@Junyi-99
Copy link
Member Author

Junyi-99 commented Jan 8, 2026

related to #71

@Junyi-99 Junyi-99 moved this from Icebox to In review in Project PaperDebugger Jan 8, 2026
@Junyi-99 Junyi-99 moved this from In review to QA / Testing in Project PaperDebugger Jan 8, 2026
@Junyi-99 Junyi-99 requested a review from Copilot January 9, 2026 09:01
…ches (#80)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Junyi-99 <14367694+Junyi-99@users.noreply.github.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 32 out of 32 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

- Updated CreateNewBranch method to return an error if the parent message is not found, enhancing error handling.
- Modified appendConversationMessage to handle errors from CreateNewBranch.
- Added migration logic for legacy data to branch structure in GetConversation and ListConversations, ensuring stability of branch IDs.
- Introduced HandleAssistantPartBegin to manage assistant message streaming more effectively.
- Enhanced conversation state update in the frontend to prevent stale data application during asynchronous updates.
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 3 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

…conversation preparation

- Added '.claude' to .gitignore to exclude specific files from version control.
- Refactored conversation preparation logic in both V1 and V2 to use a local variable for project instructions, improving code clarity.
- Updated toolkit client to register file and LaTeX tools with project service injection, enhancing functionality.
- Modified error messages in file and folder tools to indicate unimplemented features.
@Junyi-99 Junyi-99 merged commit 11a51df into main Jan 19, 2026
3 checks passed
@Junyi-99 Junyi-99 deleted the feat/gpt-5.2 branch January 19, 2026 11:51
@github-project-automation github-project-automation bot moved this from QA / Testing to Done in Project PaperDebugger Jan 19, 2026
Junyi-99 added a commit that referenced this pull request Jan 26, 2026
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Junyi-99 added a commit that referenced this pull request Jan 26, 2026
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants