<@U0BME18CF7S> Look at the openhands-ai Slack auto...
# automations-debug
c
@fresh-machine-37269 Look at the openhands-ai Slack automation and at the automation repo. What change is needed to respond also to replies to the bot comments, not only on mentioning? just answer me with code snippet/s
👀 1
✅ 1
f
🤖 On it! View progress here: oss-agent-canvas.ngrok.dev/conversations/…
✅ Done! Two changes are needed — one in the Socket Mode bridge (it currently only forwards
app_mention
), and one in the automation script (it currently ignores everything except
app_mention
). 1. Bridge — forward thread replies too (slack_socket_bridge.py) Replies to the bot's own comments arrive as plain
message
events (no
@mention
), so they never get forwarded. Add
message
to the forwarded types, but only for thread replies so the bot doesn't answer every channel message:
Copy code
FORWARD_EVENT_TYPES = {"app_mention", "message"}
In
on_request
, right after the bot-message filter:
Copy code
if event.get("bot_id") or event.get("subtype") == "bot_message":
            return
        # A reply to the bot's own comment is a plain `message` event (no
        # @mention). Only forward thread replies; ignore top-level messages.
        if etype == "message" and not event.get("thread_ts"):
            return
2. Automation — accept thread replies (main.py) Replace the top guard:
Copy code
if ev.get("type") != "app_mention":
        log(f"ignoring non-app_mention event: {ev.get('type')!r}")
        return None
with:
Copy code
ev_type = ev.get("type", "")
    is_app_mention = ev_type == "app_mention"
    is_thread_reply_msg = ev_type == "message" and bool(ev.get("thread_ts"))
    if not (is_app_mention or is_thread_reply_msg):
        log(f"ignoring non-relevant event: {ev_type!r}")
        return None
Then, after the Slack identity check (so `token`/`channel`/`thread_root` are available), guard that the bot actually posted in that thread — otherwise the bot would answer any thread reply in channels it can see:
Copy code
if is_thread_reply_msg:
        history = thread_history(token, channel, thread_root)
        if not any(m.get("user") == EXPECTED_BOT_USER_ID or m.get("bot_id")
                   for m in history):
            log("ignoring reply in a thread the bot hasn't posted in")
            return None
The rest already works because for a
message
event
request_after_trigger(text)
returns the full text as-is (no trigger phrase to strip), and
is_thread_reply
already drives the thread-history context block. Optionally, make the prompt's "activated by the trigger phrase" line conditional so plain replies don't claim a mention triggered them. Note: with this change each reply in the thread triggers a new run, so keep the existing `watch_until`/reuse logic in place to keep follow-ups in the same conversation and avoid duplicate summaries.
c
@fresh-machine-37269 make an issue feature request on automation repo with this, includign your impl suggestions. after posting it, wait a minute and check if the issue has been marked ready-for-dev or not
👀 1
f
🤖 On it! View progress here: oss-agent-canvas.ngrok.dev/conversations/…
✅ Done! Done. I created the feature request on the automation repo: github.com/OpenHands/automation/issues/442 — "Respond to replies to the bot's comments, not only @-mentions" The issue includes the implementation suggestion: accept Slack
message
events in
streams/slack.py
but only when they are a threaded reply to the bot's own message (
thread_ts
set and
parent_user_id == bot_user_id
), keeping bare channel messages and replies to other users ignored. After waiting a minute, I checked the issue — it's still just
enhancement
and has not been marked
ready-for-dev
.
c
@fresh-machine-37269 check the comment to your issue, and fix accordinly
👀 1
f
✅ Done! Fixed. The readiness check comment flagged two missing sections: a
### Desired Behavior
section and a properly-titled
### Acceptance Criteria
section. I updated the issue body to add both, and after the automation re-checked it, issue #442 is now labeled
ready-for-dev
(alongside
enhancement
). github.com/OpenHands/automation/issues/442