Skip to content

fix: don't reset chat status to Ready while tools are executing#1283

Merged
EItanya merged 1 commit intokagent-dev:mainfrom
opspawn:fix/325-ready-status-during-tools
Feb 12, 2026
Merged

fix: don't reset chat status to Ready while tools are executing#1283
EItanya merged 1 commit intokagent-dev:mainfrom
opspawn:fix/325-ready-status-during-tools

Conversation

@opspawn
Copy link
Contributor

@opspawn opspawn commented Feb 11, 2026

Summary

Fixes the chat interface showing "Ready" while tools are still executing (#325).

Problem

The finally block in handleSendMessage unconditionally called setChatStatus('ready') after the SSE stream loop ended. This overrode transitional statuses like processing_tools and generating_response that were correctly set by the message handlers during tool execution.

Fix

Removed the unconditional setChatStatus('ready') from the finally block. The message handlers (finalizeStreaming, handleA2ATaskStatusUpdate, handleA2ATaskArtifactUpdate) already set the correct status when the final stream event arrives. Error paths (AbortError, streaming failures, session creation errors) still correctly set their own status via their respective catch blocks.

Fixes #325

Copilot AI review requested due to automatic review settings February 11, 2026 07:50
@opspawn opspawn requested a review from peterj as a code owner February 11, 2026 07:50
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a bug where the chat interface incorrectly displayed "Ready" status while agent tools were still executing. The root cause was that the finally block in the handleSendMessage function unconditionally reset the chat status to "ready" after the SSE stream loop ended, which prematurely overrode the transitional statuses ("processing_tools", "generating_response") that were correctly set by message handlers during ongoing tool execution.

Changes:

  • Removed the unconditional setChatStatus("ready") call from the finally block in handleSendMessage
  • Added explanatory comments documenting that message handlers already set the appropriate status when final stream events arrive
  • Error paths continue to correctly set their own status via their respective catch blocks

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@EItanya EItanya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there thanks for the fix, in order for me to approve DCO needs to pass. In order for it to pass you'll need to sign all of your commits

Remove the unconditional setChatStatus('ready') from the finally block
in handleSendMessage. The message handlers (finalizeStreaming,
handleA2ATaskStatusUpdate, handleA2ATaskArtifactUpdate) already set the
correct status when the final stream event arrives. The unconditional
reset was overriding transitional states like 'processing_tools' and
'generating_response', causing the UI to show 'Ready' while tools were
still executing.

Error paths (AbortError, streaming failures, session creation errors)
still correctly set their own status via their respective catch blocks.

Fixes kagent-dev#325

Signed-off-by: OpSpawn <opspawn@users.noreply.github.com>
@opspawn opspawn force-pushed the fix/325-ready-status-during-tools branch from 80cbb6b to 5f5cd10 Compare February 11, 2026 23:51
@opspawn
Copy link
Contributor Author

opspawn commented Feb 12, 2026

Hi @EItanya, just wanted to follow up -- the DCO check is now passing. Would you be able to re-review this PR when you get a chance? Happy to make any further changes if needed. Thanks!

@EItanya EItanya merged commit 892be52 into kagent-dev:main Feb 12, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Chat interface shows "Ready" while the tools are still executing

3 participants