Surfaces the model's reasoning end to end while a turn streams.
Gateway:
The ai-sdk FullStream drain moves from the archiegateway composition into internal/gateway as DrainStreamParts, next to the TurnStream it feeds.
New reasoning-delta case: each ReasoningDelta is forwarded on the new optional ReasoningStream method; localChatStream.Reasoning emits ChatEvent{Kind: "reasoning", Text: delta} on the same stream. toolCallRecorder forwards it through. done/error semantics unchanged; the FullStream is still drained to close when no stream is attached.
The webui SSE handler already forwards any event kind with text through its default branch, so internal/webui needed no change (verified by reading the switch in handleChatStream).
UI:
state.ts accumulates reasoning frames into streamingTurn.reasoning alongside delta.
The live row renders the thinking in a collapsible "Thinking" trace (ChatThinking.vue, built from components/ui trace/collapsible like AgentTranscript), with a spinning icon and shimmering title while no reasoning text has arrived yet; a turn with no reasoning renders nothing, and reasoning never leaks into the reply text.
Tests:
internal/gateway/chat_stream_test.go: table-driven fake SDK stream (reasoning deltas -> Kind "reasoning" ChatEvents, text deltas still stream, tool results still report, nil stream still drains). Failed before the fix (undefined DrainStreamParts), passes after.
ui/test/chat-thinking.test.ts: drives the real sendMessage frame handling over a stubbed SSE stream; fails on the pre-fix state.ts (reasoning not accumulated), passes after.
Verified: go test -short ./internal/gateway/... ./internal/app/archiegateway/... ./internal/domain/messaging/..., pnpm test (105 pass), pnpm run typecheck, pnpm run build, task check (all on this exact tree). No live browser check: running the full stack needs a configured model provider, which this environment does not have; the SSE frame shape was verified against internal/webui/chat.go's default branch and the UI frame handling is covered by the node test.
Note: internal/app/archiegateway/chat_setup.go is outside the listed ownership, but the SDK stream is only read there; the change is a pure move of the drain into internal/gateway plus one call site, which is what lets the gateway own (and test) the reasoning forwarding.
Surfaces the model's reasoning end to end while a turn streams.
Gateway:
- The ai-sdk FullStream drain moves from the archiegateway composition into internal/gateway as `DrainStreamParts`, next to the TurnStream it feeds.
- New `reasoning-delta` case: each ReasoningDelta is forwarded on the new optional `ReasoningStream` method; `localChatStream.Reasoning` emits `ChatEvent{Kind: "reasoning", Text: delta}` on the same stream. `toolCallRecorder` forwards it through. done/error semantics unchanged; the FullStream is still drained to close when no stream is attached.
- The webui SSE handler already forwards any event kind with text through its default branch, so `internal/webui` needed no change (verified by reading the switch in handleChatStream).
UI:
- `state.ts` accumulates `reasoning` frames into `streamingTurn.reasoning` alongside `delta`.
- The live row renders the thinking in a collapsible "Thinking" trace (`ChatThinking.vue`, built from components/ui trace/collapsible like AgentTranscript), with a spinning icon and shimmering title while no reasoning text has arrived yet; a turn with no reasoning renders nothing, and reasoning never leaks into the reply text.
Tests:
- `internal/gateway/chat_stream_test.go`: table-driven fake SDK stream (reasoning deltas -> Kind "reasoning" ChatEvents, text deltas still stream, tool results still report, nil stream still drains). Failed before the fix (undefined DrainStreamParts), passes after.
- `ui/test/chat-thinking.test.ts`: drives the real `sendMessage` frame handling over a stubbed SSE stream; fails on the pre-fix state.ts (reasoning not accumulated), passes after.
Verified: `go test -short ./internal/gateway/... ./internal/app/archiegateway/... ./internal/domain/messaging/...`, `pnpm test` (105 pass), `pnpm run typecheck`, `pnpm run build`, `task check` (all on this exact tree). No live browser check: running the full stack needs a configured model provider, which this environment does not have; the SSE frame shape was verified against internal/webui/chat.go's default branch and the UI frame handling is covered by the node test.
Note: internal/app/archiegateway/chat_setup.go is outside the listed ownership, but the SDK stream is only read there; the change is a pure move of the drain into internal/gateway plus one call site, which is what lets the gateway own (and test) the reasoning forwarding.
The ai-sdk FullStream drain moves from the archiegateway composition into
internal/gateway (DrainStreamParts), next to the TurnStream it feeds, and
gains a StreamPartReasoningDelta case: each reasoning delta is forwarded on
the new optional ReasoningStream method, which localChatStream turns into a
ChatEvent{Kind: "reasoning", Text: delta} on the same stream. done/error
semantics are unchanged, and the FullStream is still drained to close when no
stream is attached.
Reasoning frames accumulate into streamingTurn.reasoning and the live row
shows them in a collapsible Thinking trace built from the components/ui
trace pattern, with a spinning icon and shimmering title while no reasoning
has arrived yet. A turn that produces no reasoning renders no trace, and
reasoning never leaks into the reply text.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Surfaces the model's reasoning end to end while a turn streams.
Gateway:
DrainStreamParts, next to the TurnStream it feeds.reasoning-deltacase: each ReasoningDelta is forwarded on the new optionalReasoningStreammethod;localChatStream.ReasoningemitsChatEvent{Kind: "reasoning", Text: delta}on the same stream.toolCallRecorderforwards it through. done/error semantics unchanged; the FullStream is still drained to close when no stream is attached.internal/webuineeded no change (verified by reading the switch in handleChatStream).UI:
state.tsaccumulatesreasoningframes intostreamingTurn.reasoningalongsidedelta.ChatThinking.vue, built from components/ui trace/collapsible like AgentTranscript), with a spinning icon and shimmering title while no reasoning text has arrived yet; a turn with no reasoning renders nothing, and reasoning never leaks into the reply text.Tests:
internal/gateway/chat_stream_test.go: table-driven fake SDK stream (reasoning deltas -> Kind "reasoning" ChatEvents, text deltas still stream, tool results still report, nil stream still drains). Failed before the fix (undefined DrainStreamParts), passes after.ui/test/chat-thinking.test.ts: drives the realsendMessageframe handling over a stubbed SSE stream; fails on the pre-fix state.ts (reasoning not accumulated), passes after.Verified:
go test -short ./internal/gateway/... ./internal/app/archiegateway/... ./internal/domain/messaging/...,pnpm test(105 pass),pnpm run typecheck,pnpm run build,task check(all on this exact tree). No live browser check: running the full stack needs a configured model provider, which this environment does not have; the SSE frame shape was verified against internal/webui/chat.go's default branch and the UI frame handling is covered by the node test.Note: internal/app/archiegateway/chat_setup.go is outside the listed ownership, but the SDK stream is only read there; the change is a pure move of the drain into internal/gateway plus one call site, which is what lets the gateway own (and test) the reasoning forwarding.
The ai-sdk FullStream drain moves from the archiegateway composition into internal/gateway (DrainStreamParts), next to the TurnStream it feeds, and gains a StreamPartReasoningDelta case: each reasoning delta is forwarded on the new optional ReasoningStream method, which localChatStream turns into a ChatEvent{Kind: "reasoning", Text: delta} on the same stream. done/error semantics are unchanged, and the FullStream is still drained to close when no stream is attached.