Skip to content

Event driven subagent delegation - #9837

Closed
mikekelly wants to merge 1 commit into
openai:mainfrom
mikekelly:feat/event-driven-subagent-delegation
Closed

mikekelly wants to merge 1 commit into
openai:mainfrom
mikekelly:feat/event-driven-subagent-delegation

Conversation

@mikekelly

Copy link
Copy Markdown

Event driven subagent delegation

What

  • Automatically notify the parent agent when a collab-spawned sub-agent completes, without requiring wait.
  • Batch sub-agent completions while the parent is busy and deliver them as a single user input when the parent becomes idle.
  • Include both success and error outcomes, prefixed by an explanatory line and then a JSON map keyed by child id.

Why

  • Enables fire-and-forget sub-agents and removes the need for synchronous wait polling.
  • Gives the parent an event-driven "wake-up" with the final sub-agent result.
  • Keeps parent turn context stable by delivering as Op::UserInput.
  • Yields control back to the user so they can keep conversing with the main agent and kick off more work.

How

  • AgentControl::spawn_agent attaches a completion watcher for SessionSource::SubAgent(ThreadSpawn).
  • ThreadManagerState subscribes to child status changes, buffers results per parent, and flushes them when the parent becomes idle.
  • Payload format:
    The following agents have completed:
    {
      "<child_id>": { "completed": "..." },
      "<child_id>": { "errored": "..." }
    }
    

Issue

Checklist

  • just fmt
  • just fix -p codex-core
  • cargo test -p codex-core

@github-actions

github-actions Bot commented Jan 25, 2026 •

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@mikekelly

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

github-actions Bot added a commit that referenced this pull request Jan 25, 2026
@etraut-openai

Copy link
Copy Markdown
Contributor

Our contribution guidelines state that we're not accepting feature contributions at this time. We need to make sure that all new features are well designed, compose well with both existing and upcoming features, fit into our roadmap, and are consistent across all Codex surfaces (CLI, IDE extension, web). If you would like to propose a new feature, please file or upvote an enhancement request in the issue tracker. We will generally prioritize new features based on community feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants