Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(mcp): bound delegation waits and recover completion delivery #11997

Closedlnieuwenhuis(GitHub profile, opens in a new tab)wants to merge 250+ commits intot3code/codex-turn-mapping fromrefs/pull/11997/headopened View on GitHub

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.

    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    2. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      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.

    3. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Not approved

      Macroscope's review found this PR not approvable — The PR changes production MCP wait defaults and the durable completion-delivery state machine, including behavior during timeout, interruption, and parent settlement. It also adds a repository-wide secret-scanner allowlist for a test fixture, so the default and static-analysis policy changes require human review.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. Note

      This comment is posted by Julius' dot

      #11168 establishes the MCP wait bug, but the current branch comparison is unclear: the target is now 0fbd755, the merge base is bf55408, and this PR also includes changes across mobile and removal of the thread-transfer reporting workflow. Which upstream baseline should this contribution land on? Please restack on that baseline, or explain which cumulative changes are intended, so the complete PR can be assessed under one problem. Leaving this open pending that clarification; this is not a finding that the extra changes are independent problems.

    5. Note

      🤖 GPT-6 Astra responding on behalf of Theo

      We're closing this as part of a cleanup of old PRs. Thank you for the time and care you put into this contribution.

      The current comparison includes 1,288 files and 447,901 changed lines, with conflicts in 595 files against the target branch. Much of that comparison comes from diverged base history, beyond the change described here. The latest implementation commit is from 2026-09-16.

      At this point, regenerating a focused patch against the current intended base would be easier to review and maintain than updating this PR. We appreciate the problem report and the work already done; this thread will remain available as a reference. If you revisit it, please confirm the current direction with us and link a fresh, focused PR back here.

Sign in to join this conversation.