Route messages to all mentioned agents so tasks run in parallel - #575
Open
QuanCheng-QC wants to merge 2 commits into
Open
Route messages to all mentioned agents so tasks run in parallel#575QuanCheng-QC wants to merge 2 commits into
QuanCheng-QC wants to merge 2 commits into
Conversation
Assigning tasks to different agents in one channel used to funnel every
message through single-target routing — the fallback kept only the first
@mention, the LLM router truncated multi-name answers to one agent, and
in dynamic mode explicit mentions never bypassed the router at all. All
tasks landed on one agent whose per-channel queue then serialized them,
showing the 'message queued' status in the UI instead of parallel work.
- honor ALL explicit @mentions (deduped, self-mentions filtered) in
_fallback_targets instead of just the first one
- human messages with explicit mentions now skip the LLM router and
target the mentioned agents directly in dynamic/workflow modes
(master mode keeps its star topology)
- the LLM router now accepts multi-name answers ('next; a, b') and
targets every valid name, dropping only unknowns and self-loops
- cloud agents targeted by one message are invoked concurrently with
per-task DB sessions instead of a sequential await loop
- bound cloud agent fan-out with a semaphore (new
CLOUD_AGENT_MAX_CONCURRENCY config, default 4) and split DB access
into short-lived sessions released before every provider API call,
so a large mention list can no longer pin pool connections for the
duration of external model round-trips
- dedupe cloud agent targets before the gather and dedupe master-mode
delegation mentions at the source, so duplicate mentions can't invoke
the same agent twice with duplicate billable requests
- teach the router prompt the multi-target output format ('next' with
comma-separated names) for independent tasks, matching the parser;
raise the router max_tokens from 30 to 64 so multi-name answers
don't get truncated
- new tests for fan-out dedupe, sentinel filtering, concurrency cap,
depth limit, and master-mode delegation dedupe
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Problem
Assigning different tasks to different agents in one channel showed the
"message queued" status instead of parallel work. Every routing path was
single-target:
_fallback_targetskept only the first@mention, and indynamic mode explicit
@mentionsnever bypassed the LLM router, whichcollapses multi-name answers to one agent. All tasks landed on one agent,
whose per-channel queue then serialized them.
Fix
Routing (
workspace_mod.py)_fallback_targetshonors ALL explicit@mentions(deduped, agent self-mentions filtered)next:a,b), validating each name and dropping unknowns/self-loops;_ROUTER_PROMPTteaches the multi-target format; routermax_tokensraised 30 → 64Cloud agents (
cloud_agent.py)awaitloopCLOUD_AGENT_MAX_CONCURRENCYconfig, default 4)Intentionally unchanged: one agent still processes one task at a time per
channel (session-context ordering).
Tests
test_cloud_agent.py(5 tests: dedupe, sentinel filtering, concurrency cap, depth limit)test_llm_router.py+test_cloud_agent.pypass 38/38; full backend suite 344 passed, failure set diff-identical to the develop baseline's pre-existing environmental failures🤖 Generated with Claude Code