Repository navigation
fix(cron): surface skipped on-exit payloads when jobs are busy - #139987
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: needs maintainer review before merge. Reviewed September 6, 2026, 5:39 AM ET / 09:39 UTC. ClawSweeper reviewWhat this changesRecords a warning with bounded command-completion details when an on-exit automation cannot run, and adds regression coverage for busy and stopped jobs. Merge readiness✅ Ready for maintainer review The fix remains necessary: inspected current main still ignores refused on-exit admission. The patch addresses that gap narrowly, and the supplied process/logger proof supports the intended behavior. No blocking defect was found. Priority: P2 Review scores
Verification
How this fits togetherThe Gateway watches commands and forwards their completion payloads to the automation scheduler. When admission is refused, this change sends the outcome to the existing Gateway warning log while preserving one-shot retirement. flowchart TD
A[Watched command exits] --> B[Watcher retires one-shot]
B --> C[Scheduler receives completion payload]
C --> D{Run admitted?}
D -->|Yes| E[Normal execution and history]
D -->|No| F[Bounded warning with exit details]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +4, Tests +99. Total +103 across 2 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Preserve scheduler admission and one-shot semantics while recording refused completion handoffs through the existing bounded warning path. Do we have a high-confidence way to reproduce the issue? Yes, from source: hold a manual job invocation and let its watched command exit; admission returns already-running, which current main discards. The supplied proof exercises this sequence, but this review did not execute it. Is this the best way to solve the issue? Yes. Inspecting the existing admission result at the handoff boundary fixes the missing explanation without adding replay, a competing scheduler path, or persistent-state changes. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against f66dc27b5bf7. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
* origin/main: (47 commits) ci: record CPU time for Node test jobs (openclaw#140054) test(crabbox): consolidate wrapper boundary coverage (openclaw#140058) fix(test): keep native filesystem access checks portable (openclaw#140047) fix: preserve models when OAuth preparation fails (openclaw#139951) feat(update): recover failed updates with bounded repair (openclaw#139495) refactor(plugins): share managed npm package traversal (openclaw#140040) chore(ui): refresh control ui locales (openclaw#140059) refactor(auth): share profile failure state reset (openclaw#140049) fix(cron): surface skipped on-exit payloads when jobs are busy (openclaw#139987) fix(codex): preserve exec-server WebSocket backpressure under Bun (openclaw#140048) fix(agents): ground exec approvals in tool results (openclaw#140043) refactor(policy): reuse authored policy value helpers (openclaw#140019) docs: keep ClawSweeper status inspection read-only (openclaw#139958) fix: reduce task maintenance stalls with large histories (openclaw#140038) fix(code-mode): identify unawaited promise output (openclaw#140028) fix(test): release memory search fixtures after failed phases (openclaw#140013) test(gateway): isolate Serve hello lifecycle fixtures (openclaw#140044) fix(microsoft-foundry): bound Entra token retention across accounts (openclaw#127216) fix(process): preserve the cause of cleanup observation failures (openclaw#140015) fix: clear Side chat when its parent conversation is deleted (openclaw#139974) ...
Additional instructions
MUST: Keep Allow edits from maintainers enabled for this PR so maintainers
can help update the branch when needed.
What Problem This Solves
Fixes an issue where operators watching a command with an
on-exitautomation could lose the completion payload without a recorded explanation when another invocation of the same job was still running. A manual main-session run could subsequently finish successfully, leaving no indication that the watched command's completion payload was refused.Why This Change Was Made
The exit handoff discarded the cron service's non-run result and treated a fulfilled callback as an admitted run. It now consumes the typed disposition and passes refusals to the watcher's existing warning path, while preparing the payload and terminal summary in one place instead of using object identity to detect an override.
User Impact
Gateway logs identify the refused on-exit attempt with its admission reason, watched command exit code and termination reason, and a bounded command-output summary. The one-shot stays disabled, and refused work is not queued for replay. Successful firing, normal manual-run admission, existing cancellation and suspension behavior, and run-history semantics stay unchanged.
Evidence
b6a2e5b4eff71070a02e755d55aea0dd53904a20: start and hold a manual invocation, let the watched command finish, then release the manual invocation. The actual service returnedalready-running, the watcher retired, and the manual heartbeat completed successfully without a separate refusal record.already-running/stoppedcallback cases incorrectly fulfilled.OPENCLAW_VITEST_MAX_WORKERS=1 node scripts/run-vitest.mjs src/gateway/server-cron.test.ts src/gateway/cron-exit-watchers.test.tspassed all 145 tests on Node 24.19.0. The suite includes normal payload firing, refusal, drain fencing, explicit disable, handoff/replacement, cancellation, and one-shot restart coverage.watched-doneoutput produced the refusal below; it remained recorded after the manual heartbeat finished successfully. The owned child settled and all temporary state was removed. This was scheduler/process/logger boundary proof, not a live provider or full HTTP/WebSocket Gateway test.scoped-cleanthrough P2 with no findings. Formatting andgit diff --checkpassed. Exact-head CI attempt 2 completed successfully, including the retried test shard andopenclaw/ci-gate.Production changes are +18/-14 (net +4); tests are +103/-4. The four additional production lines provide the typed refusal check and bounded diagnostic evidence after removing the single-use payload helper and its identity sentinel. No queue, retry, configuration, schema, or persistent-state design is added.
The first CI attempt hit a 60-second child-process timeout in the unchanged managed-update handoff test. On the exact CI merge checkout, a private frozen install and the targeted test-runtime build supported the original isolated case: it passed in 2.27 seconds on macOS with the same timeout and journal/tree assertions. One authorized unchanged-head retry then passed in Linux CI. The initial timeout is retained as a historical failure; its Linux/load cause is not claimed fixed. No additional code change or timeout increase was made.