Skip to content

refactor(qa-lab): share process tree metric reader - #130419

Merged
vincentkoc merged 1 commit into
mainfrom
refactor/qa-process-tree-metric
Aug 27, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
refactor/qa-process-tree-metric

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Aug 26, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

QA process-tree CPU and RSS readers duplicated the same input validation, platform dispatch, bounded process snapshot, tree construction, root validation, and aggregation flow. Keeping those paths separate made platform and failure semantics easier to drift.

Why This Change Was Made

Use one private metric reader parameterized by the closed POSIX column/parser and Windows metric map. The exported CPU and RSS wrappers, subprocess options, unit conversions, and null behavior remain unchanged.

User Impact

No user-visible behavior changes. QA runtime resource metrics are easier to maintain consistently across platforms.

Evidence

  • Exact-head local proof passed both focused platform suites: 2 files, 9/9 tests.
  • Exact-head Blacksmith Testbox proof passed the same suites: provider blacksmith-testbox, lease tbx_01m10qmwynap26xr9xd2qvptqm, remote-fetch sync, 9/9 tests, timing JSON exitCode: 0 and runStatus: succeeded: https://github.com/openclaw/openclaw/actions/runs/33039543090
  • Native node scripts/check-changed.mjs passed, including extension production/test typecheck, lint, dead exports, plugin boundaries, and import cycles.
  • git diff --check passed.
  • Fresh exact-head branch autoreview with gpt-5.6-sol at high reasoning reported no accepted/actionable findings (0.93 confidence).
  • Required exact-head openclaw/ci-gate passed via run 33015327766.
  • Exact-head ClawSweeper completed with no findings. Its rebase rank-up is intentionally skipped: against current-main snapshot 71d4a8c3e305c623aa3ffe92696eec18f116cfc6, the process-tree owner, production caller, metric consumer, and both focused test blobs are byte-identical to the PR parent; the synthetic merge and live GitHub merge result are clean.
  • Production delta: +29/-54, net -25.

@vincentkoc vincentkoc self-assigned this Aug 26, 2026
@clawsweeper

clawsweeper Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@vincentkoc
vincentkoc marked this pull request as ready for review August 26, 2026 21:25
@clawsweeper

clawsweeper Bot commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 26, 2026, 6:04 PM ET / 22:04 UTC.

ClawSweeper review

What this changes

The PR replaces duplicated QA Lab CPU and RSS process-tree collection bodies with one private parameterized reader while preserving the exported functions.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

No blocking correctness finding: the refactor preserves both exported metric wrappers and their platform-specific parser/metric selection. This fresh maintainer-authored, protected PR should remain open for ordinary review after its branch is refreshed.

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

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused net-negative refactor with stable wrappers and existing cross-platform coverage; refresh the branch before merge.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored internal refactor is exempt from the external-contributor proof gate; its body records focused platform-suite 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 refactor is exempt from the external-contributor proof gate; its body records focused platform-suite evidence.
Evidence reviewed 5 items Changed implementation: The new private reader retains the prior validation, process command options, null behavior, parser selection, and Windows metric map; the two exports are narrow wrappers.
Caller and tests: Gateway child code continues to call the stable CPU and RSS wrappers; existing POSIX and Windows tests cover command selection, parsing, units, null cases, and process-tree aggregation.
Current-main comparison: Current main still has the duplicated bodies, so the central refactor is not redundant.
Findings None None.
Security None None.

Live Verification

Command: pnpm test extensions/qa-lab/src/process-tree-cpu.test.ts extensions/qa-lab/src/process-tree-cpu.windows.test.ts

Result: PASS (completed)

$ node --import tsx scripts/test-projects.mts extensions/qa-lab/src/process-tree-cpu.test.ts extensions/qa-lab/src/process-tree-cpu.windows.test.ts
[test] starting test/vitest/vitest.extension-qa.config.ts

 RUN  v4.1.11 /tmp/clawsweeper-live-proof-130419-tBycR7/target

 ✓  extension-qa  extensions/qa-lab/src/process-tree-cpu.test.ts (4 tests) 142ms
 ✓  extension-qa  extensions/qa-lab/src/process-tree-cpu.windows.test.ts (5 tests) 145ms

 Test Files  2 passed (2)
      Tests  9 passed (9)
   Start at  22:05:02
   Duration  1.78s (transform 2.84s, setup 2.37s, import 100ms, tests 287ms, environment 0ms)

[test] passed 1 Vitest shard in 7.89s
$ node --import tsx scripts/test-projects.mts extensions/qa-lab/src/process-tree-cpu.test.ts extensions/qa-lab/src/process-tree-cpu.windows.test.ts

Assertions:

  • PASS expect_output: process-tree-cpu.test.ts

How this fits together

QA Lab reads a gateway child process ID and collects CPU or memory totals by traversing its process tree. It uses POSIX ps output or a Windows process snapshot, then supplies the aggregate to QA runtime metrics.

flowchart LR
A[Gateway child process] --> B[CPU or RSS wrapper]
B --> C[Shared process-tree reader]
C --> D{Platform dispatch}
D --> E[POSIX process snapshot]
D --> F[Windows process snapshot]
E --> G[Tree aggregation]
F --> G
G --> H[QA runtime metrics]
Loading

Decision needed

Question Recommendation
Should this protected maintainer-authored refactor merge after it is rebased and exact-head checks complete? Rebase and merge: Refresh against current main and merge if the existing focused platform coverage and required checks remain green.

Why: Repository policy keeps maintainer-authored and maintainer-labeled items open for explicit maintainer handling.

Before merge

  • Resolve merge risk (P1) - The branch is behind current main; rebase and confirm checks on the refreshed head before merge.
Agent review details

Security

None.

PR surface

Source -25. Total -25 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 1 29 54 -25
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 29 54 -25

Review metrics

Metric Value Why it matters
Production LOC delta production +29/-54 (net -25); tests unchanged The refactor removes duplicate production branches while retaining existing platform coverage.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep one private shared reader and land it after a rebase confirms the existing POSIX and Windows process-tree suites on the refreshed head.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep one private shared reader and land it after a rebase confirms the existing POSIX and Windows process-tree suites on the refreshed head.

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

Not applicable: this is a behavior-preserving internal refactor, with existing focused POSIX and Windows coverage for the changed reader.

Is this the best way to solve the issue?

Yes: parameterizing the existing shared validation, snapshot, traversal, and aggregation flow removes duplication without widening the exported API or changing the platform-specific parsers.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P3: This is a small internal QA Lab maintainability refactor with no claimed user-visible behavior change.
  • 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 refactor is exempt from the external-contributor proof gate; its body records focused platform-suite evidence.

Label justifications:

  • P3: This is a small internal QA Lab maintainability refactor with no claimed user-visible behavior change.
  • 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 refactor is exempt from the external-contributor proof gate; its body records focused platform-suite evidence.

Evidence

What I checked:

Likely related people:

  • vincentkoc: Authored this refactor and prior QA process-metric parser and Windows metric work. (role: feature owner and recent area contributor; confidence: high; commits: b64f2a656151, f26793ca545a, 9afbfc1b63cd; files: extensions/qa-lab/src/process-tree-cpu.ts)
  • Peter Steinberger: Earlier strict metric and CPU-time parsing changes remain used by the refactored reader. (role: adjacent parsing contributor; confidence: medium; commits: 339a74a3421f, 031117135027; files: extensions/qa-lab/src/process-tree-cpu.ts)

Rank-up moves

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

  • Rebase onto current main and confirm required checks on the exact refreshed head.

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-26T21:21:51.674Z sha b64f2a6 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added 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 26, 2026
@vincentkoc
vincentkoc merged commit 345b25e into main Aug 27, 2026
511 of 520 checks passed
@vincentkoc
vincentkoc deleted the refactor/qa-process-tree-metric branch August 27, 2026 04:35
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Aug 27, 2026
…-retirement-v13

* origin/main: (243 commits)
  fix: preserve Gateway error reasons in text logs (#130645)
  refactor(video): deduplicate generation contracts (#130635)
  fix(agents): preserve direct-message sender identity (#124548)
  fix(agents): preserve silent reply after settled tools (#130675)
  fix(talk): preserve replacement speech when an old utterance is canceled (#130687)
  fix(browser): preserve literal names and formatter-owned snapshot refs (#130599)
  fix(auth): reset only the profile replaced by a successful login (#124014)
  fix: bind session creation to admitted Gateway (#130686)
  refactor(qa-lab): reuse model reference splitter (#130317)
  docs(gateway): clarify independent HTTP endpoint switches (#130690)
  fix(ui): Control UI smooth scrolling ignores the reduced-motion preference (#130428)
  refactor(lmstudio): remove unreachable catalog merge (#130689)
  fix(crabbox): restore cloud machine CPU and RAM (#130684)
  fix(secrets): compare proxy bearer tokens directly (#127054)
  fix(matrix): show recovery key availability in text status (#128051)
  fix(ios): restore approval settings navigation and remove duplicate shell state (#130651)
  refactor(agents): use fixed tool-loop defaults directly (#130681)
  refactor(qa-lab): share process tree metric reader (#130419)
  refactor(models): simplify prepared owner access (#130683)
  fix(parallels): main install and update smoke cannot complete (#130658)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: qa-lab maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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