Skip to content

Backport native Codex completion delivery fix - #130328

Merged
pash-openai merged 3 commits into
sjf_openclaw_2026-07-31from
pash/backport-native-subagent-completion
Aug 26, 2026
Merged

pash-openai merged 3 commits into
sjf_openclaw_2026-07-31from
pash/backport-native-subagent-completion

Conversation

@pash-openai

@pash-openai pash-openai commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Backports the native Codex completion fix and its history-recovery follow-up onto this release branch. A child result already consumed by Codex must not be injected a second time after the parent writes its answer: that extra turn can replace the answer with NO_REPLY and leave the user with nothing.

The backport preserves this branch's existing monitor and reference-counted owners. It adds the small turn-binding hook needed to recognize native delivery, including results that arrive during startup. It does not pull in main's newer child-subscription and hook-retention changes. Detached children still wake their parent, and intentional silence remains unchanged.

The same ordering, startup, history-recovery, and trust-boundary regressions run here alongside this branch's existing monitor, projector, client, and task-mirroring tests. There are no dependency, configuration, model, prompt, or persisted-state changes.

* Fix missing replies after native Codex subagents finish

* Fence subagent completion during parent startup

(cherry picked from commit 8e9db5e)
@clawsweeper

clawsweeper Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@pash-openai
pash-openai marked this pull request as ready for review August 26, 2026 19:51
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-08-26T19:54:23.387802Z 5eccdb7 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5eccdb7527

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +990 to +995
const childThreadId = this.childThreadIdsByAgentPath.get(
buildParentAgentPathKey(state.parentThreadId, agentPath),
);
const child = childThreadId ? this.childStates.get(childThreadId) : undefined;
if (!child || child.parentThreadId !== state.parentThreadId) {
continue;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Buffer receipts while task-row recovery registers children

When a monitor is recreated with an existing native-child task row, reconcileTaskRowsForParent waits asynchronously for thread/read; a native completion receipt can arrive during that wait, before registerChildThread populates this map. This branch silently discards the receipt, so later recovery marks the child pending and unregister() injects the completion again—the same extra turn that can replace the parent's answer with NO_REPLY. Retain requester/turn-scoped receipts until reconciliation finishes, then match them when the child is registered.

AGENTS.md reference: AGENTS.md:L30-L32

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed with two failing regressions: the history read can finish either before or after parent release, and both injected the result twice. Fixed on main in #130347 (a021f79) and backported here. Receipts stay scoped to the owning parent run and its already outstanding recovery candidates; authoritative history restores the child agent path before matching. Tests also cover foreign turns, different parent lineage, and stale receipts in a later run. Native receipt acknowledgement still does not determine task success.

@pash-openai

Copy link
Copy Markdown
Contributor Author

This backport contains mainline carriers 8e9db5e and a021f79, adapted only to the release branch's existing reference-counted parent ownership. The turn-start binding is its existing caller's only additional integration change. No newer main subscription/hook machinery is included.

Exact head cf11a7c passes 351 focused tests with node scripts/run-vitest.mjs over native-subagent-monitor.test.ts, native-subagent-notification.test.ts, native-subagent-task-mirror.test.ts, event-projector.assistant.test.ts, shared-client.test.ts, client.test.ts, and the three run-attempt/steering/native-hook files under extensions/codex/src/app-server. Focused oxlint --type-aware, oxfmt --check, and git diff --check pass. CI run 33009228492 passes the changed tests, production/test types, build, lint, boundaries, and SQLite session-flip proof: https://github.com/openclaw/openclaw/actions/runs/33009228492.

The release dependency audit and aggregate gate remain red on the four existing brace-expansion, fast-uri, nanoid, and undici advisories. The package manifests and lockfile are byte-identical to base 9e0ff43. I am landing this bounded delivery repair with that known existing audit exception, not claiming full green CI or changing the audit to hide it. Dependency remediation remains separate release maintenance.

The recovery review is addressed in the upstream follow-up and here. Public Codex input delivery was checked directly in codex-rs/core/src/session/mod.rs, codex-rs/core/src/session/handlers.rs, and codex-rs/protocol/src/protocol.rs. Native input acknowledges delivery; authoritative lifecycle/history still determines the child's outcome, and the final-answer selector is unchanged.

@pash-openai
pash-openai merged commit 792a287 into sjf_openclaw_2026-07-31 Aug 26, 2026
86 of 90 checks passed
@pash-openai
pash-openai deleted the pash/backport-native-subagent-completion branch August 26, 2026 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant