fix: Add missing chat tool input logs#26229
Conversation
There was a problem hiding this comment.
2 issues found across 2 files
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/cli/src/chat/chat-execution-manager.ts">
<violation number="1" location="packages/cli/src/chat/chat-execution-manager.ts:148">
P1: Custom agent: **Tests**
Community PR Guidelines (Testing Requirements) require PRs to include tests. This change adds new execution/logging behavior for chat tool runs, but no tests are included in the PR diff to cover the updated behavior.</violation>
<violation number="2" location="packages/cli/src/chat/chat-execution-manager.ts:148">
P3: This block duplicates the inputOverride preservation and runData popping logic already implemented in `waiting-webhooks.ts`. Consider extracting the shared logic into a helper to avoid divergence when this behavior changes.</violation>
</file>
Architecture diagram
sequenceDiagram
participant UI as Chat UI
participant CEM as ChatExecutionManager
participant State as Execution State
participant Ownership as OwnershipService
participant Runner as WorkflowRunner
Note over UI,Runner: Runtime Flow: Resuming Chat with Tool Input
UI->>CEM: sendMessage(message)
CEM->>State: Inspect top of nodeExecutionStack
alt NEW: Node is CHAT_TOOL_NODE_TYPE
CEM->>State: NEW: Clear waitTill (set to undefined)
CEM->>State: NEW: Disable node for resume
CEM->>State: NEW: Set rewireOutputLogTo = "AiTool"
opt Run Data exists for last node
CEM->>State: Pop last execution entry from runData
opt CHANGED: Entry has inputOverride
Note right of CEM: Preserves tool input visibility<br/>for the UI logs
CEM->>State: NEW: Push placeholder entry with preserved inputOverride
end
end
end
CEM->>Ownership: getWorkflowProjectCached(workflowId)
Ownership-->>CEM: Project details
CEM->>Runner: runNode(executionData)
Note over Runner: Workflow resumes execution
Runner-->>UI: Return updated chat state/logs
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| [{ json: message }], | ||
| ]; | ||
|
|
||
| if (runExecutionData.executionData!.nodeExecutionStack[0].node.type === CHAT_TOOL_NODE_TYPE) { |
There was a problem hiding this comment.
P1: Custom agent: Tests
Community PR Guidelines (Testing Requirements) require PRs to include tests. This change adds new execution/logging behavior for chat tool runs, but no tests are included in the PR diff to cover the updated behavior.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/cli/src/chat/chat-execution-manager.ts, line 148:
<comment>Community PR Guidelines (Testing Requirements) require PRs to include tests. This change adds new execution/logging behavior for chat tool runs, but no tests are included in the PR diff to cover the updated behavior.</comment>
<file context>
@@ -139,6 +145,31 @@ export class ChatExecutionManager {
[{ json: message }],
];
+ if (runExecutionData.executionData!.nodeExecutionStack[0].node.type === CHAT_TOOL_NODE_TYPE) {
+ runExecutionData.waitTill = undefined;
+ runExecutionData.executionData!.nodeExecutionStack[0].node.disabled = true;
</file context>
| const entryToPop = runDataArray[runDataArray.length - 1]; | ||
| // Preserve inputOverride so the LLM's input stays visible in logs after resume. | ||
| const preservedInputOverride = entryToPop?.inputOverride; | ||
| runDataArray.pop(); |
There was a problem hiding this comment.
You can simple use pop to retrieve the element and remove it from the array.
| const entryToPop = runDataArray[runDataArray.length - 1]; | |
| // Preserve inputOverride so the LLM's input stays visible in logs after resume. | |
| const preservedInputOverride = entryToPop?.inputOverride; | |
| runDataArray.pop(); | |
| const entryToPop = runDataArray.pop(); | |
| // Preserve inputOverride so the LLM's input stays visible in logs after resume. | |
| const preservedInputOverride = entryToPop?.inputOverride; |
Can runDataArray actually have undefined as an entry? If not then .pop() can not return undefined here doe to the outer check if (runDataArray?.length > 0) {, which is not recognized by TS apparently, so instead of optional checks like entryToPop?.inputOverride; you could also do const entryToPop = runDataArray.pop()!; (with !) which will ensure that this entry is not undefined also for TS (it will throw an error if it's undefined afaik).
There was a problem hiding this comment.
thanks @dlavrenuek , updated as suggested
…fix-chat-tool-input-in-logs
|
Got released with |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Summary
fixes issue when input logs was not displayed for chat tool


Related Linear tickets, Github issues, and Community forum posts
Review / Merge checklist
release/backport(if the PR is an urgent fix that needs to be backported)