Skip to content

fix(cpu): exclude process census from scan uncertainty - #118

Merged
RomneyDa merged 2 commits into
mainfrom
fix/cpu-counter-scan-bracket
Sep 8, 2026
Merged

RomneyDa merged 2 commits into
mainfrom
fix/cpu-counter-scan-bracket

Conversation

@RomneyDa

@RomneyDa RomneyDa commented Sep 8, 2026

Copy link
Copy Markdown
Member

Summary

  • start the Linux CPU snapshot clock after process discovery
  • keep the clock bracketing only the /proc counter census it bounds
  • prove 100ms of process-list latency does not reduce the measured CPU lower bound

Root cause

startResourceSampler read the CPU clock before invoking ps. The uncertainty calculation therefore charged the process census to the /proc counter scan. In OpenClaw release validation this widened a gateway observation from a 308.1% upper bound down to a 229.4% lower bound—about 79 percentage points of uncertainty—and made Kova return BLOCKED.

Kova is correct to block inconclusive evidence; the measurement window was wrong. This fixes the producer rather than teaching OpenClaw to accept a blocked gate.

Verification

  • npm run test:cpu-accounting (25 passed locally; Linux-only regression runs in CI)
  • npm run check reached the unrelated existing selfcheck-isolation timeout fixture after focused suites passed
  • production +4/-8 (net -4); tests +41/-1

@clawsweeper

clawsweeper Bot commented Sep 8, 2026 •

Copy link
Copy Markdown

🦞👀
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 priority bug or improvement with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 8, 2026
@clawsweeper

clawsweeper Bot commented Sep 8, 2026 •

Copy link
Copy Markdown

Codex review: needs maintainer review before merge. Reviewed September 8, 2026, 4:48 AM ET / 08:48 UTC.

ClawSweeper review

What this changes

Moves Linux CPU snapshot timing after process discovery and adds a regression test that accommodates outward rounding of CPU bounds.

Merge readiness

✅ Ready for maintainer review

The prior rounding finding is resolved, and no blocking defect remains. This focused fix is still needed: current main and v0.1.5 include process discovery in CPU scan uncertainty.

Priority: P2
Reviewed head: 6a5f05a259c0e0759bbec058776b1e87584e2ad7

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused correction with appropriate regression coverage, resolved prior feedback, and no remaining blocking finding.
Proof confidence 🌊 off-meta tidepool Not applicable: The MEMBER-authored PR is exempt from contributor runtime proof. The mocked regression exercises the changed sampler boundary, with passing Linux CI supplied as supplemental validation; no after-fix live measurement is claimed.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The MEMBER-authored PR is exempt from contributor runtime proof. The mocked regression exercises the changed sampler boundary, with passing Linux CI supplied as supplemental validation; no after-fix live measurement is claimed.
Evidence reviewed 7 items Repository policy: Read the full root AGENTS.md; no additional ancestor policies or matching maintainer notes were found. Applied its distinction between OpenClaw behavior and Kova harness evidence.
Current main still contains the defect: The pinned main source reads the CPU clock before process listing, then includes that elapsed discovery time in scanMs. A live main-ref check returned the same pinned SHA.
Latest release remains affected: GitHub identifies v0.1.5 as the latest release; its collector also reads the clock before process discovery.
Findings None None.
Security None None.

How this fits together

Kova samples OpenClaw processes during runtime validation and converts Linux CPU counters into conservative measurement bounds. Those bounds determine whether CPU evidence passes, fails, or blocks qualification as inconclusive.

flowchart LR
  A[OpenClaw workload] --> B[Process discovery]
  B --> C[Timed Linux counter scan]
  C --> D[CPU interval accounting]
  D --> E[Conservative CPU bounds]
  E --> F[Qualification verdict]
Loading

Before merge

None.

Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Production versus test delta Production +4/-8; tests +43/-1 The correction reduces production code and adds focused coverage for discovery latency and rounded bounds.

Technical review

Best possible solution:

Keep uncertainty tied to actual counter-scan margins while retaining conservative bounds and existing incomplete-evidence safeguards.

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

Yes, from source: current main starts the clock before process discovery and includes that latency in scan uncertainty. The regression isolates this with a 100 ms discovery delay; no tests were executed during this read-only review.

Is this the best way to solve the issue?

Yes. Moving the clock to the counter-snapshot boundary directly repairs the producer and preserves the documented qualification rules; the revised assertion respects existing outward rounding.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 7c2ea36ab802.

Labels

Label changes:

  • 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: The MEMBER-authored PR is exempt from contributor runtime proof. The mocked regression exercises the changed sampler boundary, with passing Linux CI supplied as supplemental validation; no after-fix live measurement is claimed.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: Corrects inflated uncertainty in Linux CPU qualification without changing product runtime behavior or thresholds.
  • 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 MEMBER-authored PR is exempt from contributor runtime proof. The mocked regression exercises the changed sampler boundary, with passing Linux CI supplied as supplemental validation; no after-fix live measurement is claimed.

Evidence

What I checked:

  • Repository policy: Read the full root AGENTS.md; no additional ancestor policies or matching maintainer notes were found. Applied its distinction between OpenClaw behavior and Kova harness evidence. (AGENTS.md:1, 6a5f05a259c0)
  • Current main still contains the defect: The pinned main source reads the CPU clock before process listing, then includes that elapsed discovery time in scanMs. A live main-ref check returned the same pinned SHA. (src/collectors/resources.mjs:65, 7c2ea36ab802)
  • Latest release remains affected: GitHub identifies v0.1.5 as the latest release; its collector also reads the clock before process discovery. (src/collectors/resources.mjs:65, a739a165fe7c)
  • Correct measurement boundary: The head brackets the counter snapshot after discovery while preserving retries, coverage checks, and threshold classification. REPORT_SCHEMA.md defines uncertainty in terms of counter-scan margins. (src/collectors/resources.mjs:140, 6a5f05a259c0)
  • Prior finding resolved: The exact follow-up commit replaces endpoint equality with a 0.1-point tolerance. In this fixture, 100 CPU ticks over 1.1 seconds produce outward-rounded bounds of 90.9 and 91.0. The supplied current-head Linux and macOS checks pass. The local historical diff encountered an unavailable blob, so the exact commit patch was inspected through GitHub instead. (tests/linux-cpu-accounting.mjs:256, 6a5f05a259c0)
  • Merged area history: Main history connects Linux CPU accounting to Peter Steinberger and subsequent late-discovery work to Dallin Romney. GitHub identifies the former as steipete and confirms RomneyDa's related work merged at fix(cpu): account late-discovered session processes #112. (src/collectors/linux-cpu.mjs, 065d2ffd535f)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • RomneyDa: 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 (2 earlier review cycles)
  • reviewed 2026-09-08T08:38:58.948Z sha b6316c3 :: needs changes before merge. :: [P2] Account for conservative rounding in the new Linux assertion
  • reviewed 2026-09-08T08:46:01.752Z sha 6a5f05a :: needs maintainer review before merge. :: none

@RomneyDa

RomneyDa commented Sep 8, 2026

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

CI follow-up only: the Linux regression now compares the zero-uncertainty interval within the summary’s documented outward 0.1-point rounding, instead of requiring the independently rounded endpoints to be byte-equal.

@clawsweeper

clawsweeper Bot commented Sep 8, 2026 •

Copy link
Copy Markdown

🦞🧹
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:

@clawsweeper clawsweeper Bot added 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. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 8, 2026
@RomneyDa
RomneyDa merged commit d1cb301 into main Sep 8, 2026
10 checks passed
@RomneyDa
RomneyDa deleted the fix/cpu-counter-scan-bracket branch September 8, 2026 08:54
RomneyDa added a commit that referenced this pull request Sep 8, 2026
)

* fix(cpu): exclude process census from scan uncertainty (#118)

* fix(cpu): exclude process census from scan uncertainty

* test(cpu): compare scan uncertainty within rounding

* fix(cpu): discover starting gateway on next sample (#119)

* fix(cpu): refresh census after gateway discovery (#120)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal priority bug or improvement 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant