Repository navigation
Conversation
Greptile SummaryThis PR wires Confidence Score: 5/5Safe to merge; the single finding is a cosmetic inconsistency in streaming UI behavior that does not affect correctness or data integrity. All changes are logically sound. The gateway reasoning buffer, signature-based dedup, and structured message building are correctly implemented. The only finding is P2 (hardcoded showReasoning: true in the streaming group bypassing user preferences), which does not block merge. ui/src/ui/chat/grouped-render.ts — renderStreamingGroup should accept and forward showReasoning to match renderMessageGroup behavior. Prompt To Fix All With AIThis is a comment left during a code review.
Path: ui/src/ui/chat/grouped-render.ts
Line: 152-155
Comment:
**`showReasoning` hardcoded true for streaming group**
`renderStreamingGroup` always passes `showReasoning: true`, bypassing the user's "Show Thinking" preference and the session's `reasoningLevel`. A user who has set `showThinking: false` (or is on a session where `reasoningLevel === "off"`) will still see thinking bubbles while the run is in-flight, then have them disappear the moment the message finalises. `renderStreamingGroup` has no corresponding parameter, unlike `renderMessageGroup`. The fix is to thread `showReasoning` through the call site.
Add `showReasoning?: boolean` to the function signature and pass it from `views/chat.ts` where `renderStreamingGroup` is called with `props`-derived `showReasoning`.
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "fix(control-ui): stream reasoning in liv..." | Re-trigger Greptile |
| message, | ||
| `stream:${startedAt}`, | ||
| { isStreaming: true, showReasoning: false }, | ||
| { isStreaming: true, showReasoning: true }, | ||
| onOpenSidebar, |
There was a problem hiding this comment.
showReasoning hardcoded true for streaming group
renderStreamingGroup always passes showReasoning: true, bypassing the user's "Show Thinking" preference and the session's reasoningLevel. A user who has set showThinking: false (or is on a session where reasoningLevel === "off") will still see thinking bubbles while the run is in-flight, then have them disappear the moment the message finalises. renderStreamingGroup has no corresponding parameter, unlike renderMessageGroup. The fix is to thread showReasoning through the call site.
Add showReasoning?: boolean to the function signature and pass it from views/chat.ts where renderStreamingGroup is called with props-derived showReasoning.
Prompt To Fix With AI
This is a comment left during a code review.
Path: ui/src/ui/chat/grouped-render.ts
Line: 152-155
Comment:
**`showReasoning` hardcoded true for streaming group**
`renderStreamingGroup` always passes `showReasoning: true`, bypassing the user's "Show Thinking" preference and the session's `reasoningLevel`. A user who has set `showThinking: false` (or is on a session where `reasoningLevel === "off"`) will still see thinking bubbles while the run is in-flight, then have them disappear the moment the message finalises. `renderStreamingGroup` has no corresponding parameter, unlike `renderMessageGroup`. The fix is to thread `showReasoning` through the call site.
Add `showReasoning?: boolean` to the function signature and pass it from `views/chat.ts` where `renderStreamingGroup` is called with `props`-derived `showReasoning`.
How can I resolve this? If you propose a fix, please make it concise.There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e4a0c38ade
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| `stream:${startedAt}`, | ||
| { isStreaming: true, showReasoning: false }, | ||
| { isStreaming: true, showReasoning: true }, |
There was a problem hiding this comment.
Respect reasoning visibility setting for streaming bubbles
renderChat computes showReasoning from props.showThinking, but the streaming path ignores that and always renders with showReasoning: true. This means users who disabled reasoning still see live thinking blocks during deltas (they then disappear/inconsistently differ from finalized history), which is a behavior regression for the reasoning visibility control.
Useful? React with 👍 / 👎.
| if ((!text || shouldSuppressSilent) && !reasoning) { | ||
| return undefined; |
There was a problem hiding this comment.
Suppress hidden heartbeat reasoning in final chat payloads
buildAssistantChatMessage allows a message whenever reasoning exists, even when resolveBufferedChatTextState has already marked text as suppressed (including heartbeat suppression). In heartbeat runs where showOk is false, any streamed thinking event can now produce a reasoning-only final chat message, leaking heartbeat output that the heartbeat visibility gate is meant to hide.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c599a87e76
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| sourceRunId, | ||
| ); | ||
| const hasReasoning = Boolean(resolveBufferedReasoningText(clientRunId)); | ||
| if (!hasReasoning && (shouldSuppressSilent || shouldSuppressLeadFragment)) { |
There was a problem hiding this comment.
Keep control-token prefixes suppressed during reasoning deltas
Once hasReasoning is true, this guard no longer suppresses lead-fragment control tokens (NO_, ANNOUNCE_, REPLY_). In runs that stream thinking before assistant text, delta payloads can therefore include transient control-token prefixes, because buildAssistantChatMessage only suppresses fully silent tokens and still emits partial text. This leaks internal control text into live chat for silent/skip-style replies; lead-fragment suppression should remain active even when reasoning is present.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: af397f9a20
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (!preserveActiveStream) { | ||
| // Reset orphaned chat run state from before disconnect. | ||
| // Any in-flight run's final event was lost during the disconnect window. | ||
| host.chatRunId = null; | ||
| streamingHost.chatStream = null; |
There was a problem hiding this comment.
Clear stale chat run state when reconnecting after disconnect
This new guard preserves chatRunId/chatStream on hello whenever any streaming state exists, but reconnect creates a fresh gateway client and does not replay events missed during the disconnect window. If a run finishes while the socket is down, the terminal chat event is never seen, this branch skips cleanup, and the UI remains stuck in an active-run state (stop-only controls, deferred history reloads blocked because chatRunId stays non-null). The previous unconditional reset avoided this orphaned-run wedge.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ba87576d8d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (mergedReasoning) { | ||
| chatRunState.reasoningBuffers.set(clientRunId, mergedReasoning); | ||
| emitChatDelta( |
There was a problem hiding this comment.
Reap reasoning buffers when runs are orphaned
This write path stores per-run reasoning text, but the orphan/timeout cleanup paths still only purge chatRunBuffers, chatDeltaSentAt, and chatDeltaLastBroadcastLen (for example in abortChatRunById and startGatewayMaintenanceTimers). If a run is aborted or the lifecycle terminal event is missed, the new reasoning entry is never deleted, so long-lived gateways can accumulate unbounded stale reasoning data in memory.
Useful? React with 👍 / 👎.
| const hasStreamMessage = !!props.stream && typeof props.stream === "object"; | ||
| if (hasStreamText || hasStreamMessage) { |
There was a problem hiding this comment.
Fall back to reading indicator for hidden reasoning streams
Treating any object stream as renderable means reasoning-only stream payloads now produce kind: "stream" even when showThinking is off. In that case renderGroupedMessage suppresses both text and reasoning content, so the old reading-indicator path is skipped and users see an empty assistant row (avatar/footer) until text arrives, which is a visible regression for reasoning-hidden sessions.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4cd6894a73
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (shouldReplayDeferredSessionMessageReload && !historyReloaded) { | ||
| void loadChatHistory(host as unknown as ChatState); |
There was a problem hiding this comment.
Reload history for final events that return no assistant payload
After removing the unconditional state === "final" reload path, this handler now reloads history only for deferred session.message cases. That breaks the existing handleChatEvent contract where a final from a different run returns "final" when payload.message is absent (used to trigger a history refresh for detached/sub-agent announcements), so those messages can be missed while another run is active and no deferred replay fires.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d6b13e19dc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| return; | ||
| } | ||
| chatRunState.deltaSentAt.set(clientRunId, now); | ||
| chatRunState.deltaLastBroadcastLen.set(clientRunId, mergedText.length); | ||
| chatRunState.deltaLastBroadcastSignature.set(clientRunId, signature); |
There was a problem hiding this comment.
Reap broadcast signatures when runs are aborted or orphaned
deltaLastBroadcastSignature is populated for every emitted delta, but the abort/orphan cleanup paths still only purge the legacy chatDeltaLastBroadcastLen map (chat-abort.ts and server-maintenance.ts). If a run is timed out/aborted without a normal lifecycle terminal event, this signature entry is never removed, so long-lived gateways can accumulate stale per-run signatures in memory over time.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8dc754d4e2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| function hasActiveStreamingState(host: GatewayHostWithStreamingState) { | ||
| return ( | ||
| host.chatRunId !== null || | ||
| host.chatStream !== null || |
There was a problem hiding this comment.
Treat missing chatStream as inactive in stream-state guard
hasActiveStreamingState marks a host as streaming whenever chatStream !== null, but chatStream is optional in GatewayHostWithStreamingState. For hosts that omit this field (so it is undefined), this evaluates to true and causes reconnect onHello to preserve/skip-reset streaming state and skip chat-tab refreshes as if a run were active. That can leave stale chat state and prevent expected history reloads after reconnect for valid GatewayHost callers that don't carry chat-stream fields.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c58063ba94
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (props.stream.trim().length > 0) { | ||
| const hasStreamText = typeof props.stream === "string" && props.stream.trim().length > 0; | ||
| const hasStreamMessage = !!props.stream && typeof props.stream === "object"; | ||
| if (hasStreamText || hasStreamMessage) { |
There was a problem hiding this comment.
Keep reading indicator for reasoning-only structured streams
When props.stream is an object, hasStreamMessage makes buildChatItems emit a kind: "stream" item even if there is no visible text. In that case text becomes "", and the current stream renderer path still renders from item.text only, so reasoning-only deltas (or hidden-reasoning sessions) show an empty assistant bubble instead of the reading indicator. This is a user-visible regression introduced by the new object-stream branch.
Useful? React with 👍 / 👎.
|
Quick status update here: I replayed the fix onto current At this point, the remaining blocker does not look PR-specific:
So my current read is that the PR itself is largely recovered, and it is now blocked by a shared topology-guard failure rather than a PR-local regression. I do not plan to keep changing these 3 UI files to chase this guard unless there is evidence the failure is actually PR-specific. If this is a known branch-wide/mainline issue, I think the next step is either:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cfbf464d7e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const hasStreamText = typeof props.stream === "string" && props.stream.trim().length > 0; | ||
| const hasStreamMessage = !!props.stream && typeof props.stream === "object"; | ||
| if (hasStreamText || hasStreamMessage) { |
There was a problem hiding this comment.
Plumb structured stream payloads through chat state
buildChatItems now treats object-valued props.stream as a renderable stream item, but the rest of the chat pipeline still collapses deltas to plain text (handleChatEvent assigns state.chatStream from extractText(payload.message)) and ChatProps.stream/state are still typed as string | null. That means structured or reasoning-only deltas never reach this new object branch in real runs, so live reasoning still will not render despite the added handling here. This needs end-to-end structured payload plumbing, not only renderer-side support.
Useful? React with 👍 / 👎.
|
Quick update: this PR is now back to a clean, mergeable state.
The latest fixes covered both the history/final bubble path and the live stream rendering path for reasoning visibility, and the targeted UI regressions are now in place on the PR branch. |
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Close as superseded: this PR is now a partial Control UI renderer change that does not carry structured thinking payloads through the live gateway/controller path, while the same end-to-end reasoning-stream work is already tracked by #59086 and related open issues. So I’m closing this here and keeping the remaining discussion on the canonical linked item. Review detailsBest possible solution: Keep one coordinated end-to-end reasoning stream path that carries structured thinking/text through gateway emission, controller/app state, stream segments, and rendering while preserving the separate /reasoning visibility contract. Do we have a high-confidence way to reproduce the issue? Yes at source level. Current main stores live chat streams as text and emits text-only gateway chat messages, so a thinking-only payload has no current path to the renderer branch added here. Is this the best way to solve the issue? No. Renderer support is useful, but this PR is not the narrowest maintainable standalone fix because the live stream contract needs to be plumbed end to end and coordinated with #59086. Security review: Security review needs attention: The diff has no dependency or workflow changes, but it can widen displayed reasoning by coupling /reasoning visibility to /think effort.
What I checked:
Likely related people:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 58bfefbad3e3. |
Summary
thinkingandtexttogetherValidation