feat(agentex): golden-agent self-posts its Slack reply; gateway skips relay - #405
Merged
Conversation
… relay golden-agent is the only agent with Slack write tools (SlackBot), so it posts its own reply into the thread. The gateway therefore stops relaying for it: - _run_turn: when the target is golden-agent, set "thinking…" and fire the turn with collect=False, then return — no reply relay (that would double-post the answer the agent already posts). Every other agent (registered agents, SYNC agents) has no Slack tools, so the gateway stays the single writer and keeps the relay + status. - _dispatch: `collect` flag — send the event without polling/relaying a reply. - _turn_content: for golden-agent, a directive to deliver its reply via post_message, and to keep the "thinking…" indicator alive across multi-message turns via set_status (re-assert after each non-final post; the final post clears it). Pairs with the SlackBot set_status tool. The signal is the golden-agent NAME, not config_id: configs are personas that keep the golden-agent name, so the name is the exact self-posting set. Co-Authored-By: Claude Opus 4.8 <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.
What
golden-agent is the only agent with Slack write tools (SlackBot, auto-enabled on slack-origin golden-agent turns), so it posts its own reply into the thread. Today the gateway also relays golden-agent's text output → double-write, and the agent's interim posts clear the `thinking…` status. This makes golden-agent the single writer for its own turns.
Change
_run_turn: when the target is golden-agent, set `thinking…` and fire the turn withcollect=False, then return — no reply relay (the agent posts it). Every other agent (registered agents, SYNC agents) has no Slack tools, so the gateway stays the single writer and keeps relay + status._dispatch:collectflag — send the event without polling/relaying a reply._turn_content: for golden-agent, a directive to deliver its reply viapost_message, and to keepthinking…alive across multi-message turns viaset_status(re-assert after each non-final post; the final post clears it).The signal is the golden-agent name, not
config_id— configs are personas that keep the golden-agent name, so the name is the exact self-posting set.Paired change (must ship together)
Depends on the SlackBot
set_statustool in golden-agent: agentex-agentsmc/golden-agent-slackbot-tools. Deploy golden-agent + this gateway change together, or golden-agent replies won't reach Slack.Behavior after both land
golden-agent posts its own reply; `thinking…` shows the whole turn and clears only on its final message; no double-posting. Non-golden agents unchanged.
Testing
Slack gateway unit suite green (self-post skip, non-golden relay,
collectflag, self-post directive); ruff clean.🤖 Generated with Claude Code
Greptile Summary
This PR makes golden-agent responsible for posting its own Slack replies while retaining gateway relay behavior for other agents.
Confidence Score: 4/5
The PR is not yet safe to merge because a golden-agent failure after EVENT_SEND acceptance can leave the user without a reply or error indication.
The previously reported failure remains: collect=False returns before asynchronous turn completion, so later execution failures bypass the gateway's exception delivery path while the Slack thread may remain marked as thinking.
Files Needing Attention: agentex/src/domain/use_cases/slack_gateway_use_case.py
Important Files Changed
Reviews (2): Last reviewed commit: "Merge branch 'main' into mc/slack-golden..." | Re-trigger Greptile