fix(gateway/slack): send tool call progress messages to correct Slack thread - #2956
Closed
jneeee wants to merge 1 commit into
Closed
fix(gateway/slack): send tool call progress messages to correct Slack thread#2956jneeee wants to merge 1 commit into
jneeee wants to merge 1 commit into
Conversation
Contributor
|
Merged via PR #3063. Cherry-picked onto current main with authorship preserved. Clean fix — thanks for tracking this down! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Slack tool call progress messages (e.g.
⚙️ read_file: "...") were appearing in the wrong place:reply_to=ts, but progress messages had no thread anchor.source.thread_id = ts(fallback).Root Cause
In
gateway/run.py,_progress_metadatawas built solely fromsource.thread_id:For DM top-level messages,
source.thread_id = None(by design — DMs share one session). So_progress_metadata = None, and progress messages were sent withoutthread_tsto the DM root.Meanwhile, the final response was sent with
reply_to=event.message_id(the original message'sts), which correctly created a thread. The progress messages and final response ended up in different places.Fix
event_message_idparameter to_run_agent()._handle_message_with_agentpassesevent.message_idto_run_agent._progress_metadatanow usessource.thread_id or event_message_idas the thread anchor, matching whatreply_todoes for the final response._status_thread_metadataand stream consumer metadata for consistency.Tests
Added
TestProgressMessageThreadintests/gateway/test_slack.py:source.thread_id = None(session keying unaffected)message_id = tsis available as thread fallbacksend()passes correctthread_tswhenmetadata.thread_idis set