Skip to content

feat(agentex): golden-agent self-posts its Slack reply; gateway skips relay - #405

Merged
michael-chou359 merged 2 commits into
mainfrom
mc/slack-golden-self-posts
Aug 14, 2026
Merged

feat(agentex): golden-agent self-posts its Slack reply; gateway skips relay#405
michael-chou359 merged 2 commits into
mainfrom
mc/slack-golden-self-posts

Conversation

@michael-chou359

@michael-chou359 michael-chou359 commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

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 with collect=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: 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 thinking… alive across multi-message turns via set_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_status tool in golden-agent: agentex-agents mc/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, collect flag, 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.

  • Adds self-posting instructions, including multi-message status handling, to golden-agent turn context.
  • Adds a non-collecting dispatch mode that sends EVENT_SEND without polling for a reply.
  • Updates gateway tests for golden-agent self-posting and non-golden relay behavior.

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

Filename Overview
agentex/src/domain/use_cases/slack_gateway_use_case.py Splits Slack delivery ownership by agent name and adds a fire-without-collection dispatch path.
agentex/tests/unit/use_cases/test_slack_gateway_use_case.py Updates unit coverage for self-post directives, golden-agent relay suppression, and unchanged non-golden relay behavior.

Reviews (2): Last reviewed commit: "Merge branch 'main' into mc/slack-golden..." | Re-trigger Greptile

… 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>
@michael-chou359
michael-chou359 requested a review from a team as a code owner August 14, 2026 02:31
Comment thread agentex/src/domain/use_cases/slack_gateway_use_case.py
@michael-chou359
michael-chou359 merged commit a3c674e into main Aug 14, 2026
46 checks passed
@michael-chou359
michael-chou359 deleted the mc/slack-golden-self-posts branch August 14, 2026 17:26
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.

2 participants