Repository navigation
Description
Problem
When using orchestration agents with inheritParentContext: true, a follow-up prompt can fail to appear as a new instruction in the child agent. In the observed workflow, we attempted to redirect/continue an orchestrated child, but the new prompt did not get inserted into the child session.
This is especially dangerous for inherited children: the child starts from a duplicated parent transcript, so without an explicit inserted handoff/follow-up prompt it may continue interpreting the inherited conversation as if it is still the parent/orchestrator. That breaks role separation and makes parallel orchestration unreliable.
Why this matters
The existing bootstrap wrapper in src/mcp/shared/orchestrationPrompt.ts is the right idea: provider-visible text is the only reliable cross-provider instruction channel. The child must see, in its own transcript/composer input, that inherited history is read-only background and that the newly supplied task is its active instruction.
If orchestration_send_prompt reports success but the prompt is not actually inserted/submitted, the parent believes the child was redirected while the child keeps operating from stale inherited context.
Suspected areas
src/mcp/runtime/createBuiltInMcpServer.tsaroundorchestration_send_promptsubmitPrompt(...)behavior for Claude/Codex sessionsOrchestrationBridge.notePromptSubmitted(...)and lifecycle reporting after prompt deliverymarkBootstrapPromptDelivered(...)ordering and whether bootstrap delivery is marked before/after real insertion succeeds- renderer/session readiness path used by orchestration prompt submission
Expected behavior
orchestration_send_promptshould only returnok: trueafter the prompt has been inserted/submitted to the target child session.- For inherited children whose bootstrap handoff has not been delivered, the first prompt must be wrapped with
buildOrchestrationBootstrapPrompt(...). - If insertion/submission fails, the MCP tool must return a clear failure with a stable error code and message.
- Prompt delivery metadata should not advance in a way that makes
wait_agentsor status surfaces believe a prompt is in flight unless the prompt was actually accepted by the target session. - The child transcript/feed should contain the inserted prompt so the child understands it is an orchestrated child, not the original parent from the inherited transcript.
Acceptance criteria
- Add a regression test or harness coverage for
orchestration_send_promptagainst an inherited child. - Prove the first follow-up prompt to an inherited child is wrapped and inserted exactly once.
- Prove a failed prompt insertion returns
ok: falseand does not mark bootstrap delivery or prompt submission state. - Prove a successful prompt insertion updates lifecycle/status so the parent can wait on the child without seeing stale completion.
- Include a WHY comment near the delivery/order check explaining that inherited children can otherwise misidentify themselves as the parent agent.
Related context
This is separate from Root Access MCP (#242). Root Access is about global/non-descendant control. This bug is about scoped orchestration prompt delivery to a valid child session and the correctness of inherited-context role handoff.
Activity
Juliusolsson05 commentedon May 20, 2026
Investigation update:
The observed failure was on the Codex orchestration path, not Claude.
orchestration_send_promptwaited for Codex readiness, then wrote the bracketed paste and the trailing Enter as two separate PTY writes. That differs from the normal renderer Codex composer path, which sends bracketed paste + Enter in one write.Why this matters:
CodexHeadless.write()records a submitted prompt as soon as it sees bracketed paste bytes. With the split-write orchestration path, the prompt ledger and orchestration delivery state can advance after the paste write even if the separate Enter write fails, is dropped, or lands outside the intended input state. For inherited children, that is especially bad because the child can keep reading the cloned parent transcript as active context without ever receiving the new handoff/follow-up task.Local patch: align the MCP Codex path with the renderer Codex path by doing one atomic
\x1b[200~...\x1b[201~\rwrite afterawaitCodexReadyForPrompt(...). Claude remains on the two-phase placeholder path because its paste race is different.Focused verification:
npm run test:orchestration-mcppasses. Broader typechecks still hit existing unrelated failures inpackages/codex-headless/src/channels/SemanticChannel.tsand missingpidusagetypings / stale project-reference outputs.Juliusolsson05 commentedon Jul 7, 2026
Obsolete — superseded by #260, which disabled orchestration context inheritance (
inheritParentContextis forcedfalseand the clone/resume path is removed increateBuiltInMcpServer.ts). Inherited children that resume a cloned parent transcript no longer exist, so the follow-up-prompt / role-confusion failure this tracks can't occur. Prompt-delivery correctness for clean children folds into the #259 rebuild. Closing as superseded.