You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug: agent-to-agent chat chains have no depth guard — a runaway A→B→A bounce is bounded only by capacity parks and hop timeouts #2806
chat_with_agent — and the /chat and /task routes it dispatches to — carries no hop or depth marker, so two agents that are permitted to call each other can bounce a call back and forth with nothing that recognises the chain as a chain. What bounds it today is incidental: each hop's execution_timeout_seconds, the per-agent max_parallel_tasks capacity (overflow goes to the durable backlog rather than being refused), and the backend agent-call limiter, whose own header says agent-to-agent chains "can deadlock" and that a finite queue timeout "surfaces such a deadlock as a 503 within an hour" (src/backend/services/agent_call_limiter.py). Rooms already have a chain cap (ROOM_MAX_CHAIN_DEPTH = 8 in src/backend/shared_sessions/service.py); chat has none.
Context
Found while building the J10 journey harness (#2349). J10's "loop guards stop runaway inter-agent recursion" criterion is carried by the harness as a strict=True xfail (tests/journeys/test_j10_agent_calls_agent_journey.py) until a guard exists. parent_execution_id (already threaded from the MCP client to the child row on the task path) means an ancestry depth is derivable without inventing a new header.
Acceptance Criteria
A call whose ancestry depth exceeds a configured maximum is refused with a named error (e.g. inter_agent_depth_exceeded) before any model work starts, on every agent-to-agent path: chat_with_agent sequential and parallel, fan_out, and the pull-routed sequential path
The maximum has a sensible default and is operator-configurable (system_settings → env → default)
The refusal is visible to the caller and recorded on the platform (execution row or activity), never a silent drop
Flip condition for the J10 xfail: test_two_agents_cannot_bounce_a_call_between_each_other_forever is rewritten to drive a real A→B→A chain past the maximum on a keyed stack and assert the named refusal; the xfail marker is removed in the same PR
An invariant entry for the guard is added to docs/testing/orchestration-invariant-catalog.md (the IA- family covers attribution, fan-out bounds and the stopped callee, not chain depth) and cited by J10's catalog record
Technical Notes
Spans src/mcp-server/src/tools/chat.ts (runAgentChat), src/backend/services/chat_execution_service.py and src/backend/services/agent_call_limiter.py.
Activity
feat(tests): J10 journey — agents call each other through the MCP ser…
AndriiPasternak31 commentedon Sep 22, 2026
/claim
1 remaining item
github-actions commentedon Sep 22, 2026
Claimed by @AndriiPasternak31. Label
status-in-progressadded.Next steps:
feature/2806-<short-slug>Fixes #2806fix(dispatch): refuse agent-to-agent hops past a chain-depth limit (#…
fix(dispatch): carry inter-agent chain depth through loops, schedule …
fix(dispatch): carry inter-agent chain depth through loops, schedule …
fix(auth): keep skills.manage's owner-wide reach through the files ta…
fix(auth): an agent key reaches only itself, its edges and the agents…
fix(scheduler): scheduler-created executions record the agent's subsc…
feat(wake): the caller is told its delegated run ended, instead of po…