Repository navigation
fix(agents): human messages queue during optional completion turns - #176245
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. What this changesThis PR lets accepted human input strengthen a visible optional embedded turn’s reply requirement and preserves its transcript custody before Codex dispatch. Example: A human sends “Answer this human correction” while a visible embedded completion has an optional reply requirement.
Review scores
ProductKind: Feature · Worth it: Needs a maintainer decision · Fix scope: Complete Merge readiness⛔ Blocked before merge - 1 item remains This PR retains distinct, coherent work beyond the merged consolidation, but changing the deliberate follow-up policy still needs an owner decision; no actionable introduced code defect was found. Priority: P2 Decision needed
Before merge
FindingsNone. Agent review detailsHow this fits togetherThe session controller admits human steering into an active backend, which records acceptance and transcript custody; completion uses the resulting reply requirement to recover missing answers. flowchart TD
Human[Human correction] --> Controller[Session controller]
Controller --> Checks[Existing admission checks]
Checks --> Embedded[Embedded acceptance]
Checks --> Followup[Separate followup]
Embedded --> Registry[Run reply requirement]
Registry --> Completion[Completion and recovery]
Completion --> Reply[Visible reply]
Technical reviewBest possible solution: Approve bounded embedded promotion through the existing acceptance and completion owners while retaining separate follow-up for unsupported backends. Do we have a high-confidence way to reproduce the issue? Current-main source and documentation establish the reply-expectation mismatch and separate-turn fallback; supplied historical Gateway evidence exercises the proposed alternative, and no target code was executed during this review. Is this the best way to solve the issue? The patch uses the existing acceptance, run-registry and completion owners to preserve the strongest accepted reply requirement without expanding pending-question permission, but its deliberate scheduling change requires owner direction. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against afecea855376. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +109, Tests +250, Docs +3. Total +362 across 18 files. Added test files: 1. View PR surface stats
Review metrics
LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (8 earlier review cycles)
Reviewed October 21, 2026, 11:54 PM ET / October 22, 2026, 03:54 UTC (Revision 9). |
|
@clawsweeper re-review Please review current head The body now includes causal base RED for the two admission cases with three rejection controls, plus a passing isolated shipped-Gateway capture: authenticated human input joins the same visible optional embedded run, is consumed by its next model request, survives an empty final through actual required-reply recovery, and produces exactly one original-run final. The real acceptance sink and terminal metadata record required. The optional host-policy fixture, local scripted provider and absence of an actual child-completion lifecycle claim are explicit. All exported evidence is synthetic and allowlisted; no guard was replaced. The maintainer decision on bounded reply-obligation promotion remains requested, not assumed. |
|
🦞👀 Re-review progress:
|
|
Response to the behavior decision in the current review. The body now answers the optional-completion question through the original required-answer intent in #152786 and the deliberate fallback in #158699. It recommends acceptance-time promotion while retaining visibility, authority and strongest-result controls. Pinned Codex source supports active-owner steering; it is not offered as proof of OpenClaw reply obligations or native support in this public head. |
|
@clawsweeper re-review Please review current head The clean upstream integration retains requester-origin checks and exact backend attachment. The explicit maintainer decision remains bounded reply-obligation promotion after compatible human input is actually accepted; the body gives the code and Codex reference argument without presuming owner approval. |
|
🦞👀 Re-review progress:
|
7176e6d to
1b57590
Compare
|
The missing current-head production-client persistence trace is now in the PR body's Evidence section at unchanged head The actual original recorder commits before official native @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review Current head |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…penclaw#176245) * fix(agents): let human input steer optional completion turns * test(agents): preserve ask-user steering assertions with acceptance callback * docs: clarify accepted input in visible completion turns * fix: retain human reply obligations during collaborative steering * fix(codex): preserve human steering transcript custody
What Problem This Solves
A user sends a new instruction or question while the assistant is processing a background result—for example, “Use the updated figures in the summary.” The message currently waits for a separate turn even when the running task could accept it.
That delay protects an important guarantee: background processing may finish without a visible response, but new human input needs the same handling as an ordinary human request. This PR lets a supporting runtime accept the input into the ongoing work and retain its normal response requirement.
User Impact
New human instructions can affect compatible work already in progress instead of waiting for background processing to finish. A command can lead to action and a report of the outcome; a question can receive an answer. The change preserves the normal response requirement when the runtime actually accepts the input—it does not classify every message as a question or guarantee that a requested action can be performed.
This applies to visible work in the built-in embedded runtime. It does not add optional-work promotion to native Codex. Hidden work, unsupported runtimes and requests that cannot use the current execution continue through the existing follow-up path; permissions and explicit control commands keep their existing checks.
Why This Change Was Made
The current equality guard rejects required human input against an optional completion. Simply accepting that input would leave finalization free to return no answer. The embedded runtime now advertises support for promotion and records the stronger requirement only when the input is actually accepted. Retry and finalization read that same run-owned fact; a new execution clears it. Explicit result requirements remain stronger than ordinary required replies.
Related: #175763, #175810. This covers promotion of a visible optional completion; the Codex backend producer fix in #175810 addresses a different missing-value case.
Maintainer decision requested
Approve bounded reply-obligation promotion for compatible human input joining a visible optional embedded turn. Hidden turns, unsupported backends and current authority refusals retain their existing admission policy. This extends the previously deliberate follow-up policy; no owner approval is presumed.
Behavior decision
The review asks whether compatible human input may join a visible optional completion and promote its reply obligation. I recommend bounded promotion because the mismatch guard protects required answers. #152786 establishes that model-authored silence cannot erase the input owner's answer obligation. #158699 retained followup when optional background turns could not honor that obligation.
This PR supplies that missing guarantee for supporting embedded sinks. Admission retains visibility and matching-authority checks; promotion is recorded only at actual acceptance. Completion retains the strongest accepted requirement, including result-required, for the same execution. Rejected input does not create an obligation; unsupported or hidden turns retain followup.
Codex's steering owner validates the active turn and its output-schema contract before appending input to that turn. This supports retaining the execution owner, but proves no OpenClaw optional-reply guarantee. The remaining product question is whether a separate turn is required even when actual acceptance transfers the answer obligation safely. This intentionally changes the old fallback while preserving its reason. Current public proof covers embedded acceptance and empty-final recovery; native promotion is not claimed for this public head.
Relationship to the consolidation
#177698 merged as
f83b7ade15f3aefad7b367bef084ea5ffdbd9f8b. It incorporates the earlier frozen-capability, accepted-result and canceled-wake repairs, so #175763, #177618 and #177661 are now closed as superseded.This PR remains a separate behavior proposal: the landed consolidation still queues required human input arriving during optional work. This change lets compatible human input join visible optional embedded work and strengthens the reply obligation only when the runtime actually accepts it. Hidden work, unsupported backends and authority refusals retain followup custody. Native Codex optional-reply promotion is not implemented by this PR.
At current head
ae57b93ca833f74f17f7fe63f1d34ba61f27d4f4, hosted CI passes and the review has no findings. The maintainer decision remains whether to accept this bounded change to the previous separate-turn policy; the consolidation's approval of compatible required-to-required steering does not settle that separate choice.Evidence
Current integration checks (2026-10-22)
Current head
ae57b93ca833f74f17f7fe63f1d34ba61f27d4f4integrates pinned upstream52df852cd5be3b3691ef27d0942a4db7b2258eb1into the standalone reply-promotion proposal. It preserves upstream’sresult-requiredControl UI announcement behavior and its distinction between ordinary human input and permission to answer a pending question, including the existing adapter for released external sinks. The independent accepted-human reply fact remains available to supporting embedded sinks. Codex keeps its current unsupported promotion limit; compatible human input against optional native work retains queued followup.The policy decision below remains open. This repair does not infer owner acceptance, native optional-reply promotion, peer-steering expansion, or a new deployment. Historical runtime captures below remain qualified to their recorded source revisions; they are not runtime proof for this repaired candidate.
Local validation of this integrated source passes the four targeted owning suites (114.49 seconds through the canonical wrapper), covering embedded accepted/rejected reply promotion, pending-question controls, source-reply completion, and native persistence-before-dispatch/exactly-once settlement. Core and extension production types, the owning embedded/ask-user and native settlement test type graphs, scoped typed lint, formatting, and whitespace checks pass. The native settlement suite reports 36.39 seconds including compilation (three cases; approximately five seconds of test execution). This reuses existing regression cases; no new test harness, dependency, policy, or baseline exception was added. Exact-head hosted CI and applicable dependency/security checks pass; the remaining merge question is the bounded reply-promotion policy below.
Fresh independent P0–P2 review of the net candidate against the pinned upstream base is
scoped-cleanwith no actionable findings. It completed two passes: one metadata/context pass and one implementation-diff pass. The first pass explicitly records limited confidence without an implementation diff; the second reviews the actual changes with frozen source context. This is source review, not a new authenticated runtime capture or owner approval.The simplify pass retains one accepted-human reply fact in the existing run owner, preserves upstream’s current/legacy queue adapter, and removes one unrelated formatting-only hunk by restoring upstream bytes. Net changes against pinned upstream are production +139/−30, tests +261/−11, and documentation +12/−9 lines. Production growth is acceptance, completion, and custody plumbing; the existing seven-case promotion group supplies the core regression proof.
Earlier upstream integration
Prior candidate
66eea4b4ef10f196ba1640398d186884d5557cddmerges the preceding public head1b57590afc4b3e5ba9d5e7d46b6a6f2ab8699bd7with upstream42a73b62bb18abd0dc6b68fca0daf50f62331f79. The sole conflict retains the reply-promotion capability alongside upstream's referenced delivery-mode type. The shared backend-contract extraction keeps the independent human-reply fact and native predispatch persistence predicate; no consolidated adapter/accounting cutover is imported.75 affected checks across four files pass, including embedded promotion, pending-question controls, stable prefixes and the controller-adapted Codex persistence regression. Core and extension production types, scoped typed lint/format, whitespace, a fresh complete P0–P2 review and the exact-candidate runtime build pass. The build retains its UI gzip-size advisory; no budget was changed. The local review is source/test evidence; the new native transport capture below supplies the previously missing ordering trace.
Upstream's declared native dependency is now 0.162.1. Earlier native evidence and failed collectors remain at their recorded revisions and runtime versions. The new exact-head capture below closes the controller-adapted human commit-before-dispatch/exactly-once proof gap. The reply-promotion product decision remains open; that capture claims neither a local deployment nor maintainer approval.
Exact-head native persistence-before-dispatch proof
A fresh isolated Gateway capture at
66eea4b4ef10f196ba1640398d186884d5557cdduses the exact built standalone source and its declared official Codex 0.162.1 app-server, without a native version override. Two genuinely authenticated synthetic profiles exercise actual controller adaptation. The actual human-input recorder is deliberately held before invoking its original implementation: no native correction dispatch or positive controller acceptance occurs while it is held. After release, the original recorder commits 6.45 ms before the actual nativeturn/steerdispatch; its ACK and controller acceptance follow. The native consumed-input events, provider continuation and journal identify the same original native thread/turn and correction. Canonical history and the native journal each contain that correction once, with one corrected visible final and no pending inputs. No native interrupt was sent; both native processes exit normally with code 0, and task Gateway/provider/proxy/state cleanup succeeds.This is actual Gateway/controller/recorder/official-native-client proof with scripted local inference and hash-pinned observations, not simulated native RPC. It proves this ordering and exactly-once requirement for an ordinary required human turn; it does not prove native optional-work reply promotion, profile reassignment, restricted model-policy changes, or answering another requester's pending question. No authority result or recorder implementation was replaced. The earlier restricted-role collector remains a failed setup, rather than being relabeled as passing evidence.
Source/build/native/observer pins and raw receipt correlations were rechecked. The outgoing allowlist received three automated privacy passes, a complete manual read, and an independent 93-check accuracy/privacy audit. Only synthetic observations and relative timings are published.
Redacted native stage receipts
{ "schema": "176245-production-client-persistence-proof-v1", "sourceCommit": "66eea4b4ef10f196ba1640398d186884d5557cdd", "nativeVersion": "0.162.1", "nativeVersionOverride": false, "status": "passed", "syntheticOnly": true, "boundaries": { "gateway": "actual standalone build", "nativeClient": "official Codex app-server", "provider": "scripted local inference", "nativeRpc": "unmodified requests and responses", "observation": "hash-pinned module observations plus an explicit gate before the original recorder call" }, "scenario": { "ordinaryRequiredHumanTurn": true, "distinctAuthenticatedProfiles": true, "matchingConfiguredRolePermissions": true, "restrictedRoleModelPolicyConfigured": false, "actualControllerAdaptation": { "isInboundUserReply": true, "isInboundUserMessage": false, "allowPendingUserInputAnswer": false } }, "whileOriginalRecorderHeld": { "canonicalCorrectionRows": 0, "nativeCorrectionDispatches": 0, "positiveControllerAcceptances": 0 }, "events": [ { "sequence": 1, "stage": "actual-controller-adapted", "relativeMs": 0.0 }, { "sequence": 2, "stage": "actual-beforeSubmit-recorder-entered", "relativeMs": 515.114959 }, { "sequence": 3, "stage": "actual-beforeSubmit-recorder-released", "relativeMs": 578.52925 }, { "sequence": 4, "stage": "actual-original-recorder-committed", "relativeMs": 594.8965 }, { "sequence": 5, "stage": "actual-native-turn-steer-dispatch", "relativeMs": 601.344167 }, { "sequence": 6, "stage": "actual-native-turn-steer-ack", "relativeMs": 602.404209 }, { "sequence": 7, "stage": "actual-controller-acceptance", "relativeMs": 602.671542 } ], "result": { "actualOriginalRecorderReturnedUserAdmissionReceipt": true, "nativeSteerDispatches": 1, "nativeSteerAcks": 1, "positiveControllerAcceptances": 1, "sameOriginalNativeThreadAndTurnConsumedCorrection": true, "scriptedProviderCorrectionRequests": 1, "canonicalCorrectionRows": 1, "nativeJournalCorrectionRows": 1, "correctedVisibleFinals": 1, "pendingInputs": 0, "nativeInterruptRequests": 0 }, "cleanup": { "nativeProcesses": 2, "nativeExitCodes": [ 0, 0 ], "nativeSignals": [ null, null ], "gatewayStopped": true, "providerStopped": true, "proxyStopped": true, "taskStateRemoved": true, "cleanupErrors": 0 }, "qualification": [ "Actual original recorder and official native client; inference responses are scripted, not real model output.", "The observer deliberately holds the original recorder call; it does not replace the controller decision, recorder, or native RPC.", "This capture establishes adapted-human persistence-before-native-dispatch and exactly-once transcript recording for the current standalone revision.", "It does not establish optional-work reply promotion, profile reassignment, restricted model-policy enforcement, or authority to answer another requester pending question.", "Prior failed collectors remain failed evidence. The earlier restricted-role capture never reached the native provider because its direct route could not enforce model policy; this run uses legitimate unrestricted synthetic writer roles, without replacing that guard." ] }Collaborative reply-promotion repair at
cb730e6fe3ab5bb3d9112bd54134070759cf6697Addresses the current P2 collaborative reply-loss finding. The controller captures the admitted human-message fact before adapting pending-question eligibility. The embedded acceptance callback uses that fact to retain the human reply obligation, while another requester's pending question remains protected. No question, visibility, authority, or strongest-result guard is relaxed.
Both collaborative required/result-required cases fail against the prior production code: input is accepted but the expectation remains optional. They pass with the repair and assert pending-question protection, accepted obligation, missing-empty-final classification, and actual correction consumption by the original AgentSession continuation. 120 affected checks across five suites pass. The unchanged seven-case promotion group moves into a coherent sibling test-support module to preserve the line cap without another harness or baseline exception; its 38-case owning suite passes after extraction (4.73 seconds Vitest / 24.49 seconds wrapper wall).
Core and owning test types, typed lint, formatting, line/mock/assertion ratchets, and fresh independent P0–P2 review pass. Final unused-import cleanup is test-only. These are synthetic owner/AgentSession regressions, not a new authenticated Gateway collaborative capture. Earlier shipped-entry evidence retains its stated revision and scope. Hosted CI and the separate human-promotion behavior decision remain outstanding. No operator Gateway was changed or restarted for that capture.
Documentation follow-up at
44747a5a4ae7fe656ee76acb77e62ac177e827e5Addressed the queue-steering documentation finding. Visible optional completion turns may accept compatible human input in a supporting embedded runtime; only runtime acceptance promotes the required visible reply. Hidden turns, unsupported backends, and different execution routes retain followup and cancellation behavior. This is a one-paragraph documentation correction only. Production and test sources are unchanged from
6e6642ca99e5a7eb450c8f6711a0db438ed32a9b, so the revision-qualified runtime evidence below is retained. Formatting, Markdown lint (1,359 files), MDX checks (1,381 files), whitespace and ordinary Git hooks pass. Hosted CI is red only on an inherited UI absolute-budget breach: the base and candidate both measure 1,050,200 B against a 1,050,000 B limit, with zero added bytes and identical UI/build/dependency trees (exact-head failed job). The other completed checks, including docs, pass. The fresh exact-head review has no findings and resolves the documentation comment; the maintainer behavior decision remains open.Earlier upstream integration at
03ed0dbHead
03ed0dbcd3923f6e0760e594ba0c14aff5f3129dmerges upstream9509fc22to repair the named inherited Control UI performance gate. This adopts the complete upstream boot-work repair (#177117), preserving both histories. No local UI feature, budget, baseline or dependency exception was introduced; the reply-promotion proposal is unchanged.The canonical UI performance comparison now passes against pinned upstream with the same installed toolchain. New Session boot JavaScript is 1,026,041 gzip bytes against the unchanged 1,050,000-byte cap (base 1,025,701 bytes; +340 bytes). The earlier head measured 1,050,200 bytes and failed. Precompressed assets and all absolute/growth budgets pass; no suggestion to lower an unrelated baseline was applied.
150 affected checks pass in four suites (50.9 seconds canonical wrapper wall time): stream acceptance, ask-user forwarding, reply registry and source-reply completion. Core and four owning test type graphs, scoped typed lint, formatting, line-cap and whitespace checks pass. Integration is an automatic merge with no manual source edits; the prior independent review remains qualified to its original revision. Exact-head CI and hosted rereview are requested. Historical authenticated runtime evidence below retains its original source qualification.
The explicit maintainer decision on human reply-obligation promotion remains open. No operator Gateway was changed or restarted for that capture.
Historical boundary evidence
Earlier head
894223358d3135608c628ad133b2686914ee85b5fixes the four CI failures caused by the ask-user helper's obsolete nine-argument assertion. It now checks exactly one delivery and exact forwarded text/images while allowing the new acceptance callback. Production is byte-identical to139b7a08a03d48172c88ae860636bda39933475a, whose exact built runtime was used for the capture below.ca5ac6f5b69aa8704b653fade36e2fa59937c7fb, the required/result-required admission cases fail at the actual acceptance assertion; three rejection controls pass. All production bytes were restored before current checks. The base run took 44.1 seconds wall / 13.5 seconds Vitest.agenthandler, then sends required human input through unchangedchat.sendwhile the original provider response is held. The actual admission guard observes matching authority and optional→required promotion support. The real AgentSession acceptance sink records the stronger requirement before the provider is released. The human marker reaches the original continuation's next model request. An empty assistant final triggers actual required-reply recovery; the third provider request yields exactly one final on the original run, and terminal metadata reportsrequired.startTurncall. Authorization, preflight/current authority, steering, runtime, and finalization execute unchanged. The Responses wire is scripted on an isolated local provider; this is an embedded-runtime proof, not an external model-service or actual child-completion lifecycle claim. The earlier unauthenticated-producer attempt and the backend-only-parameter setup refusal remain failed fixture attempts, not passing evidence or bypasses.{ "source": "139b7a08a03d48172c88ae860636bda39933475a", "syntheticInputsOnly": true, "entryPoint": "authenticated Gateway agent RPC and chat.send", "qualification": "Task-only loader supplies optional host policy at the existing agent-handler startTurn boundary. No actual child-completion lifecycle or external model service is claimed. Authorization, admission, current-authority guards, runtime and finalization are unchanged.", "initialReplyExpectation": "optional", "incomingReplyExpectation": "required", "authorityFingerprintsEqual": true, "originalProviderHeldUntilActualAcceptance": true, "humanMarkerConsumedByOriginalContinuation": true, "emptyFinalRecovered": true, "terminalReplyExpectation": "required", "exactlyOneVisibleFinalOnOriginalRun": true, "gatewayStopped": true, "providerStopped": true, "fixtureRemoved": true }All inputs, owner identities, provider responses and credentials in these tests are synthetic. Published evidence is allowlisted aggregate facts: no transcripts, credentials, hostnames, endpoints, paths or session/run identifiers are included. Task Gateway, provider and fixture state were cleaned up.
Codex transcript-custody follow-through
The Codex consumer now uses the preserved human-input fact when committing steering before native dispatch. The separate pending-question eligibility flag remains unchanged. Internal guidance still waits for native acceptance before persistence; human input is committed once before sending and is not persisted a second time after consumption.
The regression exercises the real SDK → controller → Codex path, holds the transcript recorder, verifies zero native steering requests before commit, then confirms correlated native consumption and one canonical user message. It failed on the preceding producer-only revision. The final focused run passed 39 tests across three files; the owning extension test type graph, scoped typed lint, formatting, and fresh independent P0–P2 review passed. This is simulated-native boundary proof, not a live-provider or deployment claim, and does not establish the cause of every queued-message incident.
Historical combined local deployment (2026-10-20)
The operator explicitly opted into a combined local deployment containing main consolidation
7605b4fc8c28a628cd4d6b9a3e63bc9f1304ce10, reply-obligation candidate66eea4b4ef10f196ba1640398d186884d5557cdd, reconnect candidatede1dfafe07c8f0762b9e5fc16d4dfc6b36a3fbeb, and selected-requester candidate9600c93d45bbdb867ff738d258f25ea94a7f2f45, alongside existing local integrations and the separately restored saved-attempt UI work. The resulting local build is764886a56987d82f3a3934e2dd7d6a2416ef98da.Operational readback confirms the exact loaded build, readiness, health, Node 24, unchanged service environment, and all 25 previously active plugins. This is a combined integration deployment, not standalone validation of each PR or security/session-owner acceptance of any extracted policy. No new business-message, native-effect, revocation or reassignment proof is inferred from operational health. The earlier isolated traces below retain their recorded revisions, scenarios and failed-collector qualifications.