fix(workspace): honor human @mentions deterministically in dynamic threads - #661
Open
nolanchic wants to merge 1 commit into
Open
fix(workspace): honor human @mentions deterministically in dynamic threads#661nolanchic wants to merge 1 commit into
nolanchic wants to merge 1 commit into
Conversation
…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
|
@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. |
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.
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_postedhands 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
TestHumanMentionDeterministicRoutingcovering: 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
createSessionis 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.