Skip to content

feat: support streamed reasoning summaries and working status - #22

Merged
LangLang03 merged 1 commit into
LangLang03:masterfrom
linxiovo:feature/ai-working-status
Aug 21, 2026
Merged

feat: support streamed reasoning summaries and working status#22
LangLang03 merged 1 commit into
LangLang03:masterfrom
linxiovo:feature/ai-working-status

Conversation

@linxiovo

@linxiovo linxiovo commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Summary

Improve assistant streaming feedback and reasoning-summary compatibility without changing ordinary assistant text, tool-call, persistence, or conversation flows.

  • Replace the body-only blinking cursor with a lifecycle-safe working-status row that is visible for the full assistant stream.
  • Parse and format OpenAI-compatible and Codex reasoning-summary segments consistently across SSE chunk boundaries.

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that changes existing behavior)
  • Refactor / code quality (no behavior change)
  • Docs / changelog only

Scope

Chat UI, OpenAI-compatible protocol, Codex Responses protocol, and reasoning-summary rendering.

Changes

  • Add WorkingStatusView with localized Working/Thinking labels, accessibility content descriptions, reduced-animation handling, and attach/detach-safe animator lifecycle.
  • Replace StreamingCursorView in AssistantMessageView; show the status for the entire assistant stream and hide it on completion or compact rows.
  • Send top-level reasoning_effort for GPT/o-series Chat Completions models.
  • Parse reasoning.summary payloads and preserve summary identity across SSE chunks.
  • Normalize adjacent OpenAI/Codex summary parts to | while preserving ordinary reasoning_content verbatim.
  • Render reasoning-summary emphasis while preserving inline code spans.
  • Add English, Chinese, and Russian status resources and update update.md.

Testing

  • ./gradlew :app:testDebugUnitTest passes
  • ./gradlew :app:lintDebug passes
  • ./gradlew :app:assembleDebug builds
  • ./gradlew :app:assembleDebugUserCert builds
  • Manual verification on device/emulator

Manual verification covered Working/Thinking transitions, status dismissal after completion, multi-part reasoning-summary separators, normal answer rendering, and no lingering status animation after generation.

Additional regression coverage:

  • WorkingStatusViewTest
  • OpenAiCompatibleProtocolTest
  • CodexResponsesProtocolTest
  • InlineEmphasisParserTest

Compliance checklist

  • Java only in app/src/main/java (no Kotlin sources added)
  • UI built in Java code, not inflated from XML layouts
  • No new secrets or redaction fields
  • No new application state or direct view reach-in; status is derived from existing ChatMessage fields
  • update.md updated for user-facing changes

Risk / rollback

Risk is limited to streamed reasoning parsing and assistant streaming-status rendering. Ordinary assistant text, tool calls, stored message formats, database schema, and conversation/model execution flow are unchanged.

Rollback by reverting this PR to restore the previous blinking cursor and raw reasoning-summary concatenation.

Summary by Sourcery

Improve assistant streaming feedback and reasoning-summary compatibility across supported model protocols.

New Features:

  • Add accessible localized working and thinking status feedback throughout assistant response streaming.
  • Support top-level reasoning effort requests for GPT and o-series OpenAI-compatible models.
  • Render streamed reasoning summaries with consistent separators and inline emphasis while preserving code spans.

Bug Fixes:

  • Correctly parse reasoning summary payloads and preserve summary boundaries across SSE chunks for OpenAI-compatible and Codex responses.
  • Stop streaming status animation safely when assistant generation completes, rows are recycled, views detach, or animations are disabled.

Documentation:

  • Document the new assistant working-status feedback and reasoning-summary compatibility behavior in update.md.

Tests:

  • Add regression coverage for working-status state handling, reasoning-summary parsing and normalization, reasoning-content preservation, reasoning effort requests, Codex summary parts, and inline emphasis rendering.

Chores:

  • Replace the streaming cursor with a lifecycle-safe working-status row in assistant messages.

@sourcery-ai

sourcery-ai Bot commented Aug 20, 2026

Copy link
Copy Markdown

Reviewer's Guide

Replaces the assistant’s blinking cursor with a lifecycle-safe working status row, and normalizes streamed reasoning summaries (OpenAI-compatible and Codex) across SSE chunks while preserving ordinary reasoning content and inline code formatting.

Sequence diagram for streamed reasoning summary handling

sequenceDiagram
    participant CodexResponsesProtocol
    participant ReasoningSummaryStream
    participant ModelStreamCallback

    CodexResponsesProtocol->>ReasoningSummaryStream: startPart() on response.reasoning_summary_part.added
    CodexResponsesProtocol->>ReasoningSummaryStream: append(delta) on response.reasoning_summary_text.delta
    ReasoningSummaryStream-->>ModelStreamCallback: onReasoningDelta(normalized_text)

    CodexResponsesProtocol->>ReasoningSummaryStream: flush() on response.reasoning_text.delta
    CodexResponsesProtocol->>ModelStreamCallback: onReasoningDelta(delta)

    CodexResponsesProtocol->>ReasoningSummaryStream: flush() on response.completed / output_item events
Loading

File-Level Changes

Change Details Files
Introduce a WorkingStatusView and integrate it into assistant message rendering in place of the old streaming cursor.
  • Create WorkingStatusView with animated dot-matrix, shimmer text, accessibility labels, and reduced-animation support.
  • Wire WorkingStatusView into AssistantMessageView, remove StreamingCursorView, and control visibility based on streaming and reasoning state.
  • Add localized Working/Thinking strings in English, Chinese, and Russian.
  • Add unit tests for WorkingStatusView thinking state and highlight color behavior.
app/src/main/java/cn/lineai/ui/component/AssistantMessageView.java
app/src/main/java/cn/lineai/ui/component/WorkingStatusView.java
app/src/main/res/values/strings.xml
app/src/main/res/values-zh/strings.xml
app/src/main/res/values-ru/strings.xml
app/src/test/java/cn/lineai/ui/component/WorkingStatusViewTest.java
Normalize and preserve streamed reasoning summaries for Codex responses.
  • Change CodexOutputMerger to join reasoning summary parts with a pipe separator while trimming whitespace.
  • Add ReasoningSummaryStream in CodexResponsesProtocol to manage summary parts, whitespace, and callback emission across SSE events.
  • Ensure reasoning summary flushing on transitions to full reasoning text and on completion events.
  • Add tests validating Codex reasoning summary normalization.
feature-model/src/main/java/cn/lineai/ai/protocol/CodexOutputMerger.java
feature-model/src/main/java/cn/lineai/ai/protocol/CodexResponsesProtocol.java
feature-model/src/test/java/cn/lineai/ai/protocol/CodexResponsesProtocolTest.java
Improve OpenAI-compatible reasoning-summary extraction, spacing, and bold handling, and add top-level reasoning_effort for GPT/o-series chat models.
  • Register OpenAiChatReasoningStrategy and send reasoning_effort as a top-level request field for matching models.
  • Refactor ReasoningDeltaExtractor to track reasoning field vs details, normalize whitespace at summary boundaries, and insert separators between adjacent bold summaries while preserving ordinary reasoning content (including four asterisks).
  • Add OpenAiChatReasoningStrategy implementation and tests for reasoning summary separation, four-asterisk preservation, and reasoning_effort behavior.
feature-model/src/main/java/cn/lineai/ai/protocol/OpenAiCompatibleProtocol.java
feature-model/src/main/java/cn/lineai/ai/protocol/reasoning/OpenAiChatReasoningStrategy.java
feature-model/src/main/java/cn/lineai/ai/protocol/reasoning/ReasoningDeltaExtractor.java
feature-model/src/test/java/cn/lineai/ai/protocol/OpenAiCompatibleProtocolTest.java
Parse inline emphasis in streamed reasoning summaries while preserving inline code spans and apply styles in the thinking block view.
  • Introduce InlineEmphasisParser to parse a small markdown-emphasis subset (bold, italic, bold-italic) with code-span protection and legacy summary separator repair.
  • Use InlineEmphasisParser in ThinkingBlockView to build styled Spannable content from reasoning text.
  • Add tests covering emphasis parsing, separator restoration between legacy bold summary blocks, and code-span preservation.
ui-theme/src/main/java/cn/lineai/ui/theme/InlineEmphasisParser.java
ui-theme/src/main/java/cn/lineai/ui/theme/ThinkingBlockView.java
ui-theme/src/test/java/cn/lineai/ui/theme/InlineEmphasisParserTest.java
Document the new working status and reasoning-summary behaviors in the update log.
  • Update update.md with notes on the working status row, reasoning summary handling across SSE chunks, and related tests.
update.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai 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.

Hey - I've left some high level feedback:

  • OpenAiChatReasoningStrategy.matches() hard-codes model ID prefixes (gpt-5, o1/o3/o4); consider centralizing these in a shared configuration or capability check so new OpenAI reasoning-capable models don’t require code changes here.
  • ReasoningSummaryStream and InlineEmphasisParser both inject the literal " | " separator; if this is part of user-visible text you may want to centralize or localize the separator to avoid inconsistencies across languages and future UI changes.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- OpenAiChatReasoningStrategy.matches() hard-codes model ID prefixes (gpt-5, o1/o3/o4); consider centralizing these in a shared configuration or capability check so new OpenAI reasoning-capable models don’t require code changes here.
- ReasoningSummaryStream and InlineEmphasisParser both inject the literal " | " separator; if this is part of user-visible text you may want to centralize or localize the separator to avoid inconsistencies across languages and future UI changes.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@LangLang03
LangLang03 merged commit 6cf2b05 into LangLang03:master Aug 21, 2026
1 check passed
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.

2 participants