Skip to content

refactor(tooling): unify benchmark and process helpers - #125491

Merged
steipete merged 3 commits into
mainfrom
steipete/w4-bench-process-tree
Aug 18, 2026
Merged

steipete merged 3 commits into
mainfrom
steipete/w4-bench-process-tree

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Resolves repository-tooling duplication where two benchmarks independently maintained the same CLI/worker/report lifecycle and seven scripts independently reimplemented process-group plus Windows task-tree signaling.

Why This Change Was Made

One benchmark harness now owns bounded option parsing, timing summaries, worker sentinel decoding/spawn limits, deterministic progress, report emission, and failed-trailer handling while each benchmark keeps its domain schema and invariant validation. The existing managed-child primitive now supports foreground children and diagnostic callbacks, allowing all seven named scripts to use it directly while keeping their timeout grace, liveness polling, registries, and cleanup policy local.

Repeated caller-local Windows signaling tests were removed; the managed owner suite now covers taskkill, forced taskkill, foreground-child signaling, and group-error diagnostics. Caller boundary tests still exercise real timeout, descendant, forwarded-signal, cleanup, and report behavior.

User Impact

No product behavior changes. Maintainers get one benchmark lifecycle, one cross-platform child-tree signaling primitive, less duplicated test machinery, and consistent process cleanup across build, package, QA, and wrapper scripts.

Evidence

  • Focused suites: 271 tests passed across both benchmarks, managed child processing, all seven migrated callers, and their real descendant/timeout paths before the final test-harness hardening; the 120 directly affected load-sensitive tests passed afterward on the rebased head.
  • Real benchmark smoke: agent concurrency completed all five scenarios at size 1; durable task-registry churn completed size 2 / one cycle with invariants intact.
  • node scripts/check-changed.mjs --base origin/main --head HEAD passed after rebase, including script/test typechecks, two targeted script-lint batches, erasability over 506 script implementations, and Docker E2E boundary guards.
  • pnpm build passed end-to-end in 16m44s, including all nine tsdown invocations, package/plugin surfaces, runtime postbuild, Control UI build, and CLI startup metadata generation.
  • Fresh Codex autoreview reported no accepted/actionable findings.

Kept local by design:

  • Telegram raw-PID SUT/tunnel signaling stays local because it has no ChildProcess handle and owns explicit persisted-PID liveness/wait/escalation policy.
  • Per-caller process-tree liveness polling, grace windows, registries, output handling, and failure classification remain with their lifecycle owners.
  • Process helpers outside the seven requested sites were not folded into this tranche; their ownership and spawn contracts require separate audit.

Production LOC: +0/-0 | Tests: +57/-503 | Tooling: +475/-840

@clawsweeper

clawsweeper Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: XL maintainer Maintainer-authored PR labels Aug 18, 2026
@steipete
steipete marked this pull request as ready for review August 18, 2026 01:18
@clawsweeper clawsweeper Bot added merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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 Aug 18, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready verification is complete for 9f320901f80cb28d8194e70a99dd0a63225d7fd9.

Proof run:

  • Focused Vitest covered both benchmark owners, the managed child owner, and all seven migrated callers. The full focused set passed before the final test-harness adjustment; the 120 directly affected load-sensitive tests passed afterward on the rebased head.
  • Real benchmark smokes completed all five agent-concurrency scenarios at size 1 and durable registry size 2 / one cycle with invariants intact.
  • node scripts/check-changed.mjs --base origin/main --head HEAD passed after rebase, including script/test typechecks, two targeted lint batches, script erasability, and Docker E2E boundary guards.
  • pnpm build passed end-to-end in 16m44s, including all nine tsdown invocations and CLI startup metadata generation.
  • pnpm deadcode:full && pnpm deadcode:exports passed with zero findings.
  • The first exact-head CI run https://github.com/openclaw/openclaw/actions/runs/32087767250 found one unused exported harness type. The type was made private; replacement exact-head CI https://github.com/openclaw/openclaw/actions/runs/32088438969 is green.
  • Fresh Codex autoreview reported no accepted/actionable findings.
  • ClawSweeper’s exact-head shard artifact reports patch is correct, no review findings, security cleared, and platinum-hermit readiness. Its only rank-up move was exact-head CI completion, satisfied above; there is no technical P1.
  • OPENCLAW_TESTBOX=1 scripts/pr prepare-run 125491 passed in hosted_exact_or_recent_parent mode and verified the remote PR tree matches the prepared head. Two earlier prepare attempts hit the authenticated REST core limit; the operation locks were recovered with the wrapper-issued tokens, and the successful retry waited until the confirmed reset.

Kept local by design: raw persisted-PID Telegram SUT/tunnel signaling and caller-owned liveness/grace/registry/failure policy. Process helpers outside the seven requested sites remain a separate audit tranche.

No live-provider or user-visible behavior is involved.

LOC: production +0/-0; tests +57/-503; tooling +475/-840.

@clawsweeper

clawsweeper Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 17, 2026, 10:06 PM ET / August 18, 2026, 02:06 UTC.

ClawSweeper review

What this changes

This PR consolidates benchmark support code and process-tree termination helpers used by repository tooling scripts.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep open for explicit maintainer handling: this fresh maintainer-owned tooling refactor has no source-backed blocking defect, but its protected label and shared cross-platform process-cleanup impact warrant final exact-head validation.

Priority: P3
Reviewed head: 9f320901f80cb28d8194e70a99dd0a63225d7fd9
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The refactor has coherent ownership and retained boundary coverage, with final platform-validation handling remaining.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored internal tooling refactor is exempt from the external-contributor real-behavior-proof gate; its PR body also records focused suites and benchmark smoke evidence.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored internal tooling refactor is exempt from the external-contributor real-behavior-proof gate; its PR body also records focused suites and benchmark smoke evidence.
Evidence reviewed 5 items Shared termination owner: The shared helper owns POSIX process-group signaling, direct-child fallback, and Windows taskkill escalation.
Migrated caller preserves its local policy: The environment wrapper retains its foreground-child choice and passes it explicitly to the shared helper.
Boundary coverage remains at the owner: The managed-child suite covers direct-child signaling, group-error fallback, Windows taskkill, and real descendant cleanup.
Findings None None.
Security None None.

How this fits together

Repository automation launches benchmark workers and build/package helper processes, then parses results and terminates child process trees across platforms. The shared helpers sit below those scripts and determine how timeouts, forwarded signals, and cleanup propagate.

flowchart LR
  A[Benchmark and tooling scripts] --> B[Shared benchmark harness]
  A --> C[Managed child process helper]
  B --> D[Worker processes and reports]
  C --> E[Process group or task tree]
  E --> F[Cleanup result]
  D --> G[Automation outcome]
Loading

Decision needed

Question Recommendation
Should this maintainer-owned refactor land after the latest ClawSweeper rank-up moves and exact-head automation evidence are confirmed? Validate and land: Confirm the latest review requirements and exact-head cross-platform checks, then merge the consolidated helper.

Why: The supplied context omits the latest ClawSweeper comment body, and the protected maintainer label requires explicit human handling rather than automatic closure or merge.

Before merge

  • Resolve merge risk (P1) - The shared helper now affects build, package, QA, and wrapper process cleanup; confirm exact-head cross-platform automation evidence before merge, particularly for Windows task-tree signaling.
Agent review details

Security

None.

PR surface

Tests -446, Other -365. Total -811 across 19 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 8 57 503 -446
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 11 475 840 -365
Total 19 532 1343 -811

Review metrics

Metric Value Why it matters
Owner-boundary LOC production +0/-0; tooling +475/-840; tests +57/-503 The refactor is net-negative across tooling and tests while moving duplicated lifecycle mechanics into two shared owners.

Stored data model

Persistent data-model change detected: unknown-data-model-change: scripts/write-cli-startup-metadata.ts, unknown-data-model-change: test/scripts/write-cli-startup-metadata.test.ts, vector/embedding metadata: scripts/write-cli-startup-metadata.ts, vector/embedding metadata: test/scripts/write-cli-startup-metadata.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Verify the exact-head automation path (recommended)
    Confirm the latest ClawSweeper rank-up moves and exact-head Windows/Linux automation checks cover the shared termination helper before landing.

Technical review

Best possible solution:

Keep one shared benchmark and process-tree helper, with its owner suite protecting platform signaling while callers retain their local timeout, liveness, and cleanup policies.

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

Not applicable: this PR consolidates internal benchmark and process-cleanup implementations rather than reporting a user-facing defect.

Is this the best way to solve the issue?

Yes: sharing canonical lifecycle mechanics while retaining caller-specific timeout and liveness policy is the cleanest owner boundary found.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P3: This is repository-tooling cleanup with no claimed user-facing behavior change.
  • add merge-risk: 🚨 automation: The shared process helper is used by build, package, QA, and wrapper scripts, so a platform-specific cleanup regression could disrupt automation.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored internal tooling refactor is exempt from the external-contributor real-behavior-proof gate; its PR body also records focused suites and benchmark smoke evidence.

Label justifications:

  • P3: This is repository-tooling cleanup with no claimed user-facing behavior change.
  • merge-risk: 🚨 automation: The shared process helper is used by build, package, QA, and wrapper scripts, so a platform-specific cleanup regression could disrupt automation.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored internal tooling refactor is exempt from the external-contributor real-behavior-proof gate; its PR body also records focused suites and benchmark smoke evidence.

Evidence

What I checked:

Likely related people:

  • steipete: Current shared-helper lines blame to steipete’s PR-head commit, and the supplied PR commits are authored by steipete. (role: current tooling contributor; confidence: high; commits: 9f320901f80c, ff11c93cb6d4; files: scripts/lib/managed-child-process.mts, scripts/lib/benchmark-harness.mts)
  • Vincent Koc: Local history records the original durable-registry and agent-concurrency benchmark work under Vincent Koc. (role: benchmark feature contributor; confidence: medium; commits: a3b09821488d, b4e82951e70c; files: scripts/bench-agent-concurrency.ts, scripts/bench-task-registry-sqlite.ts)

Rank-up moves

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

  • Confirm the latest ClawSweeper rank-up moves and exact-head cross-platform automation results before merge.

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 448eb41 into main Aug 18, 2026
150 checks passed
@steipete
steipete deleted the steipete/w4-bench-process-tree branch August 18, 2026 02:08
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 18, 2026
* refactor(tooling): unify benchmark and process helpers

* test(tooling): harden process fixture readiness

* fix(tooling): keep benchmark harness types private
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: XL 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