Long delegate_task waits could exceed the MCP client's timeout before returning the child's IDs, leaving the caller unable to reconcile the child and encouraging duplicate dispatches.
Use a 30-second default and 45-second maximum wait budget for delegation and thread waits. Keep the child running, return recoverable handles on wait timeout, and upgrade completion delivery when a waiting call is interrupted or fails. Reconcile unobserved terminal results after parent settlement while preserving ownership of an existing wake, so recovery neither drops nor duplicates delivery. Tool guidance explains same-key retry while the parent is active in the same provider session and reconciliation when it is not.
Targets t3code/codex-turn-mapping for #2829. Refs #11168.
Validation: 40 focused service, toolkit, production-orchestrator, and durable completion-delivery tests pass. Regressions failed before each fix, including the missed and duplicate wake races found in adversarial review. Scoped server typecheck, targeted lint/format, and new-commit secrets scans pass.
Limits: the budget bounds waiting, not arbitrary dispatch/readback latency. Existing acknowledgement-before-HTTP-response semantics remain; a lost response after acknowledgement may suppress an automatic wake, but stored results remain available through status/list reads. No live-provider or socket-disconnect test was run.
The repository scanner config retains default rules and exempts only the exact synthetic idempotencyKey fixture in packages/effect-codex-app-server/src/protocol.test.ts, which otherwise flags twice in the inherited V2 history. Negative controls confirm other values, keys, paths, and credential rules remain detected.
Implemented with GPT-6 Astra via Codex.
Macroscope has since reviewed this pull request. An earlier review was skipped by a cost limit; a review has now completed, so that notice no longer applies.