Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 3 additions & 15 deletions src/messaging/slack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,7 @@ async fn handle_message_event(
}
}

let base_conversation_id = if let Some(ref thread_ts) = msg_event.origin.thread_ts {
format!("slack:{}:{}:{}", team_id_str, channel_id, thread_ts.0)
} else {
format!("slack:{}:{}", team_id_str, channel_id)
};
let base_conversation_id = format!("slack:{}:{}", team_id_str, channel_id);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Now that conversation_id is per-channel, watch out for cross-thread reply misrouting if multiple threads interleave: outbound routing that pulls slack_thread_ts from the current latest_message can end up replying into the wrong thread when a worker finishes later. If this shows up in practice, consider pinning the outbound target (thread_ts) from the triggering inbound message at enqueue time instead of reading it from latest_message at send time.

let conversation_id =
apply_runtime_adapter_to_conversation_id(&adapter_state.runtime_key, base_conversation_id);

Expand Down Expand Up @@ -376,11 +372,7 @@ async fn handle_app_mention_event(
return Ok(());
}

let base_conversation_id = if let Some(ref thread_ts) = mention.origin.thread_ts {
format!("slack:{}:{}:{}", team_id_str, channel_id, thread_ts.0)
} else {
format!("slack:{}:{}", team_id_str, channel_id)
};
let base_conversation_id = format!("slack:{}:{}", team_id_str, channel_id);
let conversation_id =
apply_runtime_adapter_to_conversation_id(&adapter_state.runtime_key, base_conversation_id);

Expand Down Expand Up @@ -658,11 +650,7 @@ async fn handle_interaction_event(
// Use trigger_id as the unique message id for this interaction turn.
let msg_id = block_actions.trigger_id.0.clone();

let base_conversation_id = if let Some(ref ts) = message_ts {
format!("slack:{}:{}:{}", team_id, channel_id, ts)
} else {
format!("slack:{}:{}", team_id, channel_id)
};
let base_conversation_id = format!("slack:{}:{}", team_id, channel_id);
let conversation_id =
apply_runtime_adapter_to_conversation_id(&adapter_state.runtime_key, base_conversation_id);

Expand Down
Loading