Repository navigation
feat: retain required results without model polling - #162707
Conversation
Co-authored-by: VACInc <[email protected]>
Worked on by: - @VACInc Co-authored-by: VACInc <[email protected]> OpenClaw-Publication: cec817cf-dea5-4829-859b-02ad1b724e19
|
🦞👀 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: needs maintainer review before merge. Reviewed October 1, 2026, 9:10 AM ET / 13:10 UTC. ClawSweeper reviewWhat this changesThe PR adds optional required-result handling to shell commands, collector waits, and OpenClaw Code Mode so pending results can complete without repeated model polling. Merge readiness✅ Ready for maintainer review Keep open: current main lacks this completion contract, and source review found no concrete blocking defect. The merged collection-guidance work does not supersede it. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw's agent runtime executes model-requested tools and returns their results to the conversation. Code Mode coordinates JavaScript programs with those tools, retaining their continuation while required work settles. flowchart TD
A[Model tool call] --> B{Required result?}
B -->|No| C[Existing continuation behavior]
B -->|Yes| D[Pending call owner]
E[Process or collector completion] --> D
D --> F[Resume exact program]
F --> G[Return collected result]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +146, Tests +596, Docs +42. Total +784 across 19 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep required-result enforcement with the existing process, collector, and Code Mode owners while preserving detached services and cancellation limits. Do we have a high-confidence way to reproduce the issue? Not applicable as a new opt-in capability. The supplied registered-boundary regressions demonstrate the intended pending-call scenario with controlled processes and providers; no live reproduction was run here. Is this the best way to solve the issue? Yes: extending the existing pending-call owners avoids a competing task ledger and preserves the exact continuation, established access checks, and execution allowance. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 6010d074f754. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
* feat: retain required results without model polling Co-authored-by: VACInc <[email protected]> * feat: retain required results without model polling Worked on by: - @VACInc Co-authored-by: VACInc <[email protected]> OpenClaw-Publication: cec817cf-dea5-4829-859b-02ad1b724e19 --------- Co-authored-by: roboclaw-bot <[email protected]> Co-authored-by: VACInc <[email protected]>
Related: #143701. Follow-up to #162303, which repairs collection guidance rather than enforcing collection.
What Problem This Solves
Agents can return an answer while a needed command result remains uncollected, or spend repeated model turns polling a still-pending tool or collector.
User Impact
required: truelets a caller make command or collector results a runtime-owned prerequisite for finishing the call. Required Code Mode work stays active and resumes from completion events without model polling or replaying completed actions. Explicitly detached servers keep their current behavior, includingnotifyOnExit=false.This is opt-in at call admission, not semantic judgment of a plan or retroactive tracking of previously detached handles. Ordinary announcing children keep their existing
sessions_yieldprotocol. Required calls occupy their existing execution capacity; Stop, source replacement, and run/tool/process deadlines still apply. Only off-VM tool waiting pauses the Code Mode execution allowance; computation, checkpoint/restore work, and guest timers remain charged. No new configuration, persisted schema, retention policy, scheduler, or notification setting.Why This Change Was Made
Keep required work at its existing producer and pending-call owner instead of adding a competing task ledger or blocking a native Stop hook. Shell exec collects its terminal result; collector waits join all requested authorized results through registry events; Code Mode retains the exact continuation and its unused execution allowance. A normal final cannot bypass the still-pending call.
Evidence
openclaw/ci-gateentries were green. ClawSweeper’s completed review pinse722df18cf1508ce7ec437b9ad9617f6a337973cand reports no findings, security concerns, or before-merge items. Verification completed at 13:19 UTC; @VACInc merged the PR at 13:58:50 UTC on October 1, 2026.4d199b32c789175c20d3123449dcae93c52f8e85: the required-result case failed because finalization completed while the process remained pending; the detached control passed. The repair moves enforcement earlier, to the pending execution owner.1000 → 900 → 800 mswith controlled execution costs), not fresh slices. Failure, cancellation, replacement, guest-timer exhaustion, explicit-yield refusal, and detached controls are covered.8f73cdee456b6c46b791780d40cadf9d556d22a4,core/src/session/turn.rs: in-flight tool futures drain before the next model continuation.git diff --checkpassed. No unrelated full-suite or deployment claim.Test cost and overlap scope
Focused Node tests used
--maxWorkers=1for measurement only; no worker pin or serial configuration was added.attempt-required-work.test.tsagents-wait-tool.required.test.tscode-mode.wait.test.tsrun-attempt.dynamic-tools.test.tsCold compilation accounts for 33.30 s of the first boundary run. The native file exercises the actual app-server/host-tool composition and existing runtime preparation; a helper-only test would not prove that boundary. New waits use controlled promises and fake clocks, not real polling sleeps. CI-reported test-case sums (not file wall time):
attempt-required-work.test.ts1.175 s across 4 cases;agents-wait-tool.required.test.ts0.056 s across 2 cases;code-mode.wait.test.ts2.345 s across 22 cases (six required-work cases: 0.556 s); nativerun-attempt.dynamic-tools.test.ts17.866 s across 6 cases (new required-command case: 14.623 s).Bounded upstream/local overlap audit found adjacent work, not this explicit required pending-call contract: #103586 (goal contracts/timer barriers/optional judge), #106110 (goal tests), #154954 (child yield claims excluding collectors), #112388 (deferred replies), #129388 (future-work/child-return subsystem, sampled statically), #159040 (plugin callbacks), and #160297 (plan self-check). Existing child cancellation/custody work remains with its owner and was not copied. This PR reuses the existing process, collector, and Code Mode owners; it does not restore Tasks/TaskFlow or supersede those PRs.
Requested by and co-authored with @VACInc.
Worked on by
Work sessions
View the OpenClaw team session