Repository navigation
feat: capture messages in Discord command channels - #97
Merged
Merged
Conversation
Adds an explicit opt-in channel list where an authorized captain's plain message is an inbound Firstmate request, without typing @FIRST Crew (which forces a Korean/English IME round-trip on every call). - bin/fm-discord-lib.sh: resolve FM_DISCORD_COMMAND_CHANNELS (one place); a command channel that is also excluded is dropped with an explicit diagnostic (exclusion wins). - bin/fm-discord-poll.js: allow the mention-free path only when the polled channel is a command channel AND the author is authorized; bot messages and unauthorized authors are still ignored. - bin/fm-discord-poll.sh: export the resolved command channels to the poll. - docs/configuration.md: document the setting and how it differs from the polling allowlist. - tests: authorized+command-channel plain -> captured; unauthorized -> ignored; ordinary channel plain -> ignored; duplicate poll -> one inbox record; command/exclusion conflict -> fail-safe diagnostic. Preserves #89 (reply to bot), #93 (durable wake on capture), DM polling, and the existing @mention fallback; all inputs still normalize to the same discord-selfhosted x-inbox + durable-wake path.
Ivory2024
added a commit
that referenced
this pull request
Oct 7, 2026
* feat(discord): captain command channel for mention-free requests Adds an explicit opt-in channel list where an authorized captain's plain message is an inbound Firstmate request, without typing @FIRST Crew (which forces a Korean/English IME round-trip on every call). - bin/fm-discord-lib.sh: resolve FM_DISCORD_COMMAND_CHANNELS (one place); a command channel that is also excluded is dropped with an explicit diagnostic (exclusion wins). - bin/fm-discord-poll.js: allow the mention-free path only when the polled channel is a command channel AND the author is authorized; bot messages and unauthorized authors are still ignored. - bin/fm-discord-poll.sh: export the resolved command channels to the poll. - docs/configuration.md: document the setting and how it differs from the polling allowlist. - tests: authorized+command-channel plain -> captured; unauthorized -> ignored; ordinary channel plain -> ignored; duplicate poll -> one inbox record; command/exclusion conflict -> fail-safe diagnostic. Preserves #89 (reply to bot), #93 (durable wake on capture), DM polling, and the existing @mention fallback; all inputs still normalize to the same discord-selfhosted x-inbox + durable-wake path. * no-mistakes(document): Document Discord command channel configuration * no-mistakes(lint): Replace ls/grep inbox count with glob loop
Ivory2024
added a commit
that referenced
this pull request
Oct 7, 2026
* feat(discord): captain command channel for mention-free requests Adds an explicit opt-in channel list where an authorized captain's plain message is an inbound Firstmate request, without typing @FIRST Crew (which forces a Korean/English IME round-trip on every call). - bin/fm-discord-lib.sh: resolve FM_DISCORD_COMMAND_CHANNELS (one place); a command channel that is also excluded is dropped with an explicit diagnostic (exclusion wins). - bin/fm-discord-poll.js: allow the mention-free path only when the polled channel is a command channel AND the author is authorized; bot messages and unauthorized authors are still ignored. - bin/fm-discord-poll.sh: export the resolved command channels to the poll. - docs/configuration.md: document the setting and how it differs from the polling allowlist. - tests: authorized+command-channel plain -> captured; unauthorized -> ignored; ordinary channel plain -> ignored; duplicate poll -> one inbox record; command/exclusion conflict -> fail-safe diagnostic. Preserves #89 (reply to bot), #93 (durable wake on capture), DM polling, and the existing @mention fallback; all inputs still normalize to the same discord-selfhosted x-inbox + durable-wake path. * no-mistakes(document): Document Discord command channel configuration * no-mistakes(lint): Replace ls/grep inbox count with glob loop
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Captain wants a thin Discord "Captain Console" layer for Firstmate so they no longer have to type "@FIRST Crew" to reach it. Every message the captain posts in the 퍼스트크루-채팅방 (channel 1551134713727426570) should be read by Firstmate without an @mention, because the mention forces a Korean/English IME round-trip on every call.
Decisions and constraints the captain set:
This change adds FM_DISCORD_COMMAND_CHANNELS (resolved in bin/fm-discord-lib.sh, exported by bin/fm-discord-poll.sh, gated in bin/fm-discord-poll.js), documents it in docs/configuration.md, and adds regression tests.
What Changed
FM_DISCORD_COMMAND_CHANNELScapture for authorized users’ plain messages, routing them through the existing self-hosted Discord inbox and durable wake path.Risk Assessment
No unresolved risk. The single high-severity review finding below was resolved by an explicit captain decision, with no code change required.
Resolution: in the "exclusion wins" rule, excluded means the explicit
FM_DISCORD_EXCLUDE_CHANNELSlist only. The built-in collision exclusion (which includes1551134713727426570) is a default safety value, and an explicit captain allowlist / command-channel configuration intentionally overrides it:built-in default exclusion < explicit captain configuration. This is the only reading consistent with using1551134713727426570itself as a command channel. Current code already implements it, so behavior is unchanged; an explicit exclusion still wins and emits the diagnostic.Testing
Ran the targeted self-hosted Discord integration script. It drove the real poller and durable inbox/wake path against a simulated Discord API; authorized capture, unauthorized and ordinary-channel rejection, existing reply and DM paths, idempotency, and explicit-exclusion diagnostics passed. No visual surface applies.
bash tests/fm-discord-selfhosted.test.sh— command-channel capture and durable wake checksbash tests/fm-discord-selfhosted.test.sh— unauthorized-author and ordinary-channel checksbash tests/fm-discord-selfhosted.test.sh— reply-to-bot, DM, and idempotency checksbash tests/fm-discord-selfhosted.test.sh— excluded command-channel checkPipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - 1 finding, resolved by captain decision
bin/fm-discord-lib.sh:71- Resolved. The finding asked whether the built-in collision exclusion counts for the "exclusion wins" rule. Captain decision: it does not. "Exclusion wins" applies to the explicitFM_DISCORD_EXCLUDE_CHANNELSlist; the built-in collision exclusion is a default safety that explicit captain configuration (allowlist / command channel) overrides. Current behavior is correct and was left unchanged: the command channel is honored, and a channel in the explicit exclusion list still wins with a diagnostic.✅ **Test** - passed
✅ No issues found.
bash tests/fm-discord-selfhosted.test.sh— command-channel capture and durable wake checksbash tests/fm-discord-selfhosted.test.sh— unauthorized-author and ordinary-channel checksbash tests/fm-discord-selfhosted.test.sh— reply-to-bot, DM, and idempotency checksbash tests/fm-discord-selfhosted.test.sh— excluded command-channel checkbash tests/fm-discord-selfhosted.test.sh✅ **Document** - passed
✅ No issues found.
🔧 **Lint** - 1 issue found → auto-fixed ✅
🔧 Fix applied.
✅ Re-checked - no issues remain.
✅ **Push** - passed
✅ No issues found.