Skip to content

fix(codex): deliver delegated results after the parent yields - #152172

Merged
steipete merged 1 commit into
mainfrom
codex/deflake2-runtime-pair-20260918
Sep 18, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/deflake2-runtime-pair-20260918

Conversation

@steipete

@steipete steipete commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Closes #152170.

What Problem This Solves

Fixes completed OpenClaw subagent results remaining pending when a Codex-backed parent yields before the child finishes.

User Impact

A parent can resume and deliver its delegated result after yielding. Completion ownership survives harness result projection and presentation middleware.

Why This Change Was Made

Codex's duplicate spawn-result normalizer dropped expectsCompletionMessage. Its partial receipt then replaced the complete receipt already recorded by the spawning tool, so core skipped the requester-settlement transfer. Keep the first receipt authoritative for the exact operational run, and use the existing canonical normalizer from the harness SDK in both Codex and Copilot. Document the receipt contract and preserve the existing successful-launch assertions.

Production changes are +17/-35 (net -18). The new sibling test file moves the existing accepted-spawn cases out of an oversized suite and extends their contract coverage. No configuration, schema, migration, or deadline change is required.

Evidence

The unchanged runtime-pair handoff scenario failed twice on macOS and once on Linux with a successful child, pending delivery, and no parent reply. The Linux reproduction used Node 24.19.0: https://github.com/openclaw/openclaw/actions/runs/35390690077 . Its command failed as expected; the task-owned Testbox was subsequently stopped.

Focused bridge and requester-settlement regressions failed before the repair. The final candidate passed all 378 focused tests across Codex, Copilot, backend projection, and requester settlement; the private-QA build and full selected changed-file gate passed. The latter ran in a separate physical checkout to honor the declaration-preparation dependency guard. Fresh independent P2 review found no actionable defects.

Five consecutive unchanged runtime-pair handoff runs passed on Node 24.19.0 (both OpenClaw and Codex cells each time), with no retries, relaxed assertions, or changed timeouts:

{"scenario":"subagent-handoff","runtimePair":["openclaw","codex"],"providerMode":"mock-openai","runs":5,"passed":5,"failed":0,"skipped":0,"suiteSeconds":[69.94,105.86,104.09,110.44,150.38]}

The proof used the actual isolated Gateway, native Codex runtime, managed mock provider, and QA channel. The branch was then rebased cleanly onto current main; git range-diff confirms the reviewed repair is unchanged.

This was discovered during the investigation of Release Checks run 35382455441. That run's separate pre-dispatch chat.history timeout is associated with the shared-state admission inversion addressed by #152050; this PR does not claim that separate timeout repair. Native Codex-child receipt work in #149490 uses a different ownership path.

Compatibility disposition

The maintainer accepts the coordinated SDK, Codex, and Copilot release contract for this repair. These plugin builds must ship with a core build containing the new export. Released v2026.9.4 does not contain it. The normal release path runs release:check → release:generated:check → scripts/release-preflight.mjs --check; its plugin-version check invokes scripts/sync-plugin-versions.ts --check. scripts/release-fast-pretag-check.sh also runs plugins:sync:check directly. The synchronizer aligns openclaw.compat.pluginApi with the chosen core release version; npm runtime packaging derives the OpenClaw peer floor from that metadata, and the installer enforces it.

Independent plugin publication is not certified by this PR: the Plugin NPM Release workflow calls plugin-npm-release-check.ts, which does not invoke the synchronizer itself. A separate publication must update/synchronize the compatibility floor before publishing. Main-push preview cannot publish; the publish job requires workflow dispatch and release approval. This normal main repair does not guess a future release version, add a runtime fallback, or perform any release/publication action. This explicitly resolves the coordinated-release risk in the ClawSweeper review.

Keep the original accepted-spawn receipt authoritative for its operational run. Reuse the canonical receipt normalizer in Codex and Copilot so completion intent survives harness projection and result middleware.

QA runtime-pair reproduction on macOS and Linux exposed successful children left pending after the requester yielded. Preserve completion ownership so the parent resumes and delivers their results. This repair does not claim to explain the separately reported chat.history request timeout.
@clawsweeper

clawsweeper Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation agents Agent runtime and tooling extensions: codex extensions: copilot size: M maintainer Maintainer-authored PR labels Sep 18, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 18, 2026
@clawsweeper

clawsweeper Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 18, 2026, 5:40 PM ET / 21:40 UTC (Revision 2).

ClawSweeper review

What this changes

The PR preserves delegated-task completion receipts when parents yield, shares their normalization across Codex and Copilot, and updates regression coverage and SDK documentation.

Merge readiness

⛔ Blocked before merge - 1 item remains

This remains a necessary, focused repair; current main still loses completion intent. No actionable correctness findings remain. The prior SDK packaging warning is covered by the existing release-synchronization workflow, rather than requiring another pre-merge repair.

Priority: P1
Reviewed head: 422258f4d1c7b5bfb1f7dd8350e5e8ba7d6b1f6e

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A focused owner-level repair with repeated production-path evidence, meaningful regressions, and no actionable findings.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The captured after-fix output records five successful unchanged handoff runs through the actual isolated Gateway, native Codex runtime, and QA channel with a managed mock provider, exercising receipt preservation through parent resumption and final reply.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The captured after-fix output records five successful unchanged handoff runs through the actual isolated Gateway, native Codex runtime, and QA channel with a managed mock provider, exercising receipt preservation through parent resumption and final reply.
Evidence reviewed 9 items Current main still contains the defect: At the fetched main revision, the Codex normalizer returns only runId and childSessionKey, and per-run accounting overwrites the producer receipt. The requested completion-intent preservation is therefore still missing.
Producer receipt and projection ordering: The spawn tool records the canonical receipt before returning its result. The patch retains that first receipt for the exact operational instance; Codex now preserves completion intent through the shared normalizer, and Copilot retains equivalent normalization behavior.
Live authority remains enforced: Requester settlement checks cancellation and exact live admission immediately before registry mutation. The registry separately matches requester session, agent, turn, child identity, and completion obligations before persisting and scheduling delivery; receipt retention does not replace these checks.
Findings None None.
Security None None.

How this fits together

OpenClaw’s spawn tool records accepted child tasks, while harness adapters carry their results back to the agent runner. When a parent yields, the runner transfers completion delivery to the existing subagent registry so the parent can resume.

flowchart TD
  A[Parent delegates task] --> B[Spawn tool records acceptance]
  B --> C[Codex or Copilot adapter]
  B --> D[Receipts for the admitted run]
  C --> D
  D --> E[Parent settlement and authority check]
  E --> F[Child completion delivery]
  F --> G[Parent resumes and replies]
Loading

Before merge

  • Resolve merge risk (P1) - Publishing the updated Codex or Copilot package independently against v2026.9.4 would encounter a missing SDK export; the existing release-synchronized plugin API floor must remain in effect.
Agent review details

Security

None.

PR surface

Source -18, Tests +80, Docs +8. Total +70 across 9 files.

View PR surface stats
Area Files Added Removed Net
Source 4 17 35 -18
Tests 4 169 89 +80
Docs 1 8 0 +8
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 9 194 124 +70

Review metrics

Metric Value Why it matters
SDK contract 1 function and 1 type exported; 2 bundled consumers migrated The additive seam replaces duplicate normalization without adding configuration or changing persisted formats.

Merge-risk options

Maintainer options:

  1. Retain synchronized plugin publication (recommended)
    Use the existing release owner to advance plugin API floors and publish the matching SDK and harness packages together.

Technical review

Best possible solution:

Keep one canonical receipt normalizer and producer-owned accounting, distributing the updated harnesses with their matching SDK through the established release workflow.

Do we have a high-confidence way to reproduce the issue?

Yes: the unchanged subagent-handoff scenario and recorded baseline failures identify a concrete path, and fetched-main source confirms the receipt loss. This read-only review did not execute it.

Is this the best way to solve the issue?

Yes: preserving the producer receipt and reusing the existing normalizer repairs the owning invariant without introducing another delivery mechanism.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 9dd45f672760.

Labels

Label changes:

  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster. Replaced prior rating: 🐚 platinum hermit.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.

Label justifications:

  • P1: The reproduced Codex delegation flow leaves successful child results pending and suppresses the parent’s final reply.
  • merge-risk: 🚨 compatibility: Both updated harness packages depend on an SDK export absent from v2026.9.4, requiring the existing synchronized release floor.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster. Replaced prior rating: 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The captured after-fix output records five successful unchanged handoff runs through the actual isolated Gateway, native Codex runtime, and QA channel with a managed mock provider, exercising receipt preservation through parent resumption and final reply.
  • proof: sufficient: Contributor real behavior proof is sufficient. The captured after-fix output records five successful unchanged handoff runs through the actual isolated Gateway, native Codex runtime, and QA channel with a managed mock provider, exercising receipt preservation through parent resumption and final reply.

Evidence

What I checked:

  • Current main still contains the defect: At the fetched main revision, the Codex normalizer returns only runId and childSessionKey, and per-run accounting overwrites the producer receipt. The requested completion-intent preservation is therefore still missing. (src/agents/accepted-session-spawn.ts:32, 9dd45f672760)
  • Producer receipt and projection ordering: The spawn tool records the canonical receipt before returning its result. The patch retains that first receipt for the exact operational instance; Codex now preserves completion intent through the shared normalizer, and Copilot retains equivalent normalization behavior. (src/agents/accepted-session-spawn.ts:34, 422258f4d1c7)
  • Live authority remains enforced: Requester settlement checks cancellation and exact live admission immediately before registry mutation. The registry separately matches requester session, agent, turn, child identity, and completion obligations before persisting and scheduling delivery; receipt retention does not replace these checks. (src/agents/requester-run-settlement.ts:103, 422258f4d1c7)
  • Behavior proof and regression coverage: The captured PR body reports three baseline failures and five consecutive successful subagent-handoff runs using an isolated Gateway, native Codex runtime, managed mock provider, and QA channel. The unchanged scenario requires delegated work and a parent reply containing the result. Added coverage checks true, false, and missing completion intent, middleware rewriting, and producer-receipt preservation. The reported 378 focused tests are supplemental; this review did not execute tests. (qa/scenarios/agents/subagent-handoff.yaml:1, 422258f4d1c7)
  • Affirmative Codex dependency signal: The changed adapter implements native Codex dynamic-tool responses, and the PR’s proof explicitly exercises that runtime. extensions/codex/package.json pins @openai/codex 0.154.0, so direct dependency inspection applies. (extensions/codex/src/app-server/dynamic-tools.ts:774, 422258f4d1c7)
  • Native dynamic-tool contract inspected: The sibling checkout resolves to this commit; its cache remote verifies openai/codex ownership. DynamicToolHandler consumes content_items and success, preserving the successful accepted-launch protocol contract. OpenClaw’s completion receipt remains host-side bookkeeping. (codex-rs/core/src/tools/handlers/dynamic.rs:153, 6b9826e3aa83)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-18T21:30:31.266Z sha 422258f :: blocked before merge. :: none

@steipete
steipete marked this pull request as ready for review September 18, 2026 21:32
@steipete steipete self-assigned this Sep 18, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready review of the delegated-completion receipt repair at 422258f4d1c7b5bfb1f7dd8350e5e8ba7d6b1f6e.

The spawning tool records the complete receipt before returning. Codex's duplicate normalizer omitted expectsCompletionMessage; backend aggregation then replaced the producer receipt with that partial projection, and requester settlement skipped delivery transfer. The repair keeps the first receipt authoritative for the exact operational run and uses the canonical normalizer in Codex and Copilot. It removes duplicate policy: production +17/-35 (net -18); tests +169/-89, including moved existing cases; docs +8/-0. No configuration, schema, deadline, retry, or baseline change.

I independently inspected the producer, canonical accounting, both harness consumers, backend projection, requester settlement, and regression coverage. I also inspected openai/codex directly: codex-rs/app-server-protocol/src/protocol/v2/item.rs:1653 defines only content_items and success in the dynamic-tool response; codex-rs/core/src/tools/handlers/dynamic.rs:153 consumes those fields. OpenClaw completion receipts remain host-owned and outside that wire protocol. Cancellation and current-run authority checks remain in requester settlement. Best-fix verdict: retain producer facts and remove the duplicate normalizers; reconstructing completion intent later or adding delivery retries would repair the wrong owner.

The retained evidence was independently read: baseline handoff failed twice on macOS and once on Linux with a successful child and pending delivery; focused regressions failed before repair. All 378 focused tests, the private-QA build, and the full selected changed-file gate passed. Five unchanged runtime-pair handoff runs passed on Node 24.19.0, covering ten OpenClaw/Codex cells, with suite durations 69.94s, 105.86s, 104.09s, 110.44s, and 150.38s. The scenario ran the actual isolated Gateway and native Codex with a managed mock provider and QA channel. The reviewed patch survived the clean rebase unchanged. Fresh independent P0–P2 autoreview found no actionable defects.

The runtime proof command was:

OPENCLAW_BUILD_PRIVATE_QA=1 pnpm build
pnpm openclaw qa suite --provider-mode mock-openai --concurrency 1 --model openai/gpt-5.5 --alt-model openai/gpt-5.6-luna-alt --runtime-pair openclaw,codex --scenario subagent-handoff --output-dir .artifacts/qa-e2e/subagent-handoff-proof

Compatibility disposition: the maintainer accepts the coordinated core SDK, Codex, and Copilot release. The new plugin builds must ship with a core build containing this export; released v2026.9.4 lacks it. Actual release callers enforce synchronization: release:check calls release:generated:check, which runs scripts/release-preflight.mjs --check; its plugin-version entry invokes sync-plugin-versions.ts --check. release-fast-pretag-check.sh:11 also invokes plugins:sync:check, and release-candidate-checklist.mts:1288 invokes the generated check. The synchronizer updates compat.pluginApi to the release version; npm runtime packaging derives its peer floor from that field, and installation enforces it.

Independent plugin publication is not certified here: plugin-npm-release.yml:403 calls the metadata checker, which does not itself invoke the synchronizer. A separate plugin publication must synchronize/update its compatibility floor first. Main push does not publish—the publication job requires workflow dispatch and release approval. This explicitly resolves the ClawSweeper coordinated-release risk without guessing a future version or introducing a runtime fallback. No release or publication is performed by this work.

The separate pre-dispatch chat.history SQLite stall is tracked by #152050; this PR fixes the independently reproduced lost-completion-intent defect in #152170.

Exact-head CI 35397266923 is green. node scripts/watch-pr-ci.mjs 152172 422258f4d1c7b5bfb1f7dd8350e5e8ba7d6b1f6e attached that run and returned GREEN (exit 0); the terminal REST job lists contain no pending or failed jobs.

@steipete
steipete merged commit 52e409a into main Sep 18, 2026
294 checks passed
@steipete
steipete deleted the codex/deflake2-runtime-pair-20260918 branch September 18, 2026 22:08
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 19, 2026
…penclaw#152172)

Keep the original accepted-spawn receipt authoritative for its operational run. Reuse the canonical receipt normalizer in Codex and Copilot so completion intent survives harness projection and result middleware.

QA runtime-pair reproduction on macOS and Linux exposed successful children left pending after the requester yielded. Preserve completion ownership so the parent resumes and delivers their results. This repair does not claim to explain the separately reported chat.history request timeout.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation extensions: codex extensions: copilot maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Codex parents can lose completed delegated results after yielding

1 participant