#16830: fix: session lookup default
agents
stale
size: XS
Cluster:
Network Error Handling Improvements
Fixes #16660
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Changed the default behavior for announce target resolution to prefer session lookup unless explicitly disabled. The condition was inverted from `!plugin?.meta?.preferSessionLookupForAnnounceTarget` to `plugin?.meta?.preferSessionLookupForAnnounceTarget === false`, making session lookup the new default for all channels that don't explicitly opt out.
- This is a **breaking change** for channels like Discord that currently rely on fallback behavior (undefined treated as opt-out)
- The existing test `sessions-announce-target.e2e.test.ts:64-72` expects Discord to skip the gateway call, but will now fail
- Only WhatsApp currently sets `preferSessionLookupForAnnounceTarget: true` explicitly, so it's unaffected
- All other channels (Discord, Telegram, Signal, etc.) will now perform session lookups by default
The change needs either channel plugin metadata updates or test updates to align expectations.
<h3>Confidence Score: 2/5</h3>
- This PR introduces a breaking behavioral change that conflicts with existing test expectations
- The logic change is intentional but breaks the existing test contract for Discord (and potentially other channels). The test explicitly expects Discord NOT to call `callGateway`, but the new logic will cause it to do so. This needs either: (1) Discord's plugin to explicitly set `preferSessionLookupForAnnounceTarget: false`, or (2) the test to be updated to reflect new expected behavior. Without knowing which channels should use session lookup vs fallback, this could cause runtime issues.
- Pay close attention to `src/agents/tools/sessions-announce-target.ts` and the test file - the behavior change needs validation across all channel types
<sub>Last reviewed commit: 2c8da99</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
81.5%
#15744: fix: allow cross-agent session path validation
by scottgl9 · 2026-02-13
77.6%
#14795: fix: skip disabled channel plugins in cross-context messaging checks
by explainanalyze · 2026-02-12
77.1%
#14912: fix(slack): enable session-store lookup for announce target accountId
by mcaxtr · 2026-02-12
76.7%
#22469: fix(gateway): avoid stale whatsapp labels on direct sessions
by loganprit · 2026-02-21
76.3%
#20078: feat(session): Add channelGroups config(optional config) for shared...
by demarlik01 · 2026-02-18
75.7%
#17527: fix(gateway): allow WebChat to attach to main session regardless of...
by Glucksberg · 2026-02-15
74.9%
#6850: fix: support direct channel:account:peer format in session key extr...
by toboto · 2026-02-02
74.7%
#16061: fix(sessions): tolerate invalid sessionFile metadata
by haoyifan · 2026-02-14
74.5%
#17513: fix(discord): respect groupPolicy in channel config fallback (#4555)
by aronchick · 2026-02-15
74.1%