Skip to content

fix(tooling): admit semantic checks within host memory budgets - #160094

Merged
vincentkoc merged 2 commits into
mainfrom
fix/semantic-host-admission
Sep 28, 2026
Merged

vincentkoc merged 2 commits into
mainfrom
fix/semantic-host-admission

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Sep 28, 2026 •

Copy link
Copy Markdown
Member

Related: #160010

What Problem This Solves

Independent lint and compiler processes can each fit their own heap target while collectively exhausting the host.

User Impact

This adds the shared admission owner for subsequent compiler and lint activation; no existing command uses it yet. Callers receive one host/account slot, a kernel process-tree limit based on current memory headroom, and a 15-minute queue-plus-execution deadline.

The owner requires verified Linux containment. Unsupported platforms or insufficient/unknown memory headroom return an actionable refusal instead of starting an unbounded process. Compiler/lint command activation and platform routing are separate PRs.

Why This Change Was Made

The kernel limit from #160024 bounds one process tree; this owner prevents simultaneous checks across worktrees from independently consuming the same budget. It uses the existing fs-safe lock contract and process-memory reader, with the OS account identity rather than task-specific HOME.

Admission follows artifact ownership, measures headroom after waiting, caps the aggregate tree at the smaller of 8 GiB or half of usable capacity/headroom, and refuses below 512 MiB. It records the kernel scope identity before launch and retains ownership when cleanup cannot prove tree extinction. Cancellation remains owned through asynchronous release; soft Go overrides remain intact.

Evidence

  • Blacksmith Testbox proof exercised real filesystem lock contention, canceled/expired admission, late acquisition, command snapshotting, capacity/headroom refusal, non-Linux refusal, receipt ordering, and retention after uncertain cleanup. Kernel launches are mocked in this focused owner suite; actual kernel enforcement was qualified in the merged parent.
  • Strict script/root test types, targeted typed lint, formatting, and whitespace passed for the helper and profiler candidate. An independent P0–P2 review found no actionable finding.
  • This PR cherry-picks the tested helper unchanged onto the merged kernel/cancellation parents. The three dependency-owner modules are byte-identical to the proof base. Hosted CI will validate this exact head.
  • Production/tooling: +166/-0; tests: +321/-0. The growth supplies the missing cross-worktree admission/lifecycle owner. There is no runtime/config migration or new dependency.

CI correction: exact-head check-lint identified nine missing control-flow braces in the new test file. Commit e590faf299ddb75e36b1a8e503121807785bb1ba adds those braces; conditions and async sequencing are unchanged. Targeted formatting, whitespace, and independent P0–P2 review pass. Fresh CI provides the updated lint proof.

Measured test cost at e590faf299ddb75e36b1a8e503121807785bb1ba: the exact helper and test bytes were run on Testbox from the profiler child revision, with --maxWorkers=1. All 26 cases passed; file test time 1.331s, Vitest wall 1.84s, complete test command 2.69s. Dedicated test execution adds 2.69 CI wall seconds, excluding shared checkout/install/setup. This addresses the review's test-cost finding and Rank-up move; no source change or repeat review is needed.

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

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

@vincentkoc
vincentkoc marked this pull request as ready for review September 28, 2026 04:12
@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: M labels Sep 28, 2026
@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 28, 2026
@clawsweeper

clawsweeper Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 28, 2026, 12:48 AM ET / 04:48 UTC (Revision 3).

ClawSweeper review

What this changes

The branch adds a Linux helper that reserves one shared slot for a compiler or lint check, sizes its process-tree memory limit, and tests contention, cancellation, and cleanup.

Merge readiness

✅ Ready for maintainer review

This is a distinct admission component missing from current main. The prior test-cost finding is addressed in the updated PR body, and this review found no blocking patch defect. Later PRs own activation in developer commands.

Priority: P2
Reviewed head: e590faf299ddb75e36b1a8e503121807785bb1ba

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused staged repair with meaningful lock-lifecycle coverage and no remaining actionable finding; caller-level behavior belongs to the linked follow-up work.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: The MEMBER-authored internal helper has no contributor proof gate. Its focused tests exercise real filesystem locking while mocking process launch and memory readings; the merged parent separately qualified Linux kernel containment, and no current command invokes this helper. The new lock and receipt paths have no previous stored format to migrate. Linked Testbox logs could not be inspected through the reviewer network.
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 internal helper has no contributor proof gate. Its focused tests exercise real filesystem locking while mocking process launch and memory readings; the merged parent separately qualified Linux kernel containment, and no current command invokes this helper. The new lock and receipt paths have no previous stored format to migrate. Linked Testbox logs could not be inspected through the reviewer network.
Evidence reviewed 9 items Introduced admission owner: The helper acquires a host/account lock, measures headroom after acquisition, and passes a memory limit and remaining deadline to the managed-process owner.
Dependency signal: The helper directly imports the fs-safe file-lock and root APIs, so their lock contract is relevant.
Pinned lock contract: In the verified fs-safe repository's v0.21.1 source, fail-closed stale recovery throws rather than removing an observed lock after a reclaim decision.
Findings None None.
Security None None.

How this fits together

OpenClaw's developer tooling launches compiler and lint processes. This helper accepts a proposed command, checks shared memory capacity, and passes admitted work to the existing managed-process launcher; no current command calls it yet.

flowchart LR
  A[Compiler or lint command] --> B[Shared host slot]
  B --> C[Measure memory headroom]
  C --> D{Enough capacity?}
  D -->|Yes| E[Managed Linux process tree]
  D -->|No| F[Refusal with guidance]
  E --> G[Release slot after cleanup]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +335, Other +166. Total +501 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 335 0 +335
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 166 0 +166
Total 2 501 0 +501

Review metrics

Metric Value Why it matters
Admission owner footprint production/tooling +166, tests +335 The production growth supplies cross-worktree admission; the tests cover its lock and cleanup lifecycle before any command adopts it.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #160010
Summary: This PR supplies the shared-admission component of the open lint-memory repair; other linked PRs own kernel containment and separate callers.

Members:

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

Technical review

Best possible solution:

Use this shared admission owner for semantic check entrypoints in separately qualified caller changes, preserving kernel containment and clear remote-worker guidance where local containment is unavailable.

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

No high-confidence current-main execution was established in this read-only review. The linked issue records a high-memory lint run, and current source shows the lint entrypoint does not use shared admission.

Is this the best way to solve the issue?

Yes for this bounded Linux component: it reuses the existing file-lock and managed-process owners. Caller activation still needs its own proof and upgrade review.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a bounded developer-tooling repair in an active memory-containment series, with no existing command changed by this slice.
  • 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. Not applicable: The MEMBER-authored internal helper has no contributor proof gate. Its focused tests exercise real filesystem locking while mocking process launch and memory readings; the merged parent separately qualified Linux kernel containment, and no current command invokes this helper. The new lock and receipt paths have no previous stored format to migrate. Linked Testbox logs could not be inspected through the reviewer network.

Evidence

What I checked:

Likely related people:

  • Vincent Koc: Raw commit f26303d adds scripts/lib/cancelable-command.mts:12 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: f26303d70274; files: scripts/lib/cancelable-command.mts)
  • 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 (2 earlier review cycles)
  • reviewed 2026-09-28T04:18:26.660Z sha 11bde1e :: needs maintainer review before merge. :: none
  • reviewed 2026-09-28T04:38:19.162Z sha e590faf :: needs changes before merge. :: [P3] Record the new test suite's measured cost

@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

Please review exact head e590faf299ddb75e36b1a8e503121807785bb1ba. The only new change adds the nine control-flow braces requested by the exact-head check-lint failure; production behavior is unchanged. Separate formatter/whitespace checks and independent P0–P2 review pass. Fresh CI is running; the original admission/runtime proof remains linked in the PR body.

@clawsweeper

clawsweeper Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@vincentkoc
vincentkoc merged commit e07ec8c into main Sep 28, 2026
113 checks passed
@vincentkoc
vincentkoc deleted the fix/semantic-host-admission branch September 28, 2026 05:34
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 29, 2026
…law#160094)

Related: openclaw#160010

## What Problem This Solves

Independent lint and compiler processes can each fit their own heap target while collectively exhausting the host.

## User Impact

This adds the shared admission owner for subsequent compiler and lint activation; no existing command uses it yet. Callers receive one host/account slot, a kernel process-tree limit based on current memory headroom, and a 15-minute queue-plus-execution deadline.

The owner requires verified Linux containment. Unsupported platforms or insufficient/unknown memory headroom return an actionable refusal instead of starting an unbounded process. Compiler/lint command activation and platform routing are separate PRs.

## Why This Change Was Made

The kernel limit from openclaw#160024 bounds one process tree; this owner prevents simultaneous checks across worktrees from independently consuming the same budget. It uses the existing fs-safe lock contract and process-memory reader, with the OS account identity rather than task-specific HOME.

Admission follows artifact ownership, measures headroom after waiting, caps the aggregate tree at the smaller of 8 GiB or half of usable capacity/headroom, and refuses below 512 MiB. It records the kernel scope identity before launch and retains ownership when cleanup cannot prove tree extinction. Cancellation remains owned through asynchronous release; soft Go overrides remain intact.

## Evidence

- [Blacksmith Testbox proof](https://github.com/openclaw/openclaw/actions/runs/36373081283) exercised real filesystem lock contention, canceled/expired admission, late acquisition, command snapshotting, capacity/headroom refusal, non-Linux refusal, receipt ordering, and retention after uncertain cleanup. Kernel launches are mocked in this focused owner suite; actual kernel enforcement was qualified in the merged parent.
- Strict script/root test types, targeted typed lint, formatting, and whitespace passed for the helper and profiler candidate. An independent P0–P2 review found no actionable finding.
- This PR cherry-picks the tested helper unchanged onto the merged kernel/cancellation parents. The three dependency-owner modules are byte-identical to the proof base. Hosted CI will validate this exact head.
- Production/tooling: +166/-0; tests: +321/-0. The growth supplies the missing cross-worktree admission/lifecycle owner. There is no runtime/config migration or new dependency.

CI correction: exact-head check-lint identified nine missing control-flow braces in the new test file. Commit `e590faf299ddb75e36b1a8e503121807785bb1ba` adds those braces; conditions and async sequencing are unchanged. Targeted formatting, whitespace, and independent P0–P2 review pass. Fresh CI provides the updated lint proof.

Measured test cost at `e590faf299ddb75e36b1a8e503121807785bb1ba`: the exact helper and test bytes were run on [Testbox](https://github.com/openclaw/openclaw/actions/runs/36376377264) from the profiler child revision, with `--maxWorkers=1`. All 26 cases passed; file test time 1.331s, Vitest wall 1.84s, complete test command 2.69s. Dedicated test execution adds 2.69 CI wall seconds, excluding shared checkout/install/setup. This addresses the review's test-cost finding and Rank-up move; no source change or repeat review is needed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: L 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