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: loops, schedule triggers and agent events start a fresh depth-0 chain — an agent can launder its inter-agent chain depth (#2806 follow-up) #2973
#2806 adds an inter-agent chain-depth guard on /chat, /task (parallel, self-task, pull-routed) and /fan-out: an agent-principal call stamps its child chain_depth = 1 + MAX(chain_depth of the caller's running rows) and is refused past inter_agent_max_chain_depth (default 8).
Three other agent-initiated paths still start a new root at depth 0, so an agent near the limit can launder its depth through them:
Path
Row creation
Today
run_agent_loop → POST /api/agents/{name}/loops
services/loop_service.py (triggered_by="loop")
iteration rows carry no depth
trigger_schedule → POST /api/agents/{name}/schedules/{id}/trigger
loopback principal carries vouched_source_agent, not agent_name
treated as a root
Each is bounded by something else (loop max_runs/max_cost_usd/max_duration_seconds; the #1578 event-recursion break for agent.task.*), but none by chain depth, so an unbounded tree of chains remains possible.
Acceptance criteria
A loop started by an agent principal stamps its iteration rows with the starter's inherited depth (captured at loop start), and a loop start / schedule trigger / event emit by a caller already at the max is refused with the same named inter_agent_depth_exceeded contract.
Event loopback dispatch derives the caller from vouched_source_agent and inherits its depth.
Tests drive each path through its real entry with a non-default max.
Update the IA-04 "Gaps to fill next" text in docs/testing/orchestration-invariant-catalog.md and requirements/core-agent.md §9.1.1 "Deferred".
Notes
Refusing only at the max is cheap but does not stamp inherited depth — a depth-7 caller could still start a fresh depth-0 loop tree. Stamping is the real fix.
CSO 2026-09-29 re-framing (Finding 3, HIGH): the loopback-root behaviour this issue tracks is confirmed, but AC #2 (derive the caller from vouched_source_agent and inherit depth) would not bound the attack shape found. get_max_running_chain_depth counts RUNNING rows only, and the loopback POST /task is async, so a serial emit-at-end-of-turn loop reads depth 0 on every hop even with correct attribution — #2806 bounds live nesting, not fan-forward. Self-subscription to any non-agent.task.* event type is allowed (event_subscriptions.py L142-145, pinned by test_1578), the #1578 recursion break covers reserved events only, and there is no per-subscription fire budget, cooldown, event-id dedup or rate limit on emit_event; CapacityFull is swallowed in trigger_subscription. Any agent owner can therefore create an unbounded LLM loop with no platform-side stop.
Requested changes to this issue:
Priority P3 → P1; add theme-security.
Add AC: a per-subscription fire budget (Redis INCR+TTL keyed on subscription id; skip dispatch and raise an operator alert on breach) — the only control that bounds the serial loop.
Activity
fix(dispatch): refuse agent-to-agent hops past a chain-depth limit (#…
vybe commentedon Sep 30, 2026
CSO 2026-09-29 re-framing (Finding 3, HIGH): the loopback-root behaviour this issue tracks is confirmed, but AC #2 (derive the caller from
vouched_source_agentand inherit depth) would not bound the attack shape found.get_max_running_chain_depthcounts RUNNING rows only, and the loopbackPOST /taskis async, so a serial emit-at-end-of-turn loop reads depth 0 on every hop even with correct attribution — #2806 bounds live nesting, not fan-forward. Self-subscription to any non-agent.task.*event type is allowed (event_subscriptions.pyL142-145, pinned bytest_1578), the #1578 recursion break covers reserved events only, and there is no per-subscription fire budget, cooldown, event-id dedup or rate limit onemit_event;CapacityFullis swallowed intrigger_subscription. Any agent owner can therefore create an unbounded LLM loop with no platform-side stop.Requested changes to this issue:
theme-security.INCR+TTL keyed on subscription id; skip dispatch and raise an operator alert on breach) — the only control that bounds the serial loop._chain_callerfalls back tovouched_source_agent) for the concurrent case.Full trace:
docs/security-reports/cso-2026-09-29.mdFinding 3.obasilakis commentedon Sep 30, 2026
/claim
github-actions commentedon Sep 30, 2026
Claimed by @obasilakis. Label
status-in-progressadded.Next steps:
feature/2973-<short-slug>Fixes #29732 remaining items
test(guard): allowlist the #2973 once-per-window alert flag in the #1920
fix(dispatch): carry inter-agent chain depth through loops, schedule …
fix(permissions): withdrawing a permission also withdraws shared-fold…
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(access): emit-event is owner tier for people, not for agent keys …
fix(scheduler): scheduler-created executions record the agent's subsc…
feat(wake): the caller is told its delegated run ended, instead of po…
fix(assistant): a restart reports the retries it clears, and a delete…
fix(assistant): the first session's email offer sends each run's resu…