Repository navigation
Show model reasoning as a collapsible Thinking item - #1
Merged
Merged
Conversation
Codex reasoning summaries (item/reasoning/summaryTextDelta, textDelta, summaryPartAdded, reasoning item completed) and Claude extended thinking (content_block_start/thinking_delta/content_block_stop, or a whole thinking block on the assistant message) stream into a new "thinking" thread item. The item is open while the model is still thinking and folds to "Thought for Ns" when it moves on; clicking toggles the reasoning text (Markdown). Deltas skip the disk write; the final text persists with the transcript. The offline engine gains `thinking` on mock steps (streamed via a new onThinking hook) so the demo and e2e exercise the item without a CLI. Tests: codex/claude fake-process suites assert the delta and completion events (including no duplicate when the full assistant message repeats a streamed thinking block); runner asserts the persisted item; e2e asserts the folded label, expand/collapse, and content. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Codex reasoning summaries (item/reasoning/summaryTextDelta, textDelta, summaryPartAdded, completed summary/content) and Claude extended thinking (thinking content blocks with thinking_delta, or whole blocks when partial messages are off) stream into a new `thinking` thread item. It is open with a shimmering "Thinking…" label while the model reasons and folds to "Thought for Ns" once it moves on; click to expand the text. Engine: TurnSink gains thinkingDelta/thinkingDone; the mock provider/agent carry an optional `thinking` step field so the offline demo and e2e exercise the same path. Tests: Codex fake-server reasoning sequence, Claude thinking block start/delta/stop without duplicating on the full message, runner item ordering and duration, e2e expand/collapse. Co-Authored-By: Claude Fable 5.1 <[email protected]>
The grid panes had no min-height:0 / row constraint, so a long transcript
grew the grid past the viewport and body{overflow:hidden} left nothing
scrollable. Rows are now minmax(0,1fr), panes are min-height:0 with their
own overflow, and the transcript/project list/diff scroll independently
while the composer stays pinned. e2e shrinks the window and asserts the
transcript scrolls, the document does not overflow, and the composer stays
on screen.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Backends announce a reasoning block before any text exists (Codex item/started, Claude content_block_start). Models that keep their reasoning private would leave an empty "Thought for 1s" row behind — observed live with Codex on a short prompt. The runner now creates the item on the first non-empty delta, or at completion when text arrives all at once. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Unresolved moderate issues affect Thinking item identity, cleanup, and UI rendering.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 4
Open (4)
What changed in this PR
Adds streamed, collapsible model reasoning items for Codex, Claude, and the mock engine.
Changes:
- Adds reasoning callbacks and backend event handling.
- Persists and renders expandable Thinking transcript items.
- Adds styling, demo data, and automated coverage.
| File | Description |
|---|---|
README.md |
Documents Thinking items. |
packages/core/src/types.ts |
Adds reasoning callback support. |
packages/core/src/providers/mock.ts |
Streams mock reasoning. |
packages/core/src/agent.ts |
Emits reasoning events. |
apps/desktop/test/runner.test.ts |
Tests Thinking transcript behavior. |
apps/desktop/test/fakeproc.ts |
Adds reasoning test events. |
apps/desktop/test/codex-backend.test.ts |
Tests Codex reasoning streaming. |
apps/desktop/test/claude-backend.test.ts |
Tests Claude thinking streaming. |
apps/desktop/src/shared/types.ts |
Adds the Thinking item type. |
apps/desktop/src/renderer/styles.css |
Styles Thinking items. |
apps/desktop/src/renderer/components/ThreadView.tsx |
Renders collapsible reasoning. |
apps/desktop/src/main/engine/runner.ts |
Persists and updates Thinking items. |
apps/desktop/src/main/engine/backends/types.ts |
Extends the backend sink API. |
apps/desktop/src/main/engine/backends/mock.ts |
Bridges mock reasoning events. |
apps/desktop/src/main/engine/backends/codex.ts |
Parses Codex reasoning events. |
apps/desktop/src/main/engine/backends/claude.ts |
Parses Claude thinking events. |
apps/desktop/e2e/app.spec.ts |
Tests folding and expansion behavior. |
apps/desktop/demo/mock-script.json |
Adds demo reasoning content. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| const started = new Map<string, number>(); | ||
| // Extended-thinking blocks are keyed by content-block index within the current assistant message. | ||
| const thinking = new Map<number, string>(); | ||
| let thinkingSeq = 0; |
| close: () => {}, | ||
| }; | ||
| let thinkingId: string | null = null; | ||
| let thinkingSeq = 0; |
Comment on lines
+224
to
+227
| thinkingDone: (id, text) => { | ||
| const existing = l.items.find((i) => i.id === id && i.kind === "thinking") as Extract<ThreadItem, { kind: "thinking" }> | undefined; | ||
| if (!existing) return; | ||
| this.patchItem(threadId, id, { text: text ?? existing.text, status: "done", durationMs: Date.now() - new Date(existing.at).getTime() }); |
Comment on lines
+240
to
+241
| .thinking { margin: 0 auto 8px; } | ||
| .thinking-head { display: flex; align-items: center; gap: 10px; width: 100%; background: transparent; border: 1px solid transparent; border-radius: 8px; padding: 4px 10px; cursor: pointer; text-align: left; color: var(--fg-2); } |
This was referenced Sep 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Codex reasoning summaries and Claude extended thinking now stream into a collapsible Thinking item in the transcript: open while the model is thinking, folded to "Thought for Ns" once it moves on, click to expand the reasoning (Markdown).
item/started(reasoning) →item/reasoning/summaryTextDelta/textDelta/summaryPartAdded→item/completed(summary + content joined).content_block_start(thinking) →thinking_delta→content_block_stop; a wholethinkingblock on theassistantmessage is handled when partial messages are off, without duplicating a streamed one.thinkingon a mock step streams through a newonThinkinghook so--demoand e2e cover the item offline.Tests: core 17/17, desktop 21/21 (codex + claude fake-process suites extended), e2e 2/2 (folded label, expand/collapse, content).
🤖 Generated with Claude Code