#4205

WIP: Add mailbox-backed subagent results

Draftchengyongruwants to merge intofrom

Summary

  • Add an in-memory mailbox protocol for subagent task/result records with one-time result consumption.
  • Change SubagentManager completion to write mailbox results instead of publishing synthetic inbound messages, and remove the hidden _drain_pending wait on running subagents.
  • Add explicit poll_subagents, wait_subagents, and cancel_subagent tools plus focused regression coverage.
  • Include the referenced .agent/subagent-mailbox-mvp-plan.md implementation plan.

Verification

  • $env:PYTHONPATH='.'; python .verify/subagent-mailbox/consumer_mailbox.py -> PASS mailbox consumer; dispatch returned in 0.356s, worker completion left inbound queue at 0, wait consumed once.
  • $env:PYTHONPATH='.'; pytest tests/agent tests/tools -q -> 1592 passed, 21 skipped.
  • $env:PYTHONPATH='.'; pytest tests/command tests/session tests/cli/test_restart_command.py -q -> 75 passed.
  • ruff check on changed implementation/test files -> All checks passed.
  • $verify report checker: .verify/subagent-mailbox/report.md -> PASS.

Notes

  • A broad ruff run over unrelated repo files still reports pre-existing lint debt outside this change; changed-file ruff is clean.

Activity

3

This pull request is a draft

Merging is unavailable until it is marked ready for review.