fix(flows): route Copilot reasoning to Agentic task insights (B4)#4662
Conversation
Between-tool narration currently double-renders: once live via the tool timeline, and again as a persisted chat bubble once ChatRuntimeProvider appends it on chat_done. Tag that narration with extraMetadata.isInterim when persisting it, and have useWorkflowBuilderChat expose a displayMessages view (the full messages transcript with isInterim agent messages filtered out) for WorkflowCopilotPanel to render instead of the raw list. The main chat is unaffected — it still renders every message — and a turn's terminal answer (including a tinyhumansai#4630-style clarifying question, which is never tagged isInterim) still renders as a bubble. Split from tinyhumansai#4650.
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds ChangesInterim message filtering
Estimated code review effort: 2 (Simple) | ~15 minutes Sequence Diagram(s)sequenceDiagram
participant ChatRuntimeProvider
participant useWorkflowBuilderChat
participant WorkflowCopilotPanel
ChatRuntimeProvider->>useWorkflowBuilderChat: addInferenceResponse with extraMetadata.isInterim
useWorkflowBuilderChat->>useWorkflowBuilderChat: filter messages into displayMessages
useWorkflowBuilderChat->>WorkflowCopilotPanel: return messages and displayMessages
WorkflowCopilotPanel->>WorkflowCopilotPanel: render transcript from displayMessages
Possibly related PRs
Suggested labels: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
app/src/providers/ChatRuntimeProvider.tsx (1)
878-905: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winCorrect and well-scoped; consider a debug log for the new tagging decision.
The
isInterimtagging is correctly scoped to between-tool narration only —onSegment/chat_donepaths (which represent the terminal answer) are left untouched, matching the intended filtering contract inuseWorkflowBuilderChat.Since this introduces a new interim-vs-terminal distinction that downstream code now depends on for correct rendering, consider adding a
rtLogcall here (thread/request/round correlation, mirroring theworkflow proposal parsedlogging pattern elsewhere in this handler) to aid future debugging if the double-render regression resurfaces.As per coding guidelines: "On new or changed flows, add verbose debug logging with stable prefixes, correlation fields, and no secrets or full PII; incomplete changes are those lacking logging."
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@app/src/providers/ChatRuntimeProvider.tsx` around lines 878 - 905, Add a debug log in the `onInterim` handler around the new `isInterim` tagging decision, using `rtLog` with a stable prefix and correlation fields for thread/request/round so the interim-vs-terminal split is easy to trace later. Keep the log scoped to `ChatRuntimeProvider`’s interim path only, mirroring the existing “workflow proposal parsed” style, and avoid logging secrets or full content while still showing enough context to debug replay or double-render issues.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@app/src/providers/ChatRuntimeProvider.tsx`:
- Around line 878-905: Add a debug log in the `onInterim` handler around the new
`isInterim` tagging decision, using `rtLog` with a stable prefix and correlation
fields for thread/request/round so the interim-vs-terminal split is easy to
trace later. Keep the log scoped to `ChatRuntimeProvider`’s interim path only,
mirroring the existing “workflow proposal parsed” style, and avoid logging
secrets or full content while still showing enough context to debug replay or
double-render issues.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 91252d41-c051-4c91-8c60-979bfb8a8114
📒 Files selected for processing (5)
app/src/components/flows/WorkflowCopilotPanel.test.tsxapp/src/components/flows/WorkflowCopilotPanel.tsxapp/src/hooks/useWorkflowBuilderChat.test.tsapp/src/hooks/useWorkflowBuilderChat.tsapp/src/providers/ChatRuntimeProvider.tsx
…@coderabbitai on ChatRuntimeProvider.tsx:878) CodeRabbit nitpick: the new interim-vs-terminal split that displayMessages now depends on for correct rendering had no debug logging. Add an rtLog call mirroring the existing "workflow proposal parsed" style so the double-render regression (if it resurfaces) is traceable via thread/ request/round correlation.
|
@coderabbitai nitpick on |
|
Tip For best results, initiate chat on the files or code changes.
|
The bug
The
workflow_builderagent narrates between tool calls ("Let me check…", "Now let me build…", "The mock doesn't match…").ChatRuntimeProvider'sonInterimpersisted each narration as a permanent agent message, so it rendered twice: once live via the tool timeline / streaming preview, and again as a permanent chat bubble once persisted. Only the turn's terminal answer should ever become a bubble — the rest is reasoning that belongs in the Agentic task insights timeline.The fix
ChatRuntimeProvider: tag interimaddInferenceResponsemessages withextraMetadata.isInterim: true(additive — the main chat is unaffected, it still renders every message).useWorkflowBuilderChat: newdisplayMessages=messagesfiltered to drop agent messages taggedisInterim.messagesitself is kept fully intact (full transcript) for callers that need it.WorkflowCopilotPanel: rendersdisplayMessagesinstead ofmessagesfor the bubble list (and the scroll-to-bottom effect);ToolTimelineBlock+ the live streaming preview are unchanged.assistantTextfallback insend()with noisInterimtag — still renders as a bubble.Verification
pnpm typecheck,eslint,format:check— clean on all changed files.vitest runon the touched test files — 21/21 passing, including a new isInterim-bubble-suppression test inWorkflowCopilotPanel.test.tsxand thedisplayMessagesfilter test inuseWorkflowBuilderChat.test.ts.Note
Split from #4650 (previously combined with B11 in one PR since they touched the same files). This PR is B4 standalone; B11 (chat persistence) stacks on top of this one in a separate PR.
Summary by CodeRabbit
New Features
displayMessagesview for transcript rendering.Bug Fixes