Skip to content

feat(discord): notify captain on task done/blocked/failed status - #82

Merged
Ivory2024 merged 2 commits into
mainfrom
fm/discord-notify-done-failed-blocked
Oct 3, 2026
Merged

Ivory2024 merged 2 commits into
mainfrom
fm/discord-notify-done-failed-blocked

Conversation

@Ivory2024

Copy link
Copy Markdown
Owner

Intent

The developer (captain), operating overnight via a delegated Firstmate supervisor session, worked through a long backlog of fleet/automation maintenance: fixing a Discord duplicate-reply bug in the code-governance-sentinel pipeline, cleaning up 7 duplicate "auto-update-all" Notion issue pages causing repeated false alerts, filtering stale/retired job noise and raw stack traces out of the daily briefing, and reordering truncated Discord quota-alert messages so actionable items aren't cut off. They also asked for an automatic Discord notification whenever a task completes, fails, is blocked, or needs a decision (not just PR-ready/merge-wait), and specified this must go through proper code review/testing (30+ tests passing) and push through the repo's "no-mistakes" pipeline rather than a direct PR, since the firstmate repo requires PRs to go through that gate. The developer corrected a misdiagnosis (rejecting a "leave it as-is / mark 보류" plan) and insisted the duplicate Notion entries be deleted outright rather than reclassified, and told the assistant to act autonomously on review/approval decisions going forward rather than asking for confirmation each time. They also delegated verification of a sentinel false-positive fix (complexity_guard git diff range, model_quota_guard log-scan boundary, stale-lock pid file) to be investigated thoroughly for root-cause rather than surface fixes, in coordination with another agent (codex/opencode2).

What Changed

  • fm-discord-notify-status.sh: add fm_discord_send_plain_report helper and handle done:*, blocked:*, failed:* status lines by sending a plain Discord report (완료/막힘/실패) with the task's note, silently no-op when Discord is unconfigured.
  • fm-watch.sh: update signal_discord_decision_notifications comment to reflect that it now also pushes done/blocked/failed plain reports, not just yolo-off PR-ready.
  • docs/scripts.md: update fm-discord-notify-status.sh description to cover the new done/blocked/failed mapping.
  • tests/fm-discord-decision-push.test.sh: add test coverage for the new done/blocked/failed notification paths.

🤖 Generated with Claude Code

Risk Assessment

✅ Low: Doc/comment fix is accurate and matches new behavior; added tests exercise real CLI execution and assert actual posted Discord payload content (task id, note text, channel), not source-text matching, closing prior round's coverage gap without introducing new defects.

Testing

Targeted test file for this change was run in full (not the whole repo suite) and all 23 cases passed, including the 3 new ones covering done/blocked/failed. An additional manual adversarial check confirmed the notify-status script silently no-ops when Discord is unconfigured. Both recorded human fix decisions (stale doc/comment update, missing test coverage for new verbs) are present and verified working in this commit.

  • Live validation: ✅ go - 5 of 5 scenarios driven live against the product
Scenario Result Live Evidence
done status line sends plain Discord report ✅ pass live bash tests/fm-discord-decision-push.test.sh -> ok - a done status line sends a plain Discord report with the worker's note
blocked status line sends plain Discord report ✅ pass live bash tests/fm-discord-decision-push.test.sh -> ok - a blocked status line sends a plain Discord report with the worker's note
failed status line sends plain Discord report ✅ pass live bash tests/fm-discord-decision-push.test.sh -> ok - a failed status line sends a plain Discord report with the worker's note
existing ask-user-gate and pr-ready paths still work (no regression) ✅ pass live bash tests/fm-discord-decision-push.test.sh full run, 23/23 ok, including pr-ready and ask-user-gate cases
adversarial: done status with Discord unconfigured (no token/channel) is a silent no-op, not an error ✅ pass live manual run: FM_DISCORD_BOT_TOKEN='' FM_DISCORD_CHANNEL_ID='' ./bin/fm-discord-notify-status.sh task-z 'done: nothing configured' -> exit=0, no state/x-context record created

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 2 issues found → auto-fixed ✅
  • ℹ️ docs/scripts.md:155 - docs/scripts.md:155 still describes fm-discord-notify-status.sh as mapping only "an ask-user gate or yolo-off PR-ready status line," but this change adds done/blocked/failed plain-report notifications too. The sibling comment at bin/fm-watch.sh:1932-1934 ("Push only the two additional captain-facing transitions") is equally stale now that four transitions are pushed. Both are one-line doc/comment fixes with no behavior change.
  • ⚠️ bin/fm-discord-notify-status.sh:80 - The done:/blocked:/failed: branches are the headline feature of this change (commit title: "notify on task done/failed/blocked, not just pr-ready"), but no test exercises them — tests/fm-discord-decision-push.test.sh is unchanged and only covers the ask-user-gate and pr-ready paths. A wrong case match, wrong note extraction, or wrong channel selection in these new branches would go undetected.

🔧 Fix applied.
✅ Re-checked - no issues remain.

✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 5 of 5 scenarios driven live against the product
Scenario Result Live Evidence
done status line sends plain Discord report ✅ pass live bash tests/fm-discord-decision-push.test.sh -> ok - a done status line sends a plain Discord report with the worker's note
blocked status line sends plain Discord report ✅ pass live bash tests/fm-discord-decision-push.test.sh -> ok - a blocked status line sends a plain Discord report with the worker's note
failed status line sends plain Discord report ✅ pass live bash tests/fm-discord-decision-push.test.sh -> ok - a failed status line sends a plain Discord report with the worker's note
existing ask-user-gate and pr-ready paths still work (no regression) ✅ pass live bash tests/fm-discord-decision-push.test.sh full run, 23/23 ok, including pr-ready and ask-user-gate cases
adversarial: done status with Discord unconfigured (no token/channel) is a silent no-op, not an error ✅ pass live manual run: FM_DISCORD_BOT_TOKEN='' FM_DISCORD_CHANNEL_ID='' ./bin/fm-discord-notify-status.sh task-z 'done: nothing configured' -> exit=0, no state/x-context record created
  • bash tests/fm-discord-decision-push.test.sh (full file, 23/23 ok)
  • manual: FM_DISCORD_BOT_TOKEN='' FM_DISCORD_CHANNEL_ID='' bin/fm-discord-notify-status.sh task-z 'done: nothing configured'
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

Captain asked for a Discord ping on every completed task plus failures and
auth/approval blockers, not just the existing merge-ready notification.
@Ivory2024
Ivory2024 merged commit d863acc into main Oct 3, 2026
19 checks passed
@Ivory2024
Ivory2024 deleted the fm/discord-notify-done-failed-blocked branch October 3, 2026 02:26
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