Repository navigation
Fix missing replies after native Codex subagents finish - #130311
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: eb6033ca49
ℹ️ 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".
| } | ||
| // Codex owns completion input while a parent turn is running. Wait until | ||
| // its reply is finalized before waking it for any still-undelivered child. | ||
| if (state.owners.size > 0 && state.turnIds.size > 0) { |
There was a problem hiding this comment.
Fence completion delivery during turn startup
When a child completes after registerParent but before turn/started or bindTurn, owners is nonempty but turnIds is empty, so this condition falls through and immediately calls deliverAgentHarnessTaskCompletion. The monitor is registered before route activation in extensions/codex/src/app-server/run-attempt-route.ts:82-92, while the turn ID is not bound until extensions/codex/src/app-server/run-attempt-turn-start.ts:325-326; Codex can therefore also inject the native result into the starting turn, recreating the duplicate steer and missing-final-answer race. Treat an unbound active owner as startup-in-progress and let unregister drain the completion if startup fails.
AGENTS.md reference: AGENTS.md:L45-L47
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 572ae7c. Registration now fences synthetic completion delivery even before a turn ID exists. Releasing the final registration drains any completion that Codex has not consumed, including startup failure. The regression exercises an unbound parent and proves there is no delivery until release; the existing detached/recovery and subscription-ownership cases now explicitly model whether the parent is active or detached. All 227 focused monitor, notification, projector, task-runtime, shared-client, and retention tests pass.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
The fix is ready on 572ae7c. Codex owns native child-result delivery while the parent is starting, running, and finalizing its reply; OpenClaw only announces results that remain undelivered after that registration is released. This removes the duplicate steer without changing last-answer selection or intentional The boundary regression fails on the original code and preserves the complete parent answer after the fix, in both native-first and terminal-first event order. It uses the real final-answer projector, not an assertion that the model should always answer. Coverage also includes startup before turn binding, detached completion, recovery and retry ownership, old/foreign/untrusted receipts, child subscription cleanup, and intentional silence. The pinned public Codex contract was inspected directly in All 227 focused tests pass with Production delta is +101 lines: explicit native delivery receipts and foreground-turn ownership cannot be expressed by the previous child-terminal-only state. Shared completion cleanup replaces the old duplicated success path. The rest is regression coverage and making existing background-delivery fixtures explicitly release the foreground owner. No schema, dependency, prompt, configuration, or model changes. |
* Fix missing replies after native Codex subagents finish (#130311) * Fix missing replies after native Codex subagents finish * Fence subagent completion during parent startup (cherry picked from commit 8e9db5e) * Keep test teardown compatible with the release lint rules * Keep native completion receipts through child recovery (#130347) (cherry picked from commit a021f79)
Codex already delivers native subagent results to a running parent. OpenClaw was independently steering the same completion into that turn. If the parent had just written its answer, the extra notification could prompt a
NO_REPLYthat replaced the answer before it reached the user.This keeps completion input with Codex while the parent is working. The monitor records native delivery receipts for the current parent turn and its known children, while continuing to track task status. Any result that was not delivered natively still wakes the parent after its foreground run finishes. Detached recovery, delivery retries, and deliberate silence remain intact; the final-answer selector is unchanged.
The receipt uses the existing public Codex agent-message envelope and completion format. Synthetic regressions exercise both event orderings through the monitor and final-answer projector, as well as late completion, intentional silence, stale or unrelated receipts, and client shutdown.