Repository navigation
Fix bot-echo feedback loop and premature thread-context expiry - #1
Merged
Merged
Conversation
Two defects in the Slack gateway that cause agent replies to be lost or duplicated. Bot-echo loop: the app_mention and message handlers only filtered on `bot_id`, which the Slack Events API does not set consistently. Messages the gateway itself posted were being read back in, re-routed to an agent, and answered again. Now filtered on all three signals — `bot_id`, any `subtype` (bot_message et al.), and a missing `user` — with the event skipped unless a real human sender is present. Thread TTL: thread context expired after 24 hours, but Slack DM threads routinely go quiet for longer. The context would expire mid-conversation and the agent's next reply would be dropped, with "No Slack context, skipping" as the only symptom. Raised to 30 days; the store holds one small entry per thread, so the memory cost is negligible. Also gitignores slack-gateway/thread-store.json, which is runtime state and was being left untracked in the working tree. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Two defects in the Slack gateway that cause agent replies to be lost or duplicated.
Bot-echo loop
app_mentionandmessagehandlers filtered only onbot_id, which the Slack Events API does not set consistently. Messages the gateway itself posted were read back in, re-routed to an agent, and answered again.Now filtered on all three signals —
bot_id, anysubtype(bot_messageet al.), and a missinguser— so an event is only processed when a real human sender is present.Thread context expiring mid-conversation
Thread context had a 24-hour TTL, but Slack DM threads routinely go quiet for longer. The context would expire while the conversation was still live, and the agent's next reply would be silently dropped — the only symptom being a
No Slack context, skippinglog line.Raised to 30 days. The store holds one small entry per thread, so the memory cost is negligible.
Housekeeping
slack-gateway/thread-store.jsonis runtime state and was being left untracked in the working tree. Now gitignored.Verification
npm run typecheck:slackpassesnpm run lintcould not be run — the repo root is missing thetypescript-eslintdependency referenced byeslint.config.js. Pre-existing, unrelated to this change.🤖 Generated with Claude Code