fix(gateway): queue followups during delegation#30241
Conversation
|
Duplicate-scope note: I found existing PR #30183 for the same #30170 bug after opening this. This PR keeps the scope to queueing conversational follow-ups while delegated children are active and is currently green; #30183 is the competing fix path but its test job is failing at the time of this check. Happy for maintainers to take either approach or close this one if #30183 is preferred. |
# Conflicts: # gateway/run.py
|
Reviewed in the #30170 triage. This PR handles the warm path ( |
|
Closing this partial duplicate after the #30170 triage. The current branch only covers the warm busy handler and misses the cold PRIORITY path, while #30183 covers both paths with stronger regression coverage and the /stop hint. I’ll leave the issue to the stronger candidate rather than churn this PR further. |
Summary
Why
busy_input_mode: interrupt, a normal follow-up callsAIAgent.interrupt()on the parent, which recursively interrupts_active_childrenand kills in-flightdelegate_taskwork.delegate_taskblocks the parent synchronously, the safest minimal behavior is to preserve the child work and replay the follow-up after delegation completes.Changes
gateway/run.py: detects active delegated children on the running parent agent and treats plain busy follow-ups as queue-mode instead of interrupt-mode.gateway/run.py: sends a delegation-specific busy acknowledgement so users know the subagent is still working.tests/gateway/test_busy_session_auth_bypass.py: covers the active-delegation path and preserves the existing interrupt behavior when no child is running.Validation
.venv/bin/python -m pytest tests/gateway/test_busy_session_auth_bypass.py tests/gateway/test_restart_drain.py tests/gateway/test_status_command.py -o 'addopts=' -q.venv/bin/python -m ruff check gateway/run.py tests/gateway/test_busy_session_auth_bypass.pyScope
/stopor/new.