Skip to content

fix(qa): avoid false zero RSS after a process leader exits - #147407

Merged
vincentkoc merged 1 commit into
mainfrom
fix/qa-rss-unavailable
Sep 13, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
fix/qa-rss-unavailable

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Sep 13, 2026 •

Copy link
Copy Markdown
Member

Fixes #147397

The related cleanup repair landed in #147386. This PR contains only the RSS producer repair.

What Problem This Solves

QA memory reports can show zero RSS on Linux after a process leader exits while another thread still holds memory.

User Impact

An unavailable process-tree RSS measurement is reported as unknown (null), so missing kernel data cannot look like zero memory use. Explicit zero remains valid. CPU measurements and macOS/Windows behavior are unchanged.

Why This Change Was Made

Linux RSS measurements now require an explicit VmRSS value for every reachable process in the tree. The collector keeps process topology even when a metric is missing and propagates an unavailable measurement instead of dropping that process or substituting zero.

Production: +34/-7 (net +27), required to enforce the existing number-or-null measurement contract. Tests: +92/-6. No persistent process tracker or consumer arithmetic change.

Evidence

  • Five focused QA files passed: 62 tests covering RSS, Windows behavior, process groups, command settlement, and child cleanup.
  • An actual Linux child retained a touched 4 MiB allocation in a worker after its leader exited. The old RSS reader returned zero; the repaired reader returned null while an independent thread and group-pidfd witness still proved the worker alive.
  • The landed cleanup fix then terminated the owned group with SIGTERM; immediate pidfd completion, child close, and cleanup acknowledgement were verified.
  • The mechanical restack preserves both tested RSS files and the relevant source/dependency contracts. The cleanup test-only correction separately passed 17 tests and the extension test-type lane.
  • Scoped autoreview and independent owner/proof review found no actionable issue in the tested candidate. Fresh scoped autoreview at the restacked head is clean. Exact-head CI run 34783215093 (attempt 1) and native preparation passed at 5c89a88e963dfc1dd1cc1864b4d40c97b04b10c5. ClawSweeper reviewed that head with no actionable findings and confirmed the existing compatibility contract.

This is a measurement-correctness fix; it does not estimate unavailable RSS or claim a memory reduction.

Data-model Compatibility

No persisted schema or serialized shape changes. The gateway RSS accessor already returns number | null in extensions/qa-lab/src/suite-runtime-types.ts:17; summary RSS fields are already optional number | null in extensions/qa-lab/src/suite-summary.ts:33. The existing sampler excludes unavailable readings from measured samples (suite-run-standard.ts:215), and buildQaSuiteRuntimeMetrics omits RSS aggregate fields when an endpoint is unavailable (suite.ts:399). These consumers and types are unchanged in this PR.

The latest exact-head review confirms this compatibility proof resolves the migration concern, but its generated Before merge checklist still repeats the request. That item is satisfied by the unchanged contracts above: this repair produces the already-supported unavailable result instead of a false measurement. No stored-format migration or upgrade action is required.

@vincentkoc vincentkoc self-assigned this Sep 13, 2026
@clawsweeper

clawsweeper Bot commented Sep 13, 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.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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 13, 2026
@clawsweeper

clawsweeper Bot commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 13, 2026, 5:24 PM ET / 21:24 UTC (Revision 2).

ClawSweeper review

What this changes

QA Lab’s Linux memory sampler now requires an explicit RSS reading for every reachable process and reports unavailable memory instead of a false zero or partial total.

Merge readiness

⛔ Blocked before merge - 1 item remains

This remains a useful, focused fix with no actionable correctness findings. The earlier migration concern is resolved: existing consumers already support unavailable RSS, and no persisted format changes. The merged cleanup repair does not supersede this work.

Priority: P2
Reviewed head: 5c89a88e963dfc1dd1cc1864b4d40c97b04b10c5

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused producer repair with meaningful regression coverage and an existing compatible consumer contract; no blocking defect was found.
Proof confidence 🌊 off-meta tidepool Not applicable: The ordinary contributor-proof gate is exempt for this MEMBER-authored PR, and no authority boundary changes. The body additionally reports the actual Linux RSS entrypoint changing from zero to null with an independently witnessed live worker; those observations were inspected but not rerun.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The ordinary contributor-proof gate is exempt for this MEMBER-authored PR, and no authority boundary changes. The body additionally reports the actual Linux RSS entrypoint changing from zero to null with an independently witnessed live worker; those observations were inspected but not rerun.
Evidence reviewed 7 items Producer repair and regression coverage: The complete production module and both platform test modules were inspected. Linux RSS reads explicit VmRSS values, retains topology independently of metric availability, and returns null for any unavailable reachable member. CPU and other-platform paths retain their existing behavior; regression cases cover explicit zero, missing descendants, unreadable status, and missing intermediate metrics.
Existing unavailable-value contract: The Gateway accessor already returns number | null; summary RSS fields are already optional and nullable. The sampler excludes null readings, and the summary builder omits RSS aggregates when either endpoint is unavailable. These consumer files are unchanged against both the pinned base and fetched main, resolving the previous review’s migration request without a schema change.
Still necessary on main and latest release: Both fetched main and v2026.9.4 still read Linux RSS directly from ps and accept its zero value; neither contains the explicit VmRSS availability check.
Findings None None.
Security None None.

How this fits together

QA Lab measures the Gateway process tree during test runs. Its memory sampler feeds runtime summaries, which already exclude unavailable readings from measured samples.

flowchart TD
  A[Gateway process ID] --> B[Process tree snapshot]
  B --> C[Reachable Linux processes]
  C --> D[Read kernel memory fields]
  D --> E{Every reading available?}
  E -->|Yes| F[Total memory in bytes]
  E -->|No| G[Unavailable measurement]
  F --> H[QA runtime summary]
  G --> H
Loading

Before merge

  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Source +27, Tests +86. Total +113 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 34 7 +27
Tests 1 92 6 +86
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 126 13 +113

Review metrics

Metric Value Why it matters
Production versus regression coverage Production net +27 lines; tests net +86 lines The production growth has a concrete justification: enforce the existing unavailable-measurement contract without adding persistent tracking or changing consumers.

Stored data model

Persistent data-model change detected: serialized state: extensions/qa-lab/src/process-tree-cpu.ts, unknown-data-model-change: extensions/qa-lab/src/process-tree-cpu.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #147397
Summary: This PR is the candidate fix for the RSS report; the merged process-cleanup repair addresses a separate consequence of the same Linux lifecycle scenario.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

Best possible solution:

Keep RSS availability authoritative at the existing sampler and preserve consumers’ established distinction between measured zero and unavailable memory.

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

Yes: the supplied Linux worker scenario reaches the actual RSS entrypoint, and current-main source accepts the reported zero ps row. This review verified the source path without executing the fixture.

Is this the best way to solve the issue?

Yes: repairing availability at the existing producer is narrow and preserves the number-or-null contract; no migration, parallel sampler, or consumer arithmetic change is needed.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 09b032a95282.

Labels

Label justifications:

  • P2: This fixes demonstrated incorrect Linux QA telemetry with limited blast radius and no established production-frequency or release-blocking impact.
  • 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: The ordinary contributor-proof gate is exempt for this MEMBER-authored PR, and no authority boundary changes. The body additionally reports the actual Linux RSS entrypoint changing from zero to null with an independently witnessed live worker; those observations were inspected but not rerun.

Evidence

What I checked:

  • Producer repair and regression coverage: The complete production module and both platform test modules were inspected. Linux RSS reads explicit VmRSS values, retains topology independently of metric availability, and returns null for any unavailable reachable member. CPU and other-platform paths retain their existing behavior; regression cases cover explicit zero, missing descendants, unreadable status, and missing intermediate metrics. (extensions/qa-lab/src/process-tree-cpu.ts:65, 5c89a88e963d)
  • Existing unavailable-value contract: The Gateway accessor already returns number | null; summary RSS fields are already optional and nullable. The sampler excludes null readings, and the summary builder omits RSS aggregates when either endpoint is unavailable. These consumer files are unchanged against both the pinned base and fetched main, resolving the previous review’s migration request without a schema change. (extensions/qa-lab/src/suite.ts:399, 5c89a88e963d)
  • Still necessary on main and latest release: Both fetched main and v2026.9.4 still read Linux RSS directly from ps and accept its zero value; neither contains the explicit VmRSS availability check. (extensions/qa-lab/src/process-tree-cpu.ts:213, 09b032a95282)
  • Reported real-process evidence: The supplied PR body reports an actual Linux worker retaining a touched 4 MiB allocation after its leader exited: the old reader returned zero and the repaired reader returned null while independent thread and group-pidfd witnesses showed liveness. It also reports 62 focused tests and preservation of the tested RSS blobs after restacking. These are contributor-reported observations; this read-only review did not rerun them. (5c89a88e963d)
  • Related cleanup is merged but distinct: GitHub confirms fix(qa): stop live threads after their process leader exits #147386 merged at the pinned base. Its supplied description explicitly excludes the false-zero RSS defect. The open report [Bug]: QA reports zero RSS while a Linux worker thread still holds memory #147397 specifically documents the memory-measurement failure addressed here. (dedbaa0c594d)
  • Area history and routing: Current-main history identifies Vincent Koc’s shared metric-reader refactor and Peter Steinberger’s later parser consolidation. GitHub commit metadata independently identifies vincentkoc for the shared-reader change. Some older local blobs and the earlier reviewed head were unavailable, so no source-line introduction or unchanged-earlier-head claim is made. (extensions/qa-lab/src/process-tree-cpu.ts, 345b25e305a5)

Likely related people:

  • vincentkoc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Peter Steinberger: 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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-13T20:59:54.761Z sha d139db1a8c543b948c7990bcc3e86a1b60a1305e :: blocked before merge. :: none

Base automatically changed from fix/qa-leader-thread-liveness to main September 13, 2026 21:11
Require an explicit Linux VmRSS value for every reachable process. Preserve unavailable members in the process tree and return null instead of a misleading zero or partial total. CPU and other-platform metric contracts stay unchanged.
@vincentkoc
vincentkoc force-pushed the fix/qa-rss-unavailable branch from d139db1 to 5c89a88 Compare September 13, 2026 21:13
@vincentkoc
vincentkoc marked this pull request as ready for review September 13, 2026 21:14
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

Please review exact head 5c89a88e963dfc1dd1cc1864b4d40c97b04b10c5. The RSS-only change is mechanically restacked onto the landed cleanup repair in #147386. Both RSS file blobs and the relevant runtime/dependency contracts match the existing 62-test and real Linux process proof. The already-qualified cleanup mock correction is inherited from main.

@clawsweeper

clawsweeper Bot commented Sep 13, 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 exact_review_queue).
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
vincentkoc merged commit 32fa909 into main Sep 13, 2026
181 of 182 checks passed
@vincentkoc
vincentkoc deleted the fix/qa-rss-unavailable branch September 13, 2026 21:30
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 14, 2026
…147407)

Require an explicit Linux VmRSS value for every reachable process. Preserve unavailable members in the process tree and return null instead of a misleading zero or partial total. CPU and other-platform metric contracts stay unchanged.
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 P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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.

[Bug]: QA reports zero RSS while a Linux worker thread still holds memory

1 participant