fix: route Slack mention triggers via message.created, not app_mention

Merged
KH
3mo ago
+28-11

Summary

  • hn-monitor and inbox-buddy both declared their Slack trigger as { on: 'app_mention' }. Live-traced via wrangler tail cloud-web-worker while reproducing the reported "hn-monitor didn't answer a Slack mention" bug: the mention arrived at the webhook as a plain message.created event, and cloud's relayfileTriggerMatchesEvent hard-excludes app_mention from generic resource matching — it can only ever match a literal app_mention eventType, which never actually arrives for thread replies. Dispatch logs confirmed "Integration watch dispatch matched no agents" for every mention.
  • Switched both personas to on: 'message.created' + channel-scoped paths + match: '@mention', the pattern already used in production by joke-bot and review-agent (pr-reviewer).
  • Updated the one inbox-buddy test that asserted the old (broken) trigger shape.

Test plan

  • npm run test:hn — 29/29 pass
  • node scripts/test.mjs tests/inbox-buddy.test.mjs — 19/19 pass
  • npm test (full suite) — 188/188 pass
  • npm run typecheck — clean
  • agentworkforce persona compile for both personas — clean, no persona.json diff
  • Redeploy hn-monitor/inbox-buddy and confirm a live Slack mention gets answered

🤖 Generated with Claude Code


Summary by cubic

Fixes missed Slack mention replies by routing hn-monitor and inbox-buddy via message.created with a channel-scoped path and @mention gate, instead of app_mention. Mentions in threads now dispatch to the agents reliably.

  • Bug Fixes
    • Updated Slack triggers to on: 'message.created' with paths: ['/slack/channels/${SLACK_CHANNEL}/**'] and match: '@mention'.
    • Adjusted inbox-buddy test to assert the new trigger shape.
    • Added inline comments clarifying ${SLACK_CHANNEL} is persona-kit deploy-time substitution, not JS template interpolation.