fix(cron): preserve action-required command output#96393
Conversation
|
Codex review: needs maintainer review before merge. Reviewed June 25, 2026, 9:51 PM ET / 01:51 UTC. Summary PR surface: Source +300, Tests +435. Total +735 across 10 files. Reproducibility: yes. source inspection gives a high-confidence current-main reproduction path: command output is tail-truncated in runCommandWithTimeout and runCronCommandJob summarizes only that tail. I did not run a failing current-main cron job in this read-only review, but the linked issue and exact-head proof cover the same synthetic device-code flow. Review metrics: 2 noteworthy metrics.
Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land this branch only after a maintainer accepts it as the canonical fix and explicitly owns the operator-visible raw diagnostics versus redacted external delivery boundary. Do we have a high-confidence way to reproduce the issue? Yes, source inspection gives a high-confidence current-main reproduction path: command output is tail-truncated in runCommandWithTimeout and runCronCommandJob summarizes only that tail. I did not run a failing current-main cron job in this read-only review, but the linked issue and exact-head proof cover the same synthetic device-code flow. Is this the best way to solve the issue? Yes, this looks like the best current fix shape: the preservation hook is bounded and opt-in, cron command summaries own the preserved block, and external redaction is applied at the delivery boundaries. A global exec-output behavior change or a redaction-only branch would be either too broad or incomplete. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 6830aa39eaa1. Label changesLabel justifications:
Evidence reviewedPR surface: Source +300, Tests +435. Total +735 across 10 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
31332d0 to
32660cd
Compare
32660cd to
533af0b
Compare
533af0b to
7b3338f
Compare
7b3338f to
d2bee62
Compare
|
Updated the branch for the two remaining review blockers and refreshed exact-head proof. Changes since the previous review:
Latest head: Proof run: https://github.com/snowzlmbot/openclaw/actions/runs/28098700552 The proof records the exact head, preserves the early
The PR body has been updated with the latest head/proof details. @clawsweeper review-pr |
|
🦞🧹 I asked ClawSweeper to review this item again. |
d2bee62 to
3ae423e
Compare
|
Updated the PR body to make the remaining maintainer decision boundary explicit. Added a focused Maintainer Decision Boundary section covering:
No production code changes in this update; this addresses the latest review's remaining compatibility/security-boundary and canonical-branch-selection decision points in the PR body. @clawsweeper review-pr |
f53f72f to
4b142a7
Compare
|
Updated the branch for the latest review blocker and refreshed the PR body for the rebased head. Changes in head
Validation:
@clawsweeper review-pr |
|
🦞👀 Command router queued. I will update this comment with the next step. |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Fixed the remaining blocker: successful command completion webhooks now strip nested Validation:
@clawsweeper review-pr |
|
Updated the branch for the remaining ClawSweeper P1 security blocker and refreshed the PR body for the new head. Changes in head
Validation:
@clawsweeper review-pr |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Updated the PR body with the current exact-head cron behavior proof requested in the latest review. Added evidence for head
No code changes in this update; this is the requested proof/body refresh for the current head. @clawsweeper review-pr |
|
Landed via rebase onto main.
Thanks @snowzlmbot! |
What Problem This Solves
Fixes #96346.
Cron command jobs currently keep only the tail of captured stdout/stderr when
outputMaxBytesis exceeded. That is usually fine for failures, but it breaks command flows where the actionable line appears near the start and the command later emits noisy output. Device-login and setup commands commonly print a URL/code first, then verbose logs; the cron run summary, run log, announce delivery, and completion webhook can then lose the only line the operator needs.Summary
runCommandWithTimeout()without changing default exec capture behavior.action-required output preserved:block before the bounded stdout/stderr tail.cron_changedhook delivery.summary,diagnostics,job.state.lastDiagnosticSummary, andjob.state.lastDiagnostics.Maintainer Decision Boundary
This branch is proposed as the canonical fix for #96346.
cron_changedhook summaries.Async/cron command results can drop action-critical auth/setup prompt lines during output truncation#96346 can be closed or superseded in favor of this canonical branch.Security / Delivery Boundary
The preserved action lines are intended for operator-facing cron history and diagnostics. They may include setup URLs or auth/device codes, so this PR does not blindly broadcast the unredacted text through cron delivery:
summaryanddiagnostics, and also omit persisted diagnostic state from embedded job snapshotscron_changedhook events use a redacted command summary for command jobsEvidence
Current head:
024cb8d120c197ffee5a663a552abbd9ca0b44c8Latest focused validation:
node scripts/run-vitest.mjs src/gateway/server-cron-notifications.test.ts— passedgit diff --check— passedcron-action-critical-summary-proof-024cb8d120c197ffee5a663a552abbd9ca0b44c8024cb8d120c197ffee5a663a552abbd9ca0b44c8Earlier focused validation after rebasing on
upstream/mainat head4b142a7f262ad5eef78714e8a2c96f1afaadd4c6:pnpm docs:list— passedgit diff --check— passednode scripts/run-vitest.mjs src/gateway/server-cron-notifications.test.ts src/cron/command-output-summary.test.ts— passedsrc/gateway/server-cron-notifications.test.ts: 8 tests passed across gateway shardssrc/cron/command-output-summary.test.ts: 4 tests passedRegression coverage added or retained:
src/process/exec.test.tsverifies preserved lines survive tail truncation and long no-newline output remains bounded.src/cron/command-runner.test.tsverifies an earlyVisit ... enter code ...line appears in cron command summary even whenoutputMaxByteskeeps only the final tail.src/cron/command-output-summary.test.tsverifies summary prepending plus external redaction for URLs, separated codes, numeric codes, unseparated codes, and token/password/secret assignments, including webhook diagnostics entries.src/gateway/server-cron-notifications.test.tsverifies successful command completion webhooks redact URL/code/token material fromsummary,diagnostics.summary, anddiagnostics.entries[].message.src/gateway/server-cron-notifications.test.tsverifies successful command completion webhooks strip embeddedjob.state.lastDiagnosticsandjob.state.lastDiagnosticSummarybefore external delivery.src/gateway/server-cron-notifications.test.tsverifies failed command completion webhooks omit preserved action lines, diagnostics entries, raw codes, token assignments, and persisted job diagnostic state.src/gateway/server-cron.test.tsverifiescron_changedplugin hook events receive a delivery-safe redacted command summary for command jobs and keep non-command summaries unchanged.Real Behavior Proof
Current exact-head cron behavior proof: https://github.com/snowzlmbot/openclaw/actions/runs/28211403445
Head:
024cb8d120c197ffee5a663a552abbd9ca0b44c8Artifact:
cron-action-critical-summary-proof-024cb8d120c197ffee5a663a552abbd9ca0b44c8This proof checks out the exact PR head, runs an actual cron command job with an early device-login style line, numeric verification code, and token assignment plus noisy tail output, then verifies both operator summary preservation and external-delivery redaction for the preserved URL/code/token material. It also runs the focused gateway/cron/process regression set on the exact head.
Proof summary:
Focused regression proof log:
The repository PR proof gate also passed for the same head: https://github.com/openclaw/openclaw/actions/runs/28191420047
Risk
Low-to-moderate. The exec API grows an optional preservation hook, but default behavior is unchanged. The behavior change is scoped to cron command jobs, and both captured output plus preserved partial-line scanning remain bounded. External-delivery redaction is command-job gated and covers URL, separated-code, numeric-code, unseparated-code, and token/password/secret assignment shapes, so non-command cron summaries remain unchanged. Failed completion webhook payloads keep the stricter current-main omission behavior for summaries and diagnostics.