Skip to content

Fix Discord cron routing fallback - #40

Merged
kat3samsin merged 1 commit into
trunkfrom
agent/fix-cron-discord-routing
Jul 13, 2026
Merged

Fix Discord cron routing fallback#40
kat3samsin merged 1 commit into
trunkfrom
agent/fix-cron-discord-routing

Conversation

@kat3samsin

Copy link
Copy Markdown
Owner

What changed

  • Route Discord cron notifications only to payload.discordThreadId or the explicit channels.discord.defaultChannelId.
  • Fail closed when a Discord destination is missing, invalid, or unavailable instead of falling back to the active-channel DM path.
  • Distinguish Discord Unknown Channel responses from network, authentication, and other fetch failures.
  • Document the routing contract and add focused regression coverage.

Why

The live cron route fields were removed after channel lookup failures were treated as stale targets. With Discord active, untargeted cron notifications then fell through to the active-channel sender, which resolved allowFrom as a user and delivered every job by DM.

This keeps per-job channel routing explicit and prevents configuration loss or a transient Discord failure from turning into an unexpected DM flood.

Testing

  • pnpm build
  • pnpm test — 81 files, 983 tests passed
  • pnpm lint
  • Claude review — no blockers after the follow-up pass

Manual testing

  1. Run a cron job with a valid payload.discordThreadId; confirm start and completion messages appear in that channel/thread and not in DM.
  2. Run an untargeted job with a valid channels.discord.defaultChannelId; confirm it posts there and does not use the DM path.
  3. Remove or invalidate both Discord targets; confirm the job still runs, delivery is skipped with a warning, and no DM is sent.
  4. Simulate Discord 10003 versus a network fetch failure; confirm only 10003 is reported as a missing channel.

@kat3samsin
kat3samsin merged commit 10206da into trunk Jul 13, 2026
6 checks passed
@kat3samsin
kat3samsin deleted the agent/fix-cron-discord-routing branch July 13, 2026 12:11
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.

1 participant