Repository navigation
fix(process): prevent one-shot agents exiting while polling - #144268
Conversation
Keep an actively awaited process poll timer referenced so child completion cannot strand the one-shot caller before it receives the terminal result. Preserve bounded waits and abort cleanup. Add a real standalone runtime regression that fails with exit 13 before the fix and exits 0 afterward. Closes #144248 Co-authored-by: steipete <[email protected]> Co-authored-by: Kimiyu-186 <[email protected]>
OpenClaw-Publication: 68ef9a40-23c3-493d-8ca5-0ff28e2f59fa
|
🦞👀 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 September 10, 2026, 2:30 PM ET / 18:30 UTC. ClawSweeper reviewWhat this changesKeeps an active process poll alive until its next state check and adds a standalone regression verifying successful background completion and returned JSON. Merge readiness✅ Ready for maintainer review The fix remains necessary: current main and v2026.9.3 retain the premature-exit mechanism. The focused patch addresses it without changing polling limits or cancellation behavior, and no blocking defect was found. Priority: P1 Review scores
Verification
How this fits togetherOpenClaw's exec runtime registers background commands, and the process tool reads their output and completion state. A waiting poll must keep a one-shot agent alive long enough to receive that result. flowchart TD
A[Agent starts command] --> B[Exec runtime and supervisor]
B --> C[Process registry]
D[Agent requests waiting poll] --> E[Referenced poll timer]
E --> C
C --> F{Command finished?}
F -->|No and time remains| E
F -->|Yes or wait expires| G[Return process result]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource 0, Tests +83. Total +83 across 2 files. View PR surface stats
Review metricsNone. Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Keep liveness ownership in the active poll, preserving bounded cancellation and independently expiring background-result retention. Do we have a high-confidence way to reproduce the issue? Yes: the reported background-exec-then-poll sequence and current-main unreferenced timer establish a concrete reproduction path; this read-only review did not execute it. Is this the best way to solve the issue? Yes: retaining the existing awaited timer repairs the owning lifecycle directly, without a CLI-wide keepalive or a competing polling mechanism. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 4742db869720. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
* commit '4aff70f27016f9acf62d0acc19c8bd3592993e4c': (1537 commits) test: align plugin fixtures with current runtime contracts (#147000) refactor(browser): separate session tab tracking from cleanup (#146973) fix(tests): make systemd clock fixtures private (#146990) fix(linux): retire sleep guards when logind disconnects (#146046) refactor(matrix): share draft fallback delivery (#144840) fix(sessions): preserve cross-agent replies after reload (#146799) test(models): cover quota recovery during catalog discovery (#146708) fix(macos): recover browser sign-in when no browser opens (#146787) fix(process): prevent one-shot agents exiting while polling (#144268) fix(status): label the session inventory as stored (#146979) fix: avoid repeated background reads while loading chat (#146953) refactor(ui): narrow Skill Workshop proposal context (#146977) perf(sessions): keep cleanup responsive and reuse workers (#140897) fix(sessions): prevent stranded writers after abort and restart (#146792) refactor: reuse deferred owners in Gateway and infra fixtures (#146809) fix: prevent queued conversation replies from switching storage (#146984) test(ui): preserve nested failure summaries in CI logs (#146864) fix(test): respect process memory limits in local scheduling (#146298) fix: validate large media data URLs without regexp stack exhaustion (#146972) fix(ui): label model usage contributions as messages (#146735) ...
* temp/pr-145950: (101 commits) refactor(memory-wiki): share freshness result construction (#146935) improve(gateway): use metadata projection for presence (#146817) test(agents): reuse complete Responses model fixtures (#147015) fix(sessions): align the reclamation-memory test with the archive session owner (#147028) refactor(terminal): simplify copy-sensitive token checks (#146934) refactor(media): remove duplicate spaced path fallback (#146933) refactor(cli): reuse command-group names (#146893) improve(plugins): reduce JavaScript generation capture work (#146993) test: align plugin fixtures with current runtime contracts (#147000) refactor(browser): separate session tab tracking from cleanup (#146973) fix(tests): make systemd clock fixtures private (#146990) fix(linux): retire sleep guards when logind disconnects (#146046) refactor(matrix): share draft fallback delivery (#144840) fix(sessions): preserve cross-agent replies after reload (#146799) test(models): cover quota recovery during catalog discovery (#146708) fix(macos): recover browser sign-in when no browser opens (#146787) fix(process): prevent one-shot agents exiting while polling (#144268) fix(status): label the session inventory as stored (#146979) fix: avoid repeated background reads while loading chat (#146953) refactor(ui): narrow Skill Workshop proposal context (#146977) ...
* commit '060e856e5f9df245d63c98990fcb47e18108c6b9': (97 commits) refactor(memory-wiki): share freshness result construction (#146935) improve(gateway): use metadata projection for presence (#146817) test(agents): reuse complete Responses model fixtures (#147015) fix(sessions): align the reclamation-memory test with the archive session owner (#147028) refactor(terminal): simplify copy-sensitive token checks (#146934) refactor(media): remove duplicate spaced path fallback (#146933) refactor(cli): reuse command-group names (#146893) improve(plugins): reduce JavaScript generation capture work (#146993) test: align plugin fixtures with current runtime contracts (#147000) refactor(browser): separate session tab tracking from cleanup (#146973) fix(tests): make systemd clock fixtures private (#146990) fix(linux): retire sleep guards when logind disconnects (#146046) refactor(matrix): share draft fallback delivery (#144840) fix(sessions): preserve cross-agent replies after reload (#146799) test(models): cover quota recovery during catalog discovery (#146708) fix(macos): recover browser sign-in when no browser opens (#146787) fix(process): prevent one-shot agents exiting while polling (#144268) fix(status): label the session inventory as stored (#146979) fix: avoid repeated background reads while loading chat (#146953) refactor(ui): narrow Skill Workshop proposal context (#146977) ...
* commit '4aff70f27016f9acf62d0acc19c8bd3592993e4c': (30 commits) test: align plugin fixtures with current runtime contracts (#147000) refactor(browser): separate session tab tracking from cleanup (#146973) fix(tests): make systemd clock fixtures private (#146990) fix(linux): retire sleep guards when logind disconnects (#146046) refactor(matrix): share draft fallback delivery (#144840) fix(sessions): preserve cross-agent replies after reload (#146799) test(models): cover quota recovery during catalog discovery (#146708) fix(macos): recover browser sign-in when no browser opens (#146787) fix(process): prevent one-shot agents exiting while polling (#144268) fix(status): label the session inventory as stored (#146979) fix: avoid repeated background reads while loading chat (#146953) refactor(ui): narrow Skill Workshop proposal context (#146977) perf(sessions): keep cleanup responsive and reuse workers (#140897) fix(sessions): prevent stranded writers after abort and restart (#146792) refactor: reuse deferred owners in Gateway and infra fixtures (#146809) fix: prevent queued conversation replies from switching storage (#146984) test(ui): preserve nested failure summaries in CI logs (#146864) fix(test): respect process memory limits in local scheduling (#146298) fix: validate large media data URLs without regexp stack exhaustion (#146972) fix(ui): label model usage contributions as messages (#146735) ...
Closes #144248
What Problem This Solves
Fixes an issue where users running one-shot agents would lose the final result and exit with code 13 when a background command completed during a waiting
process poll. The command could finish successfully while the agent returned no JSON envelope.Why This Change Was Made
Keep the timer referenced only while an active poll is awaiting its next state check. This preserves abort handling, timer/listener cleanup, the 30-second wait cap, and terminal process-registry readback without adding a CLI-wide keepalive or changing background retention timers.
User Impact
One-shot callers can receive the completed background process result instead of exiting with an unsettled top-level await. Gateway callers retain the same bounded, interruptible polling behavior.
Evidence
93f424ebe327af1ff9f19c380c6a7577fea2e4f9: the command wrotebackground-completeto its output artifact, but the one-shot process exited with code 13 at the awaited process-tool call.status: completedandexitCode: 0, and retains the command artifact.This is real process-tool/runtime boundary proof, not a full scripted-provider CLI replay. The issue’s benchmark results are reporter observations; no paid benchmark campaign was rerun.
Thanks to @osolmaz for the detailed reproduction and diagnosis.
View the OpenClaw team session