Skip to content

Fix bot-echo feedback loop and premature thread-context expiry - #1

Merged
jpelaez-23blocks merged 1 commit into
mainfrom
fix/slack-bot-echo-and-thread-ttl
Aug 3, 2026
Merged

jpelaez-23blocks merged 1 commit into
mainfrom
fix/slack-bot-echo-and-thread-ttl

Conversation

@jpelaez-23blocks

Copy link
Copy Markdown
Contributor

Two defects in the Slack gateway that cause agent replies to be lost or duplicated.

Bot-echo loop

app_mention and message handlers filtered only on bot_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, any subtype (bot_message et al.), and a missing user — 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, skipping log line.

Raised to 30 days. The store holds one small entry per thread, so the memory cost is negligible.

Housekeeping

slack-gateway/thread-store.json is runtime state and was being left untracked in the working tree. Now gitignored.

Verification

  • npm run typecheck:slack passes
  • Gateway restarted against live Slack; inbound DM and mention handling confirmed working with no echo

npm run lint could not be run — the repo root is missing the typescript-eslint dependency referenced by eslint.config.js. Pre-existing, unrelated to this change.

🤖 Generated with Claude Code

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>
@jpelaez-23blocks
jpelaez-23blocks merged commit adedb96 into main Aug 3, 2026
4 of 5 checks passed
@jpelaez-23blocks
jpelaez-23blocks deleted the fix/slack-bot-echo-and-thread-ttl branch August 3, 2026 19:13
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