Skip to content

fix(slack): expose thread_ts in sender_json so agents reply in thread#444

Merged
thepagent merged 3 commits intoopenabdev:mainfrom
dogzzdogzz:fix/slack-reply-to-channel-root
Apr 18, 2026
Merged

fix(slack): expose thread_ts in sender_json so agents reply in thread#444
thepagent merged 3 commits intoopenabdev:mainfrom
dogzzdogzz:fix/slack-reply-to-channel-root

Conversation

@dogzzdogzz
Copy link
Copy Markdown
Contributor

@dogzzdogzz dogzzdogzz commented Apr 18, 2026

Problem

When an agent calls chat.postMessage directly via the Slack API, it needs to pass thread_ts to keep replies in the correct thread. Previously, SenderContext serialized the thread identifier as \"thread_id\" — a generic platform-agnostic name that agents could not reliably map to Slack's thread_ts parameter. As a result, messages were posted to channel root instead of the thread.

This is a Slack-only issue. Discord threads are separate channels, so channel_id already identifies the thread — no separate thread_ts concept exists.

Discussion: https://discord.com/channels/1491295327620169908/1494739741600387204/1494944277694775457

Solution

Change AdapterRouter::handle_message to accept a pre-serialized sender_json: &str so each platform adapter controls its own serialization format:

  • slack.rs: renames \"thread_id\"\"thread_ts\" before passing to handle_message
  • discord.rs: serializes as-is (no change in behavior)
  • adapter.rs: removes internal serde_json::to_string(sender) call

Agent now receives:
```json
{
"channel": "slack",
"channel_id": "C99999",
"thread_ts": "1234567890.123456"
}
```

No shared layer is polluted with Slack-specific logic.

Files Changed

  • src/adapter.rs — signature change only
  • src/slack.rs — custom serialization with thread_ts key
  • src/discord.rs — standard serialization, no behavior change

Test Plan

  • cargo clippy -- -D warnings passes
  • Slack: agent replies with thread_ts → message stays in thread
  • Discord: behavior unchanged

🤖 Generated with Claude Code

@dogzzdogzz dogzzdogzz requested a review from thepagent as a code owner April 18, 2026 09:57
@github-actions github-actions bot added closing-soon PR missing Discord Discussion URL — will auto-close in 3 days and removed closing-soon PR missing Discord Discussion URL — will auto-close in 3 days labels Apr 18, 2026
@thepagent thepagent merged commit 7362ebd into openabdev:main Apr 18, 2026
10 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.

2 participants