#14912: fix(slack): enable session-store lookup for announce target accountId
channel: slack
agents
size: S
trusted-contributor
experienced-contributor
Cluster:
Network Error Handling Improvements
## Summary
Fixes #14854
- Adds `preferSessionLookupForAnnounceTarget: true` to the Slack channel plugin meta, matching the existing WhatsApp pattern
- Without this flag, `resolveAnnounceTarget()` returns immediately from the key-parsed fallback path — which never carries `accountId` — so Slack announce messages lose their account context in multi-account setups
## Test plan
- [x] Add Slack plugin stub with `preferSessionLookupForAnnounceTarget: true` to test registry
- [x] Add test verifying `resolveAnnounceTarget()` hydrates `accountId` from `sessions.list` for Slack sessions
- [x] All 3 tests pass after fix; new test fails without the flag (returns fallback with no `accountId`)
- [x] `pnpm build && pnpm check` pass
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR enables `preferSessionLookupForAnnounceTarget: true` on the Slack channel plugin metadata and adds a focused regression test.
In the current `resolveAnnounceTarget()` implementation (`src/agents/tools/sessions-announce-target.ts`), plugins without this flag return a target derived from the session key/display key immediately. That parsed fallback does not include `accountId`, so Slack announce messages can lose account context in multi-account setups. With the flag enabled, `resolveAnnounceTarget()` performs a `sessions.list` lookup and hydrates `accountId` from the session’s `deliveryContext` when available (mirroring the existing WhatsApp behavior).
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk.
- The change is a single metadata flag addition plus a regression test that matches the existing WhatsApp pattern. The new test exercises the intended `sessions.list` hydration path and does not alter core resolution logic.
- No files require special attention
<sub>Last reviewed commit: 58003ad</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#16812: Fix sessions_send failing on Telegram, Discord, Signal, and Slack
by Clawborn · 2026-02-15
83.0%
#8024: fix(slack): resolve channel names via directory for cross-account m...
by emma-digital-assistant · 2026-02-03
79.0%
#16830: fix: session lookup default
by Limitless2023 · 2026-02-15
76.7%
#19083: Slack: preserve per-thread context and consistent thread replies
by jkimbo · 2026-02-17
76.3%
#13489: fix: preserve Slack channel/user ID case in target normalization
by sandieman2 · 2026-02-10
76.0%
#22433: Slack: fix thread context loss after session reset
by stgarrity · 2026-02-21
75.4%
#19567: Fix: tighten Slack multi-account event filtering via api_app_id
by TARS-Nolan · 2026-02-17
75.3%
#13881: fix: Address Greptile feedback - test isolation and channel resolution
by trevorgordon981 · 2026-02-11
75.2%
#13882: feat: Enhance session checkpoint system with better types and valid...
by trevorgordon981 · 2026-02-11
74.8%
#14847: fix(slack): preserve auth across Slack-hosted file redirects
by natashache · 2026-02-12
74.6%