Skip to content

fix(scripts): reject unsafe web-fetch benchmark counts - #119533

Merged
vincentkoc merged 2 commits into
openclaw:mainfrom
qingminglong:fix/bench-web-fetch-strict-runs
Aug 5, 2026
Merged

vincentkoc merged 2 commits into
openclaw:mainfrom
qingminglong:fix/bench-web-fetch-strict-runs

Conversation

@qingminglong

@qingminglong qingminglong commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

Related: #98559

What Problem This Solves

Fixes an issue where operators running the web-fetch benchmark could pass scientific notation or decimal counts outside JavaScript's safe-integer range. Numeric coercion could otherwise expand or round the requested workload instead of rejecting invalid CLI input.

Why This Change Was Made

The benchmark now accepts only decimal digit text whose numeric value is a safe integer. Validation stays at the existing --runs and --warmup parser boundary, preserving positive-run and non-negative-warmup semantics plus the existing stack-free CliArgumentError exit-code-2 behavior.

User Impact

Invalid benchmark counts such as 1e3 and 9007199254740993 now fail immediately with the existing flag-specific error. Valid decimal counts continue to behave unchanged.

Evidence

Provenance

The benchmark parser was introduced by PR #98559, squash commit 2f6459093ad3abe4369f686b517b5d78568af35a, merged on July 4, 2026. The affected implementation shipped in v2026.7.1-2 and v2026.7.2-beta.7.

Punchcard-Session: clear-orchard-lantern-bc

@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: XS labels Aug 5, 2026
@qingminglong
qingminglong marked this pull request as ready for review August 5, 2026 07:18
@openclaw-barnacle openclaw-barnacle Bot added the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Aug 5, 2026
@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. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Aug 5, 2026
@clawsweeper

clawsweeper Bot commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 5, 2026, 5:30 AM ET / 09:30 UTC.

ClawSweeper review

What this changes

The PR makes the web-fetch benchmark reject non-decimal and non-safe --runs or --warmup counts, with CLI process regression coverage.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep open: current main still converts unsafe benchmark counts before validating them, and this focused parser-boundary fix addresses that behavior without a concrete patch defect.

Priority: P3
Reviewed head: 2b21f0e3049f76b39fbdd542d83564f31fe45eef

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A narrow, source-supported repair with focused process proof and no actionable correctness finding.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The PR reports an after-fix Testbox process run covering the real benchmark CLI argument path for both flags.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR reports an after-fix Testbox process run covering the real benchmark CLI argument path for both flags.
Evidence reviewed 6 items Current-main defect: Current main converts both count strings with Number() and accepts any Number.isInteger result, so scientific notation and rounded unsafe integers can reach the benchmark.
Owning execution path: The parsed --runs and --warmup values feed the benchmark options and loop bounds, making this parser the correct repair boundary.
Patch and regression coverage: The proposed head adds decimal-text and safe-integer checks for both flags, and process tests assert exit code 2, no stdout, and no stack for scientific and rounded-unsafe values.
Findings None None.
Security None None.

How this fits together

The web-fetch benchmark accepts operator CLI flags and turns its run and warm-up counts into benchmark loop bounds. Invalid values should fail at argument parsing before the benchmark creates tools or starts work.

flowchart LR
  A[Operator CLI flags] --> B[Benchmark argument validation]
  B --> C[Count parser]
  C --> D{Decimal safe integer?}
  D -->|yes| E[Benchmark loops]
  D -->|no| F[Flag-specific CLI error]
Loading

Before merge

  • Resolve merge risk (P1) - GitHub reports the branch behind current main; let current-head checks finish and review the current merge result before landing.
  • Complete next step (P2) - No repair lane is needed because the current patch has no concrete actionable defect; normal exact-head validation is the remaining step.
Agent review details

Security

None.

PR surface

Tests +14, Other +6. Total +20 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 14 0 +14
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 8 2 +6
Total 2 22 2 +20

Review metrics

Metric Value Why it matters
Production versus test delta production +8/-2 (net +6); tests +14/-0 The small production increase is justified by validating the benchmark’s loop-boundary contract, with focused process coverage for both flags.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep the validation local to this CLI parser so its existing flag-specific CliArgumentError and exit-code contract remain intact.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep the validation local to this CLI parser so its existing flag-specific CliArgumentError and exit-code contract remain intact.

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

Yes: current main routes --runs 1e3 or 9007199254740993 through Number() and only checks integer-ness before those values drive benchmark loops; the PR’s process-test path directly exercises it.

Is this the best way to solve the issue?

Yes: the parser owns the conversion and error contract, while the shared strict helper would alter blank-value and error behavior.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P3: This is a focused hardening of an optional local benchmark CLI with limited operator blast radius.
  • 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 (terminal): The PR reports an after-fix Testbox process run covering the real benchmark CLI argument path for both flags.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR reports an after-fix Testbox process run covering the real benchmark CLI argument path for both flags.

Evidence

What I checked:

  • Current-main defect: Current main converts both count strings with Number() and accepts any Number.isInteger result, so scientific notation and rounded unsafe integers can reach the benchmark. (scripts/bench-web-fetch.ts:159, b5237ac86a0e)
  • Owning execution path: The parsed --runs and --warmup values feed the benchmark options and loop bounds, making this parser the correct repair boundary. (scripts/bench-web-fetch.ts:213, b5237ac86a0e)
  • Patch and regression coverage: The proposed head adds decimal-text and safe-integer checks for both flags, and process tests assert exit code 2, no stdout, and no stack for scientific and rounded-unsafe values. (test/scripts/bench-web-fetch.test.ts:54, 2b21f0e3049f)
  • Sibling contract: The existing strict script parser uses the same decimal-digit and Number.isSafeInteger contract; its helper is not a drop-in because it trims/defaults values and throws a different error type. (scripts/lib/strict-integer-option.ts:8, c02e39345bf6)
  • Feature provenance: The merged benchmark feature commit added this script and identifies Vincent Koc as its author; current shallow-boundary blame alone is not treated as an introduction claim. (scripts/bench-web-fetch.ts:153, 2f6459093ad3)
  • After-fix behavior proof: The PR body reports a Testbox run of all six process tests, including both flags with scientific notation and an unsafe rounded decimal. (2b21f0e3049f)

Likely related people:

  • vincentkoc: Authored the merged benchmark introduction and the latest follow-up commit on this PR. (role: feature author and recent area contributor; confidence: high; commits: 2f6459093ad3, 2b21f0e3049f; files: scripts/bench-web-fetch.ts)
  • Peter Steinberger: Current parser and test lines blame to this shallow-history boundary, which indicates recent path ownership but not a reliable introduction attribution. (role: current-main line provenance; confidence: low; commits: b5237ac86a0e; files: scripts/bench-web-fetch.ts, test/scripts/bench-web-fetch.test.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Let the current-head checks finish and refresh review of the current merge result before landing.

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 (1 earlier review cycle)
  • reviewed 2026-08-05T07:24:02.061Z sha 4f41cc3 :: needs maintainer review before merge. :: none

Punchcard-Session: clear-orchard-lantern-bc
@vincentkoc vincentkoc changed the title fix(scripts): reject non-decimal benchmark counts fix(scripts): reject unsafe web-fetch benchmark counts Aug 5, 2026
@vincentkoc vincentkoc self-assigned this Aug 5, 2026
@vincentkoc vincentkoc removed the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Aug 5, 2026
@vincentkoc

Copy link
Copy Markdown
Member

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 5, 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:

@vincentkoc

Copy link
Copy Markdown
Member

ClawSweeper rank-up move disposition:

  • Exact-head checks finished successfully at 2b21f0e3049f76b39fbdd542d83564f31fe45eef.
  • GitHub reports the reviewed head mergeable but behind current main. The native scripts/pr flow verified the unchanged head and will use pinned squash auto-merge, so the contributor head does not need a rewrite or another ClawSweeper cycle.

@vincentkoc
vincentkoc merged commit 637de7d into openclaw:main Aug 5, 2026
135 of 143 checks passed
@vincentkoc

Copy link
Copy Markdown
Member

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 6, 2026
* fix(scripts): reject non-decimal benchmark counts

* fix(scripts): reject unsafe benchmark counts

Punchcard-Session: clear-orchard-lantern-bc

---------

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

Labels

P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary 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.

2 participants