Skip to content

fix(cron): preserve literal script file paths - #145673

Merged
steipete merged 1 commit into
mainfrom
codex/qa-cron-files-20260912
Sep 12, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/qa-cron-files-20260912

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where cron add and cron edit silently read a different script when a quoted filename contains leading or trailing whitespace. For example, passing "payload.js " selected payload.js if that neighboring file existed, then reported success.

Why This Change Was Made

All four payload/trigger file-argument producers now use the existing nonblank string reader, which preserves the original filename. The shared stream reader continues to own the exact - stdin sentinel, byte limits, content trimming and read errors.

The add path reads the script in its original payload branch, removing its intermediate script-path representation and second conversion step. Formatted production is 13 lines added / 17 removed, net −4. Tests are +53/−38 and docs +2/−2. No parser, option, compatibility path or execution policy is added.

User Impact

The CLI sends the contents of the named local file. Payload budgets, trigger once, edit revision handling, ordinary filenames, blank-input validation and existing output/exit behavior remain intact. The docs clarify literal file-path handling.

Evidence

  • Tests-first baseline: 4 intended failures and 120 passing controls across the trigger, edit and scratch suites. Each failing row used two real files with distinct contents; all four trailing-space arguments selected the decoy file. The repaired suites pass all 124 tests.
  • Paired ordinary built-CLI proof: eight cases per phase, crossing ordinary/trailing filenames with add/edit and payload/trigger. An input-only loopback recorder captured 18 RPCs per phase. Baseline sent the decoy contents for all four trailing-space cases; the candidate sent the named files’ contents. Four ordinary controls, payload budgets, trigger metadata, revisions and CLI JSON/wire agreement remain correct.
  • Both phases completed naturally: all ten processes per phase exited 0, streams drained, owned groups disappeared, the recorder listener closed, and all sixteen source-file identities/bytes per phase stayed unchanged. The four erroneous baseline invocations were silent successes rather than parse failures.
  • All changed-file checks passed. A fresh pnpm build ciArtifacts passed in 109.8 seconds; the compiled registrar and all four repaired producer sites were inspected. Fresh managed P0–P2 review found no actionable defects.

The CLI proof uses Node 24.20.0 with the existing launcher-equivalent experimental-warning flag and disabled compile cache. It exercises the normal final runtime on macOS. Generated outputs and named source/ws/Commander files are sealed with qualified frozen-install evidence; this is not a fully hermetic external/native dependency claim. The receiver only records input and returns an acknowledgment: Gateway persistence, scheduler/script execution and channel delivery are outside these observations.

Independent source, current-main compatibility and raw/compiled before/after audits found no blocking discrepancy. This is one shared cron argument-producer defect across four call sites. Current reviewed head: a7df240e7871b0894018c8f73182e1b374ca9892; its full-index patch is byte-identical to the tested/reviewed precommit source. Hosted CI remains required before native landing.

@steipete steipete self-assigned this Sep 12, 2026
@clawsweeper

clawsweeper Bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation cli CLI command changes size: S maintainer Maintainer-authored PR labels Sep 12, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 12, 2026
@clawsweeper

clawsweeper Bot commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 12, 2026, 2:05 AM ET / 06:05 UTC.

ClawSweeper review

What this changes

Preserves literal script filenames when adding or editing automations, with regression coverage and documentation for paths containing surrounding spaces.

Merge readiness

✅ Ready for maintainer review

This remains a useful, focused fix: current main still trims script filenames, and the reviewed patch has no actionable correctness findings. Maintainer authorship and the protected label also preclude cleanup closure.

Priority: P2
Reviewed head: a7df240e7871b0894018c8f73182e1b374ca9892

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with meaningful boundary regressions and relevant reported before/after CLI observations.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The supplied body reports paired built-CLI macOS observations through the actual file readers and RPC client: all four repaired paths send the named file's contents while ordinary controls remain correct. The recorder covers the changed CLI boundary; scheduler execution is outside this proof.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The supplied body reports paired built-CLI macOS observations through the actual file readers and RPC client: all four repaired paths send the named file's contents while ordinary controls remain correct. The recorder covers the changed CLI boundary; scheduler execution is outside this proof.
Evidence reviewed 8 items Verified patch boundary: Host introduction evidence identifies the complete seven-file delta from 31848a1 to the reviewed head. The verified test merge contains the same affected paths; unrelated endpoint drift is excluded.
Existing whitespace-preserving primitive: readNonBlankString rejects nonstrings and whitespace-only input while returning the original nonblank string. All four payload/trigger argument producers now use it.
Shared file-reading boundary remains intact: The shared reader selects stdin only for the exact '-' string and otherwise passes the filename to createReadStream. Existing byte limits, content trimming, and error handling remain unchanged. This CLI file-loading behavior does not depend on the Codex runtime or protocol.
Findings None None.
Security None None.

How this fits together

The automation CLI reads local payload and condition scripts before sending their contents to the Gateway. Filename handling determines which script becomes part of the automation.

flowchart LR
  A[Quoted CLI argument] --> B[Validate nonblank filename]
  B --> C{Exact stdin sentinel?}
  C -->|Yes| D[Read stdin]
  C -->|No| E[Read named file]
  D --> F[Validate script content and size]
  E --> F
  F --> G[Send automation create or update]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -4, Tests +15, Docs 0. Total +11 across 7 files.

View PR surface stats
Area Files Added Removed Net
Source 3 13 17 -4
Tests 2 53 38 +15
Docs 2 2 2 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 68 57 +11

Review metrics

None.

Technical review

Best possible solution:

Keep filename validation at the CLI producers while the shared reader continues to own exact file access, stdin selection, and script validation.

Do we have a high-confidence way to reproduce the issue?

Yes. Current main trims a quoted trailing-space filename before opening it, so two neighboring files with distinct contents establish a deterministic wrong-file path; this review did not execute it.

Is this the best way to solve the issue?

Yes. Reusing the existing nonblank reader repairs all four argument producers without adding another parser, changing stored data, or duplicating script-loading policy.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 5de618a09b7b.

Labels

Label changes:

  • add P2: Repairs silent selection of the wrong local script for an uncommon but valid filename, with a bounded CLI impact.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The supplied body reports paired built-CLI macOS observations through the actual file readers and RPC client: all four repaired paths send the named file's contents while ordinary controls remain correct. The recorder covers the changed CLI boundary; scheduler execution is outside this proof.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The supplied body reports paired built-CLI macOS observations through the actual file readers and RPC client: all four repaired paths send the named file's contents while ordinary controls remain correct. The recorder covers the changed CLI boundary; scheduler execution is outside this proof.

Label justifications:

  • P2: Repairs silent selection of the wrong local script for an uncommon but valid filename, with a bounded CLI impact.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The supplied body reports paired built-CLI macOS observations through the actual file readers and RPC client: all four repaired paths send the named file's contents while ordinary controls remain correct. The recorder covers the changed CLI boundary; scheduler execution is outside this proof.
  • proof: sufficient: Contributor real behavior proof is sufficient. The supplied body reports paired built-CLI macOS observations through the actual file readers and RPC client: all four repaired paths send the named file's contents while ordinary controls remain correct. The recorder covers the changed CLI boundary; scheduler execution is outside this proof.

Evidence

What I checked:

  • Verified patch boundary: Host introduction evidence identifies the complete seven-file delta from 31848a1 to the reviewed head. The verified test merge contains the same affected paths; unrelated endpoint drift is excluded. (a7df240e7871)
  • Existing whitespace-preserving primitive: readNonBlankString rejects nonstrings and whitespace-only input while returning the original nonblank string. All four payload/trigger argument producers now use it. (packages/normalization-core/src/string-coerce.ts:33, a7df240e7871)
  • Shared file-reading boundary remains intact: The shared reader selects stdin only for the exact '-' string and otherwise passes the filename to createReadStream. Existing byte limits, content trimming, and error handling remain unchanged. This CLI file-loading behavior does not depend on the Codex runtime or protocol. (src/cli/cron-cli/trigger-options.ts:18, a7df240e7871)
  • Current main still contains the defect: Current-main add code normalizes both script paths with normalizeOptionalString; separate inspection confirmed the same trimming in both edit producers. (src/cli/cron-cli/register.cron-add.ts:145, 5de618a09b7b)
  • Latest supplied release retains trimming: The supplied v2026.9.4 release commit also normalizes payload and trigger filenames before reading them; this is not an already-shipped fix. (src/cli/cron-cli/register.cron-add.ts:145, 3a9d69db306c)
  • Meaningful regression coverage: The expanded existing tests create ordinary and trailing-space filenames with distinct contents, exercise registered add/edit commands, and inspect outgoing script contents. Trigger edits also retain once and the expected configuration revision. Tests were inspected, not executed in this read-only review. (src/cli/cron-cli/register.cron-edit.test.ts:139, a7df240e7871)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Peik S.: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete merged commit 86c1a44 into main Sep 12, 2026
156 checks passed
@steipete
steipete deleted the codex/qa-cron-files-20260912 branch September 12, 2026 06:33
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes docs Improvements or additions to documentation maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant