#8648: fix: don't treat bare numeric Discord IDs as definitive target IDs
stale
Cluster:
Discord and MS Teams Fixes
## Summary
- Bare numeric Discord IDs are ambiguous (could be user or channel)
- Previously `looksLikeDiscordTargetId()` returned true for these, causing the resolver to skip directory lookup
- This caused "Unknown Channel" errors when users tried to send DMs using bare numeric user IDs
## Changes
- Modified `looksLikeDiscordTargetId()` to return false for bare numeric IDs
- This allows the target resolver to attempt directory lookup or surface a helpful error message
- Explicit prefixed targets (`user:ID`, `channel:ID`, `<@ID>`) continue to work as before
## Test plan
- [x] Run type checking (`npm run check`)
- [x] Run Discord target tests (`vitest run src/discord/targets.test.ts`)
- [x] Run target resolver tests (`vitest run src/infra/outbound/target-resolver`)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR adjusts Discord target normalization heuristics so bare numeric IDs (e.g. `"123"`) are no longer treated as definitive Discord target IDs. Previously `looksLikeDiscordTargetId()` returned true for `/^\d{6,}$/`, which caused upstream resolution logic to skip directory lookup and could lead to “Unknown Channel” when users intended a DM to a user ID. Mentions (`<@id>`) and explicit prefixes (`user:`, `channel:`, `discord:`) remain recognized as definitive IDs.
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk.
- Change is narrowly scoped to a single heuristic function, aligns with existing parsing behavior (bare numerics are ambiguous), and does not affect explicit target formats; no additional side effects observed in related resolver code.
- No files require special attention
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#12204: fix(discord): resolve numeric guildId/channelId pairs in channel al...
by mcaxtr · 2026-02-09
84.0%
#22557: fix(discord): coerce exec approval approver IDs to string to preven...
by zwffff · 2026-02-21
79.0%
#22221: fix: preserve case of target ID in normalizeTargetId
by zerone0x · 2026-02-20
77.6%
#21463: fix(discord): prevent WebSocket death spiral + fix numeric channel ID…
by akropp · 2026-02-20
76.9%
#16828: fix(config): transform Discord user/role IDs to strings
by Limitless2023 · 2026-02-15
75.8%
#13489: fix: preserve Slack channel/user ID case in target normalization
by sandieman2 · 2026-02-10
75.7%
#8024: fix(slack): resolve channel names via directory for cross-account m...
by emma-digital-assistant · 2026-02-03
75.7%
#22524: fix(doctor): preserve precision of large Discord snowflake IDs in -...
by jmasson · 2026-02-21
75.5%
#17380: fix(imessage): reject non-numeric chat_id values to prevent silent ...
by aldoeliacim · 2026-02-15
74.5%
#17070: fix(telegram): Outbound: ignore empty legacy target fields
by yhw2003 · 2026-02-15
73.8%