Repository navigation
fix(oc-path): bound config file reads with size cap - #110714
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 30, 2026, 2:43 AM ET / 06:43 UTC. ClawSweeper reviewWhat this changesThe branch bounds every Regression provenancePossible regression — probable (reviewed change; known regression link). No predecessor PR is attributed. Merge readinessThis PR remains necessary: fetched current main still performs an unbounded Priority: P2 Review scores
Verification
How this fits togetherOcPath is OpenClaw’s CLI facility for inspecting and editing workspace JSONC, JSONL, YAML, and Markdown files. CLI subcommands resolve a path to a file, load and parse it, then emit a match, edit result, search result, or normalized file output. flowchart LR
A[CLI path command] --> B[Resolve selected file]
B --> C[Open descriptor nonblocking]
C --> D{Regular file within 16 MiB?}
D -->|No| E[Typed CLI diagnostic]
D -->|Yes| F[Parse one file snapshot]
F --> G[Resolve find set or emit]
G --> H[CLI output or write]
Decision needed
Why: The branch intentionally changes the size behavior of file kinds that previously had no documented pre-parse ceiling, so code review cannot determine the desired compatibility policy alone. Before merge
Agent review detailsSecurityNone. PR surfaceSource +43, Tests +82, Docs +1. Total +126 across 5 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Adopt one documented 16 MiB pre-parse ceiling for every OcPath file kind if maintainers accept that compatibility policy, keeping the single descriptor-backed snapshot as the sole loader. Do we have a high-confidence way to reproduce the issue? Yes—source-reproducible with high confidence: fetched current main calls Is this the best way to solve the issue? Yes technically: placing one bounded, descriptor-backed snapshot at the CLI load owner fixes every loading verb and eliminates the duplicate diff read. The only unresolved question is whether the uniform cross-format limit is the intended product policy. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against a6446347b12a. LabelsLabel 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 (5 earlier review cycles)
|
Behavior Proof — Bounded oc-path CLI File ReadsTest CoverageRunning The Full CIAll CI gates green (preflight, lint, types, checks, tests). @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
ae2572e to
d29b89e
Compare
|
Rebased on latest main — adapted to mains existing test structure. All 701 oc-path tests pass including the updated oversized-file rejection test. @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
3bc897f to
dfca8f2
Compare
|
@clawsweeper re-review Rebased on latest upstream/main and pushed a clean head:
CI is green and Real behavior proof passed on the current head. Please re-review for ready-for-maintainer-look. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
dfca8f2 to
ea407f6
Compare
|
@clawsweeper re-review Addressed the latest review findings in code; pushed a clean head. Please re-review. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
b508709 to
32cf5cf
Compare
|
@clawsweeper re-review Preserved the JSONC oversized-input diagnostic contract and refreshed the head to re-run checks after infrastructure flakes. Please re-review. |
68376d2 to
d49c2bd
Compare
Dependency graph guard clearedThis PR no longer has blocked dependency graph changes. A future dependency graph change requires a fresh
|
d49c2bd to
c6f3475
Compare
|
Thanks @cxbAsDev! Proof: A 12 MiB JSON file still resolves normally. A 20,971,532-byte input now returns
Example
|
Bound user-selected OcPath files before parsing so oversized and special files cannot consume unbounded memory or hang the CLI. Reuse one descriptor snapshot across resolve, find, set, and emit while preserving the JSONC oversized-input diagnostic. Co-authored-by: Ayaan Zaidi <[email protected]>
Summary
openclaw pathfile read to 16 MiB before parsing.set --diff.What Problem This Solves
openclaw pathread a user-selected file into memory before the JSONC parser enforced its 16 MiB limit. A 20,971,532-byte input was fully buffered before rejection. Thesetpath also read the same file twice, and a FIFO could wait indefinitely for a writer.Root cause
The CLI file-load boundary used
fs.readFiledirectly. The size contract lived inside the JSONC parser, after the unbounded allocation, andsetseparately loaded bytes for its diff.Fix
OC_JSONC_INPUT_TOO_LARGEfor JSONC/JSON and useOC_PATH_INPUT_TOO_LARGEfor other formats.Evidence
eea8f9615e68b10c693c040cf60b149151beb87e: the 12 MiB control succeeded; the 20,971,532-byte JSONC input returned the typed error only after all 20,971,532 bytes were read.c6f34752d1643d02419801f14b200e04334bf6aa: the same control succeeded through the bounded descriptor reader; the same oversized input returned the typed error before any file bytes were read.Validation
Production shape
set.resolve,find,set, andemit.setread.ClawSweeper rank-up move