Skip to content

fix(scripts): treat whitespace-only force-kill delay as unset - #120284

Merged
steipete merged 2 commits into
openclaw:mainfrom
qingminglong:fix/scripts-force-kill-blank-env
Aug 8, 2026
Merged

steipete merged 2 commits into
openclaw:mainfrom
qingminglong:fix/scripts-force-kill-blank-env

Conversation

@qingminglong

@qingminglong qingminglong commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where users running commands through scripts/run-with-env.mjs would get an invalid configuration error before the child process started when OPENCLAW_RUN_WITH_ENV_FORCE_KILL_MS contained only whitespace.

Why This Change Was Made

The delay resolver now trims the optional environment value once and treats blank text as unset. Nonblank values still use the existing positive-integer validation and timer cap.

User Impact

Whitespace-only inherited values now use the existing 5000 ms force-kill grace period instead of preventing the wrapped command from starting.

Evidence

  • Current main (ab4761f3fc9a903646a6ac7346ae1091745de79a): running the real wrapper with a whitespace-only delay exited 2, printed OPENCLAW_RUN_WITH_ENV_FORCE_KILL_MS must be a positive integer, and did not print the child process's spawned marker.
  • Exact rewritten head (ced1a4a1662c646ee614199d600fb05cde7585bf): the same real-wrapper command exited 0 and printed spawned.
  • A bounded 20-run parser matrix passed for unset, empty, whitespace, 250, the timer cap, and rejection of 0, -1, 1e3, and 100ms.
  • Focused test: node scripts/run-vitest.mjs test/scripts/run-with-env.test.ts passed all 17 tests.
  • Blacksmith Testbox changed gate passed with exit 0: https://github.com/openclaw/openclaw/actions/runs/31203793610
  • Max-P1 autoreview reported no accepted/actionable findings with correctness confidence 0.99.
  • Local ClawSweeper found no functional or security findings and judged the trim-first resolver to be the best fix.

Production LOC: +2/-2 (net 0). Tests: +1/-0.

The local broad lint wrapper encountered an unrelated existing type error in packages/terminal-core/src/ansi.ts before target lint. The authoritative Testbox changed gate subsequently passed the exact script lint, test-root typecheck, formatting, declaration, dependency, and boundary lanes without modifying that unrelated surface.

Punchcard-Session: calm-harbor-willow-ty

@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: XS labels Aug 7, 2026
@qingminglong
qingminglong marked this pull request as ready for review August 7, 2026 15:59
@clawsweeper clawsweeper Bot added 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. P2 Normal backlog priority with limited blast radius. labels Aug 7, 2026
@clawsweeper

clawsweeper Bot commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 7, 2026, 2:56 PM ET / 18:56 UTC.

ClawSweeper review

What this changes

The PR normalizes the wrapper’s optional force-kill delay before checking for an unset value, so whitespace-only inherited values use the existing five-second default.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

No blocking findings. Current main still rejects whitespace-only delay values before spawning the child command; this exact-head repair restores the existing default behavior with direct terminal proof and should remain open for normal merge gating.

Priority: P2
Reviewed head: ced1a4a1662c646ee614199d600fb05cde7585bf

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A clean, net-neutral parser repair with focused coverage and direct terminal proof; ordinary exact-head merge gating remains.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The PR body provides an exact before/after terminal run through the real wrapper, showing the child is blocked on current main and starts successfully at the proposed head.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR body provides an exact before/after terminal run through the real wrapper, showing the child is blocked on current main and starts successfully at the proposed head.
Evidence reviewed 7 items Current-main failure path: Current main defaults only undefined or exactly empty input; whitespace is trimmed after that check and fails validation before the child is spawned.
Exact-head repair: The proposed change trims once before the unset check, while retaining the positive-integer, safe-integer, and cap validation for nonblank values.
Focused regression coverage: The existing resolver test already covers defaults, valid values, caps, malformed values, and pre-spawn rejection; the branch adds the whitespace-only default case in that same test.
Findings None None.
Security None None.

How this fits together

The environment wrapper validates inherited shutdown timing before it launches a child command. The parsed delay controls cleanup timing for package scripts, gateway development, builds, and test commands.

flowchart LR
  A[Inherited environment] --> B[Environment wrapper]
  B --> C[Delay parser]
  C --> D{Blank or numeric?}
  D -->|Blank| E[Five-second default]
  D -->|Numeric| F[Validated capped delay]
  E --> G[Child command lifecycle]
  F --> G
Loading

Before merge

  • Complete next step (P2) - No repair job is warranted because the exact head has no actionable finding; it only needs normal maintainer merge processing.
Agent review details

Security

None.

PR surface

Tests +1, Other 0. Total +1 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 1 0 +1
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 2 0
Total 2 3 2 +1

Review metrics

Metric Value Why it matters
Production versus test LOC production +2/-2 (net 0); tests +1/-0 The repair changes no net production size and extends the existing focused regression case.

Technical review

Best possible solution:

Merge this narrow parser repair through GitHub’s normal exact-head required-check and clean-merge gate, preserving the five-second default for blank values and strict validation for nonblank values.

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

Yes. Current source shows that whitespace reaches the validation error before spawn, and the PR body records the matching before/after real-wrapper result on current main and the exact head.

Is this the best way to solve the issue?

Yes. Trimming at the parser boundary before applying the existing unset default fixes the defect without accepting malformed nonblank values or adding a parallel path.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against d448a25a8a87.

Labels

Label justifications:

  • P2: A whitespace-only inherited value currently blocks a real script-wrapper command before its child process starts, but the impact is limited to this optional environment condition.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body provides an exact before/after terminal run through the real wrapper, showing the child is blocked on current main and starts successfully at the proposed head.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides an exact before/after terminal run through the real wrapper, showing the child is blocked on current main and starts successfully at the proposed head.

Evidence

What I checked:

  • Current-main failure path: Current main defaults only undefined or exactly empty input; whitespace is trimmed after that check and fails validation before the child is spawned. (scripts/run-with-env.mjs:79, d448a25a8a87)
  • Exact-head repair: The proposed change trims once before the unset check, while retaining the positive-integer, safe-integer, and cap validation for nonblank values. (scripts/run-with-env.mjs:80, ced1a4a1662c)
  • Focused regression coverage: The existing resolver test already covers defaults, valid values, caps, malformed values, and pre-spawn rejection; the branch adds the whitespace-only default case in that same test. (test/scripts/run-with-env.test.ts:178, ced1a4a1662c)
  • Sibling parser convention: Other script-owned optional numeric settings trim before deciding that blank input is absent, matching the proposed normalization order. (scripts/check-memory-fd-repro.mjs:128, d448a25a8a87)
  • Feature provenance: Blame attributes the current resolver to the initial wrapper commit, tying Vincent Koc’s script-owner history to the code under review. (scripts/run-with-env.mjs:79, a90c8d81df55)
  • Observed behavior proof: The PR body records a real current-main wrapper invocation exiting 2 without the child marker, followed by the same invocation at the exact head exiting 0 and printing the marker; focused tests and the Testbox changed gate are supplementary evidence. (scripts/run-with-env.mjs:151, ced1a4a1662c)

Likely related people:

  • vincentkoc: Introduced the current wrapper resolver and its tests, and has the adjacent validation and timer-cap history. (role: recent feature owner; confidence: high; commits: a90c8d81df55, 8516f375638b, 095a44c8de4d; files: scripts/run-with-env.mjs, test/scripts/run-with-env.test.ts)
  • steipete: Contributed later wrapper-readiness test maintenance adjacent to this focused script test surface. (role: recent adjacent test contributor; confidence: medium; commits: b8a634161784; files: test/scripts/run-with-env.test.ts)

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.

History

Review history (2 earlier review cycles)
  • reviewed 2026-08-07T17:39:28.597Z sha 07d2957e6e8d4e694663ba83721f4705bc99788d :: needs maintainer review before merge. :: none
  • reviewed 2026-08-07T18:35:08.542Z sha ced1a4a :: needs maintainer review before merge. :: none

@vincentkoc vincentkoc self-assigned this Aug 7, 2026
@vincentkoc
vincentkoc force-pushed the fix/scripts-force-kill-blank-env branch from 07d2957 to ced1a4a Compare August 7, 2026 18:07
@vincentkoc

Copy link
Copy Markdown
Member

@clawsweeper re-review

Maintainer rewrite pushed at exact head ced1a4a1662c646ee614199d600fb05cde7585bf. The PR body now contains the current-main failure, exact-head real-wrapper success, focused test, 20-run parser matrix, Testbox changed-gate result, and local review evidence.

@clawsweeper

clawsweeper Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Command router queued. I will update this comment with the next step.

@vincentkoc

Copy link
Copy Markdown
Member

@clawsweeper re-review

One exact-head retry after the prior queued review failed to publish. Review PR head ced1a4a1662c646ee614199d600fb05cde7585bf; the PR body contains the focused runtime, parser-matrix, Testbox, autoreview, and local ClawSweeper proof.

@clawsweeper

clawsweeper Bot commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@steipete

steipete commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

@clawsweeper re-review

@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Aug 8, 2026
@steipete
steipete merged commit 019dd0e into openclaw:main Aug 8, 2026
100 checks passed
@steipete

steipete commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 9, 2026
…aw#120284)

Punchcard-Session: calm-harbor-willow-ty

Co-authored-by: Peter Steinberger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. scripts Repository scripts size: XS 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.

3 participants