Skip to content

Enhance inline thinking blocks with reasoning summaries for GPT-5 content#1

Draft
bastikohn with Copilot wants to merge 4 commits into
feat/gpt5-thinking-uifrom
copilot/fix-4aad90b8-f0a7-4755-8dcb-0426df7a94b6
Draft

Enhance inline thinking blocks with reasoning summaries for GPT-5 content#1
bastikohn with Copilot wants to merge 4 commits into
feat/gpt5-thinking-uifrom
copilot/fix-4aad90b8-f0a7-4755-8dcb-0426df7a94b6

Conversation

Copilot AI commented Aug 23, 2025

Copy link
Copy Markdown

This PR enhances the existing inline thinking blocks functionality in the OpenCode TUI to display GPT-5 reasoning content with improved formatting and status indicators.

Overview

The TUI previously supported basic inline thinking blocks via the /thinking command, but lacked enhanced formatting for AI reasoning content. This implementation improves the existing inline thinking blocks to provide better presentation of reasoning summaries without introducing a separate view.

Key Features

🎯 Enhanced Inline Thinking Blocks

  • Improved formatting for reasoning content with automatic text truncation for better readability
  • Status Indicators: Visual indicators show for active thinking and ✓ Reasoning Summary for completed reasoning
  • Smart Summarization: Automatically truncates long reasoning content to ~500 characters with intelligent break points
  • Real-time Updates: Status indicators update as reasoning parts stream in

🔄 Seamless Integration

  • Enhanced existing /thinking command and <leader>b keybinding functionality
  • Maintains full backward compatibility with current thinking blocks behavior
  • Integrated with existing message rendering pipeline for consistent theming
  • No changes to user workflow - same commands, better presentation

Implementation Details

The enhancement processes ReasoningPart content from assistant messages and displays them inline with:

  • Automatic text truncation to maintain summary format while preserving readability
  • Status-aware labels that show completion state with visual indicators
  • Enhanced rendering that integrates seamlessly with existing message theming

Usage

Users continue to use the same familiar commands:

  • /thinking command - toggles enhanced inline thinking blocks
  • <leader>b keybinding - keyboard shortcut for quick access

When activated, reasoning content appears as enhanced inline thinking blocks within the normal message flow, providing a focused way to review AI reasoning without disrupting the conversation context.

Testing

All existing functionality preserved with enhanced presentation. The implementation maintains the same toggle behavior while providing improved visual formatting for reasoning content.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits August 23, 2025 12:58
Co-authored-by: bastikohn <673521+bastikohn@users.noreply.github.com>
Co-authored-by: bastikohn <673521+bastikohn@users.noreply.github.com>
Copilot AI changed the title [WIP] @tui_reasoning_view.go Please implement the attached design plan in order to integrate reasoning summaries into the OpenCode TUI application. I.e. it should show gpt-5 thinking summaries when the /thinking command was run, such that thinking blocks are... Implement TUI reasoning summaries view for GPT-5 thinking content Aug 23, 2025
Copilot AI requested a review from bastikohn August 23, 2025 13:02
@bastikohn bastikohn requested a review from Copilot August 23, 2025 13:03

Copilot AI 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.

Pull Request Overview

This PR implements a dedicated reasoning summaries view in the OpenCode TUI application to display GPT-5 thinking content in a focused, split-screen interface alongside regular chat messages.

  • Adds a new ReasoningView component for displaying AI reasoning content in an organized format
  • Integrates the reasoning view with the existing TUI layout system using a split-screen approach
  • Updates the /thinking command to control both inline blocks and the new dedicated reasoning view

Reviewed Changes

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

File Description
packages/tui/internal/tui/tui_reasoning_view.go Core implementation of the ReasoningView component with reasoning summary extraction and rendering
packages/tui/internal/tui/tui_reasoning_view_test.go Unit tests for reasoning view functionality including summary extraction and text processing
packages/tui/internal/tui/tui.go Integration of reasoning view into main TUI model with split layout and update handling
packages/tui/internal/commands/command.go Updated command description to reflect "reasoning summaries" functionality

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +103 to +106
// Only get reasoning from the last assistant message for focused view
if assistantMsg.Time.Completed == 0 {
break
}

Copilot AI Aug 23, 2025

Copy link

Choose a reason for hiding this comment

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

This logic has a potential bug - the break condition only applies when assistantMsg.Time.Completed == 0, but the loop continues processing messages even after finding incomplete assistant messages. This could skip reasoning parts from newer messages. Consider breaking when finding any incomplete message or restructuring to process messages in reverse order.

Suggested change
// Only get reasoning from the last assistant message for focused view
if assistantMsg.Time.Completed == 0 {
break
}
// Only get reasoning from the most recent assistant message for focused view
break

Copilot uses AI. Check for mistakes.
Comment on lines +117 to +121
longText := make([]byte, 600)
for i := range longText {
longText[i] = 'a'
}
longTextStr := string(longText)

Copilot AI Aug 23, 2025

Copy link

Choose a reason for hiding this comment

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

This manual byte slice creation can be simplified using strings.Repeat(). Replace lines 117-120 with: longTextStr := strings.Repeat(\"a\", 600).

Suggested change
longText := make([]byte, 600)
for i := range longText {
longText[i] = 'a'
}
longTextStr := string(longText)
longTextStr := strings.Repeat("a", 600)

Copilot uses AI. Check for mistakes.
Comment thread packages/tui/internal/tui/tui.go Outdated
Comment on lines +1066 to +1067
// Show reasoning view alongside messages in a split layout
messagesWidth := effectiveWidth / 2

Copilot AI Aug 23, 2025

Copy link

Choose a reason for hiding this comment

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

[nitpick] The 50/50 split layout is hardcoded. Consider making the split ratio configurable or dynamic based on content length to provide better user experience with varying reasoning content sizes.

Suggested change
// Show reasoning view alongside messages in a split layout
messagesWidth := effectiveWidth / 2
// Dynamically calculate split ratio based on content height
messagesHeight := lipgloss.Height(messagesView)
reasoningHeight := lipgloss.Height(reasoningView)
var splitRatio float64
totalHeight := messagesHeight + reasoningHeight
if totalHeight == 0 {
splitRatio = 0.5
} else {
splitRatio = float64(messagesHeight) / float64(totalHeight)
// Clamp splitRatio between 0.2 and 0.8 for reasonable UI
if splitRatio < 0.2 {
splitRatio = 0.2
} else if splitRatio > 0.8 {
splitRatio = 0.8
}
}
messagesWidth := int(float64(effectiveWidth) * splitRatio)

Copilot uses AI. Check for mistakes.

@bastikohn bastikohn left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

@copilot I did not want a split screen layout. Integrate the thinking summaries in the in-line thinking blocks.

@bastikohn bastikohn assigned Copilot and unassigned bastikohn and Copilot Aug 23, 2025
@bastikohn

Copy link
Copy Markdown
Owner

@copilot I did not want a split screen layout. Integrate the thinking summaries in the in-line thinking blocks. Please update the implementation accordingly.

Co-authored-by: bastikohn <673521+bastikohn@users.noreply.github.com>

Copilot AI commented Aug 23, 2025

Copy link
Copy Markdown
Author

@copilot I did not want a split screen layout. Integrate the thinking summaries in the in-line thinking blocks.

I've integrated the reasoning summaries into the inline thinking blocks as requested. The split-screen layout has been removed and reasoning content now appears inline within the message flow. The summaries include status indicators (● for active thinking, ✓ for completed reasoning) and automatically truncate long content to maintain readability. Commit: 8dcc125

@copilot I did not want a split screen layout. Integrate the thinking summaries in the in-line thinking blocks. Please update the implementation accordingly.

Updated! The reasoning summaries are now integrated directly into the inline thinking blocks instead of using a separate split-screen layout. The implementation enhances the existing thinking blocks with summary formatting, status indicators, and automatic text truncation while maintaining the familiar inline display. Commit: 8dcc125

Copilot AI changed the title Implement TUI reasoning summaries view for GPT-5 thinking content Enhance inline thinking blocks with reasoning summaries for GPT-5 content Aug 23, 2025
Copilot AI requested a review from bastikohn August 23, 2025 16:19
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.

3 participants