Skip to content

feat(app): add expand-last thinking display option and format markdown - #3370

Open
mcowger wants to merge 6 commits into
getpaseo:mainfrom
mcowger:feat-expand-active-thinking
Open

feat(app): add expand-last thinking display option and format markdown#3370
mcowger wants to merge 6 commits into
getpaseo:mainfrom
mcowger:feat-expand-active-thinking

Conversation

@mcowger

@mcowger mcowger commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Type of change

  • New feature
  • Enhancement

Reasoning

Users often want to monitor agent reasoning while it is actively streaming and keep the most recent thinking block visible after it completes, without having every historic block across previous turns permanently expanded. Furthermore, certain models (e.g. Codex) output bold thinking headers without separating newlines (**title1****title2**), and previously thinking blocks were rendered as raw unformatted text rather than parsed Markdown.

This PR adds an Expand Last thinking display detail option so the latest thinking block remains expanded while streaming and stays expanded once complete, collapsing older thinking blocks. It also formats thinking headers cleanly and renders thinking content as rich compact Markdown.

Goals

  • Add Expand Last option to the thinking display setting alongside Collapsed and Always expand.
  • Automatically show the latest thinking block expanded (both during and after generation) while collapsing earlier blocks when Expand Last is selected.
  • Maintain backward compatibility for existing boolean settings in storage (true -> expanded, false -> collapsed, expand_active -> expand_last).
  • Normalize adjacent or jammed thinking headers (e.g. **title1****title2** -> **title1**\n\n**title2**) without breaking inline prose markdown.
  • Render thinking content as rich Markdown in tool call details using <MarkdownRenderer compact />.
  • Update all 9 localization resources with matching keys and translations.

Non-goals

  • Altering server-side reasoning storage or wire protocol structures.

QA

  • Verified storage parsing and migration in storage.test.ts for boolean flags and enum values (collapsed, expand_last, expanded, expand_active).
  • Verified header normalization in thinking-text-formatter.test.ts across adjacent headers, numbered steps, streaming inputs, and inline bold prose.
  • Verified localization key parity across all 9 languages with resources.test.ts.
  • Ran full workspace typecheck, lint, and format.

Checklist

Screenshot 2026-08-14 at 9 53 07 AM Screenshot 2026-08-14 at 9 52 41 AM

@greptile-apps

greptile-apps Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR adds an Expand Last reasoning-display preference, migrates persisted settings, and renders normalized thinking content as compact Markdown.

  • Adds collapsed, latest-only, and always-expanded display modes.
  • Migrates legacy boolean and expand_active settings.
  • Adds Markdown rendering, streaming auto-scroll behavior, localization updates, and formatter tests.

Confidence Score: 4/5

The PR is not yet safe to merge because valid Markdown code content can still be modified before display.

The prior thread’s author field is blank, and its “Addressed” reply does not cover the residual case: the preservation regex excludes only triple-backtick fences and single-backtick spans, leaving valid tilde fences and multi-backtick spans subject to the adjacent-bold rewrite.

Files Needing Attention: packages/app/src/utils/thinking-text-formatter.ts, packages/app/src/utils/thinking-text-formatter.test.ts

Important Files Changed

Filename Overview
packages/app/src/utils/thinking-text-formatter.ts Adds header normalization and code preservation, but valid tilde fences and variable-length backtick spans remain exposed to content rewriting.
packages/app/src/utils/thinking-text-formatter.test.ts Covers common prose and code cases but omits Markdown delimiter forms that remain corrupted.
packages/app/src/agent-stream/view.tsx Implements latest-thought selection and applies the new display mode and formatter to streamed reasoning.
packages/app/src/hooks/use-settings/storage.ts Introduces the three-state preference and backward-compatible parsing of stored values.
packages/app/src/components/tool-call-details.tsx Renders string tool details as compact Markdown and keeps streaming content pinned when the user is near the bottom.

Reviews (6): Last reviewed commit: "Merge branch 'main' into feat-expand-act..." | Re-trigger Greptile

Comment thread packages/app/src/utils/thinking-text-formatter.ts Outdated
@mcowger mcowger changed the title feat(app): add expand-active thinking display option and format markdown feat(app): add expand-last thinking display option and format markdown Aug 14, 2026
return "";
}

// Preserve code blocks (including in-progress streaming code blocks) and inline code spans

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Code delimiters remain unprotected

When thinking or tool text contains adjacent bold-like characters inside a tilde-fenced block or a code span using multiple backticks, the preservation regex fails to recognize the code region and inserts blank lines into it, causing the rendered content to differ from the model or tool output.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

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.

1 participant