Repository navigation
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs real behavior proof before merge. Reviewed September 30, 2026, 9:27 AM ET / 13:27 UTC (Revision 4). ClawSweeper reviewWhat this changesThe branch checks free space before creating plugin source-capture directories, adds a configurable refusal floor and focused tests, and registers the new helper with the PR wrapper. Merge readiness⛔ Blocked before merge - 6 items remain Keep this PR open. Current main lacks the proposed disk guard, and the linked incident remains active. The earlier upgrade-policy finding still applies; the latest commit only updates the PR wrapper inventory. Priority: P0 Review scores
Verification
How this fits togetherOpenClaw captures plugin source before some plugin and model-catalog loads. The capture owner chooses a state or temporary volume and supplies staged files to the loader. flowchart LR
A[Plugin load] --> B[Capture request]
B --> C[Choose volume]
C --> D[Check free space]
D --> E{Enough space?}
E -->|Yes| F[Stage source]
E -->|No| G[Fallback or refuse]
F --> H[Load plugin]
Decision needed
Why: The reported disk-exhaustion incident supports protective refusal, but the change can make a previously loadable plugin unavailable during an upgrade; source inspection cannot approve that tradeoff. Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +66, Tests +113, Other +1. Total +180 across 4 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Use one capture-owner guard with an explicitly approved default and clear recovery guidance, prove fresh-install and upgrade behavior through plugin loading, and leave broader retention design with the linked incident. Do we have a high-confidence way to reproduce the issue? Yes at the source level: current main allocates captures without a free-space guard, and the paired issue describes a concrete disk-exhaustion incident. I did not execute a disk-filling reproduction. Is this the best way to solve the issue? Unclear. The shared disk reader and capture-allocation owner are a narrow repair boundary, but the default refusal needs an upgrade decision and production-path low-space proof. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 058adf3f0689. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles)
|
8422ab1 to
0cf7f5f
Compare
|
Live deployment validation — we hit this exact failure mode today on a production gateway (2026.9.7), so we deployed the guard as a hotpatch on the installed dist to validate it under real churn. The smoke test caught a flaw in the first cut of this branch: when the capture target does not exist yet, The guard now probes the nearest existing ancestor (same volume the directory would be created on), and the branch gained a non-mocked regression test (real Also observed live, for the design discussion in #161839: during the churn window the mechanism was staging at ~3 GB/min with 1-hour grace and hourly sweeps — the preflight stops the amplification, and a total-size cap on unreferenced captures remains worth considering. |
… low on disk
During plugin load churn, every capture attempt stages a full copy of the
plugin source tree. When the volume runs low, staging fails with ENOSPC
only after writing partial payloads, the failed load is retried, and each
retry amplifies the pressure. Observed in the wild: ~50 GB of capture
staging accumulated in under an hour, driving the gateway's own database
writes to fail ("database or disk is full") while loads kept retrying.
Guard the staging choke point (createCaptureDirectory) with a statfs
free-space check. Below the floor (512 MiB default, override with
OPENCLAW_PLUGIN_CAPTURE_MIN_FREE_BYTES, 0 disables), creation fails fast
with a typed PluginSourceCaptureLowDiskError before any payload is
written; the existing cross-volume fallback to the temporary placement is
preserved.
- Volume detection reuses the shared disk-space reader (tryReadDiskSpace),
which probes the nearest existing ancestor - the same volume the
directory would be created on. Live deployment validation caught the
first cut statfs-ing the missing target and failing open on ENOENT; a
non-mocked regression test covers it.
- Malformed OPENCLAW_PLUGIN_CAPTURE_MIN_FREE_BYTES values are rejected
(warning + default) so a numeric-prefix parse can never disable the
guard.
- The refusal error carries an actionable recovery message (free space or
disable the floor), per the capture-mandatory decision in openclaw#161839.
0cf7f5f to
d088bbc
Compare
|
@clawsweeper re-review — head updated to d088bbc: reuses the shared |
|
🦞👀 Re-review progress:
|
…nventory The eager-import-closure test caught the new plugin-source-capture-low-disk module missing from scripts/pr-lib/wrapper-components.txt - the trusted PR wrapper extracts only inventoried components, so the new module's import from plugin-source-capture-directory.ts was unresolved in the wrapper context, failing the worktree-provisioning tests. Register the module in sorted position.
Independent Linux/Docker reproduction of the leaked capture stagingAdding a second environment to the corpus, because this matches the Environment
Observation
Reference scan (why these look orphaned) I checked every one of the 197 dirs against all running processes: 0 of 197 are held via any process's Why this is relevant to this PR
Happy to re-measure after a maintenance restart, or run a provided branch, if another data point would help land this. |
Supersedes #161840, thanks @BorClaw. Refuse new plugin source captures and installed snapshot staging below 512 MiB of available space. Reuse the shared statfs reader and source-acquisition failure handling, preserving healthy-volume behavior, state-to-temporary fallback, and setup preparation recovery. Existing user data is retained. The discarded-setup-capture optimization in #191501 (779f51d) does not protect the remaining capture paths. The floor is a preflight check rather than a reservation for an in-flight copy. Evidence: four new cases fail on main 3e3911e and pass after the fix; 111 tests in seven named files pass on Blacksmith Testbox. Touched-file typed lint, formatting and diff checks pass. Independent Codex autoreview of the pinned complete patch is scoped-clean through P2. Production +15 lines; 142 regression-test lines have an exact allocation. Exact-head CI passes product tests, types, lint, builds, docs and security. Its only root failure is the existing six-line test-line ceiling deficit, independently reproduced on clean main 31ad71a in Testbox run 41601398255. All 142 new test lines have exact allocation credit. Native inherited-failure admission retains the failed CI result. Co-authored-by: BorClaw <[email protected]>
…aw#191757) Supersedes openclaw#161840, thanks @BorClaw. Refuse new plugin source captures and installed snapshot staging below 512 MiB of available space. Reuse the shared statfs reader and source-acquisition failure handling, preserving healthy-volume behavior, state-to-temporary fallback, and setup preparation recovery. Existing user data is retained. The discarded-setup-capture optimization in openclaw#191501 (8ba9cac) does not protect the remaining capture paths. The floor is a preflight check rather than a reservation for an in-flight copy. Evidence: four new cases fail on main 9f352e8 and pass after the fix; 111 tests in seven named files pass on Blacksmith Testbox. Touched-file typed lint, formatting and diff checks pass. Independent Codex autoreview of the pinned complete patch is scoped-clean through P2. Production +15 lines; 142 regression-test lines have an exact allocation. Exact-head CI passes product tests, types, lint, builds, docs and security. Its only root failure is the existing six-line test-line ceiling deficit, independently reproduced on clean main f77ae72 in Testbox run 41601398255. All 142 new test lines have exact allocation credit. Native inherited-failure admission retains the failed CI result. Co-authored-by: BorClaw <[email protected]>
What Problem This Solves
On 2026.9.7,
createCaptureDirectorystages full copies of plugin source trees with no free-space check. During plugin load churn on a production gateway, that consumed ~50 GB of capture staging in under an hour (~3 GB/min), driving the volume to ENOSPC. The ENOSPC then amplified: failed loads were retried, each retry staged another capture, and the gateway's own database writes started failing ("database or disk is full"), killing agent runs and Telegram delivery. Full incident timeline in #161839.This PR adds a free-space preflight at the single staging choke point (
createCaptureDirectory): below the floor (512 MiB default, env-overridable,0disables), capture creation fails fast with a typedPluginSourceCaptureLowDiskErrorbefore any payload is written, breaking the amplification loop. Cross-volume fallback to the temporary placement is preserved. Volume detection delegates to the shared disk-space reader (tryReadDiskSpace), which probes the nearest existing ancestor — the same volume the directory would be created on. If the volume cannot be inspected, the guard stays open. Per the capture-mandatory direction discussed in #161839, the refusal error carries an actionable recovery message (free space, or disable the floor, then retry the load).Evidence
src/plugins/plugin-source-capture-low-disk.test.ts(6 tests) + the full existing capture suite (32 tests), both green:node scripts/run-vitest.mjs run --config test/vitest/vitest.plugins.config.ts src/plugins/plugin-source-capture-low-disk.test.ts src/plugins/plugin-source-capture-directory.test.ts→ 38 passed (38)Includes a non-mocked regression test (real
statfsSync) for the ENOENT fail-open flaw found in live validation, and malformed-override rejection (0oopsmust never disable the guard).createCaptureDirectory— zero load failures, zero ENOSPC (the incident's own storm boot produced ~70), staging steady at ~2.5 GB across the monitored window, volume steady at ~56 GB free.Boot line:
[gateway] http server listening (13 plugins: acpx, browser, codex, firecrawl, fusion, keenable, llama-cpp, memory-core, memory-wiki, openai, tavily, telegram, telegram-topic-memory; 34.2s)PluginSourceCaptureLowDiskError: plugin source capture refused: /Users/alex/.openclaw/tmp has 60285063168 free bytes, below the 1099511627776-byte floorThe probe walked to
/Users/alex/.openclaw/tmp— the nearest existing ancestor of the not-yet-created target — and refused before writing anything; floor0passed through and staged normally.Notes
OPENCLAW_PLUGIN_CAPTURE_MIN_FREE_BYTESvalues are rejected (warning + 512 MiB default) so a numeric-prefix parse can never disable the guard.