Skip to content

fix(workspace): honor human @mentions deterministically in dynamic threads - #661

Open
nolanchic wants to merge 1 commit into
openagents-org:developfrom
nolanchic:fix/thread-mention-participant-scope
Open

fix(workspace): honor human @mentions deterministically in dynamic threads#661
nolanchic wants to merge 1 commit into
openagents-org:developfrom
nolanchic:fix/thread-mention-participant-scope

Conversation

@nolanchic

Copy link
Copy Markdown
Contributor

Fixes #333.

Reproducing the report: in a thread, @-mentioning one agent made other agents that were never added to it reply anyway. Two things stack to cause that. The thread picker adds every workspace agent as a channel participant by default, so "not part of the thread" isn't something the backend can see — everyone is a participant. And in a multi-agent thread with the default "dynamic" orchestration, _handle_message_posted hands every message to the LLM router, which picks whoever it thinks should answer next based on the conversation. The router never sees the user's explicit choice: the "@name → route to that agent" rule in the handler's docstring only exists in the no-router fallback path. So the mention gets re-decided, a bystander answers, and routing then auto-adds it as a participant — from that point it's in the conversation for good.

The fix is the smaller of the two changes discussed in the issue: when a human message carries a mention of a known workspace agent, treat it as the addressing decision it obviously is and route straight to those agents, skipping the router call. Agent-authored mentions still go through the routers (a peer @mentioning another peer is a delegation, not a user choice), and master mode keeps its star topology — the hub owns every human request.

Verified the tests catch the old behavior (they fail on main, pass here), and the full backend suite has the same failure set before and after this change. Added TestHumanMentionDeterministicRouting covering: single mention bypasses the router, multiple mentions target all mentioned agents, unknown @tokens still fall through to the router, agent mentions still use the router, and master mode is unchanged.

One follow-up worth considering separately: the default-everyone participant list in createSession is what makes threads look like whole-workspace broadcasts in the first place. Changing that is a product decision (empty threads, UI affordances), so I left it alone here.

…reads

A human @mention is an explicit addressing decision, but dynamic and
workflow threads handed every message to the LLM router, which re-decided
who should answer. Since the thread picker adds every workspace agent as
a participant by default, the router kept picking bystanders the user
never added to the thread (openagents-org#333).

Route human messages that carry a workspace-known @mention straight to
the mentioned agents and skip the router call. Agent-authored mentions
still go through the routers, and master mode keeps its star topology.

Fixes openagents-org#333
@vercel

vercel Bot commented Sep 8, 2026

Copy link
Copy Markdown

@nolanchic is attempting to deploy a commit to the Raphael's projects Team on Vercel.

A member of the Team first needs to authorize it.

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.

同一个Thread下,@ 一个 Agent 后会有其他 Agent 回复,并且即使从未加入到这个 Thread 里,也会回复

1 participant