Skip to content

fix(file-transfer): preserve plugin filesystem boundary - #159654

Merged
steipete merged 1 commit into
mainfrom
deslop/l113-file-transfer-sdk-boundary
Sep 27, 2026
Merged

steipete merged 1 commit into
mainfrom
deslop/l113-file-transfer-sdk-boundary

Conversation

@steipete

@steipete steipete commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The directory-scan refactor in #159603 imported @openclaw/fs-safe/root directly from the file-transfer plugin. That violates the plugin dependency boundary and fails src/infra/fs-safe-import-boundary.test.ts on current main. It was exposed by the main rebase for #159554; the failing source file is untouched by that CLI PR.

Why This Change Was Made

Return directory preflight enumeration to the existing openclaw/plugin-sdk/security-runtime rooted list contract. The SDK deliberately keeps the newer Root.walk capability core-only, so this fix does not widen it or add an exception to the import guard. The traversal preserves identity binding, bounded depth-first output, deterministic ties between locale-equivalent names, hidden entries, and symlinks without following their targets.

User Impact

No intended output, configuration, permission, or SDK change. File-transfer preflight retains its existing behavior while using the supported plugin dependency surface. No changelog entry is needed for this unreleased main regression.

Evidence

  • Original failure: CI run 36319025457, job 108619812681 reports only extensions/file-transfer/src/node-host/dir-fetch.ts as the import-boundary violation.
  • Independent Codex autoreview is scoped-clean through P2.
  • Blacksmith Testbox tbx_01m3hex2x923k0pd236tmqyvpq (run): original-source boundary control reproduced the exact failure (2.36 s); the repaired boundary and plugin/test-helper siblings passed all 25 tests (3.84 s); pnpm test:extensions:batch file-transfer passed 33 files / 354 tests, with one existing skip (66.49 s). check-changed passed (464.85 s), and pnpm build passed (383.27 s). The build emitted non-fatal Control UI gzip advisories. Testbox proof used tree 9fe37c4085a0bc89e76d829b8e3ce439746b7183, matching pre-rebase head a6956017ff16c0c1a3928340560d367af15a7cd9. Lease stopped and verified completed.
  • Pre-rebase exact-head CI passed in run 36320863824. The required final refresh onto 32ba81a40d9d57065280aef6a25fed0b39223f21 is patch-identical, with all affected dependency files unchanged and no duplicate fix on main. Current head is b7b8ca2b94a035b40b82d004a928143dc4f00267; its own CI run 36322187124 passed. Merged as e8b091921ef03a016985cbb9a55abf0766470773 on 2026-09-27 at 13:36 UTC while the authoring lane was closing out. The merged source matches the proved repair.
  • Existing import-boundary and real-directory tests provide regression coverage; no assertions or exceptions were weakened and no new test was added.

@clawsweeper

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

@steipete
steipete marked this pull request as ready for review September 27, 2026 12:59
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. 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 27, 2026
@clawsweeper

clawsweeper Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 27, 2026, 9:32 AM ET / 13:32 UTC (Revision 3).

ClawSweeper review

What this changes

The File Transfer plugin switches directory preflight from a direct filesystem-package import to the Plugin SDK’s rooted filesystem API and recursively lists entries before creating an archive.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⛔ Blocked before merge - 4 items remain

Keep open. Current main still violates the plugin import guard, so the repair is useful. The previous blocking finding remains: directory preflight can process every child of a wide directory before enforcing its 5,000-entry limit.

Priority: P2
Reviewed head: b7b8ca2b94a035b40b82d004a928143dc4f00267

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) PR readiness rating was derived from proof quality, review findings, security review, and reviewer confidence.
Proof confidence 🌊 off-meta tidepool Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🦪 silver shellfish (2/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
Evidence reviewed 11 items Introduced change: The pinned PR hunk replaces the direct fs-safe import and budgeted walk with an SDK import and recursive Root.list calls.
Current main still needs the boundary repair: Fetched main still imports @openclaw/fs-safe/root directly in the File Transfer plugin.
Import guard: The repository guard rejects a direct fs-safe root import from File Transfer production code.
Findings 1 actionable finding [P2] Bound each directory before collecting its children
Security None None.

How this fits together

File Transfer receives an authorized directory request on a paired node, checks its entries and limits, then creates a capped archive for transfer. The plugin obtains rooted filesystem access through the Plugin SDK.

flowchart LR
  A[Directory fetch request] --> B[Authorized directory]
  B --> C[Rooted SDK traversal]
  C --> D{Entry limit exceeded?}
  D -->|Yes| E[Reject preflight]
  D -->|No| F[Create capped archive]
  F --> G[Transfer result]
Loading

Before merge

  • Bound each directory before collecting its children (P2) - On a directory with more than 5,000 immediate children, this call fully reads and synchronously stats every child before the later count check runs. The previous budgeted walk could stop at its limit, so this can stall preflight or surface a metadata error beyond the budget instead of TREE_TOO_LARGE. Use the SDK's sorted Root.entries iterator with the remaining budget and cover a wide-directory rejection.
  • Resolve merge risk (P1) - A directory with far more than 5,000 immediate children can make File Transfer preflight read and stat every child before rejecting the request, stalling the node host or returning a metadata error from an entry beyond the budget.
  • Complete next step (P2) - Bound preflight enumeration through Root.entries and add a wide-directory regression; add redacted after-fix File Transfer runtime proof to the PR body.
  • Improve patch quality - Address the highest-priority review finding and re-run the changed-surface validation.

Findings

  • [P2] Bound each directory before collecting its children — extensions/file-transfer/src/node-host/dir-fetch.ts:117
Agent review details

Security

None.

PR surface

Source +2. Total +2 across 1 file.

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

Review metrics

None.

Merge-risk options

Maintainer options:

  1. Restore bounded preflight (recommended)
    Iterate through the existing rooted SDK entries API with the remaining budget and verify that a wide directory promptly returns TREE_TOO_LARGE.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Replace the unbounded Root.list preflight with sorted Root.entries iteration using the remaining 5,000-entry budget; preserve identity, symlink, ordering, and error behavior, and add an owner-boundary wide-directory regression.

Technical review

Best possible solution:

Use the existing SDK Root.entries iterator with sorted order and a remaining-entry budget, preserve identity and symlink checks, and cover prompt rejection of a directory wider than the cap at the node-host entry point.

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

Yes, from source: current main has the direct import rejected by the guard, and the proposed Root.list path demonstrably does all sibling work before its count check. This read-only review did not execute either path.

Is this the best way to solve the issue?

No. Returning to the Plugin SDK is the right boundary, but Root.list loses the work bound; the existing sorted, bounded Root.entries operation is a narrower repair.

Full review comments:

  • [P2] Bound each directory before collecting its children — extensions/file-transfer/src/node-host/dir-fetch.ts:117
    On a directory with more than 5,000 immediate children, this call fully reads and synchronously stats every child before the later count check runs. The previous budgeted walk could stop at its limit, so this can stall preflight or surface a metadata error beyond the budget instead of TREE_TOO_LARGE. Use the SDK's sorted Root.entries iterator with the remaining budget and cover a wide-directory rejection.
    Confidence: 0.97

Overall correctness: patch is incorrect
Overall confidence: 0.95

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 0edae198d278.

Labels

Label changes:

  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🌊 off-meta tidepool and patch quality is 🦪 silver shellfish.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🦪 silver shellfish, so this older rating label is no longer current.

Label justifications:

  • P2: The import-boundary repair is useful, while the remaining performance defect is limited to unusually wide File Transfer preflights.
  • merge-risk: 🚨 availability: Merging this traversal can make preflight perform unbounded synchronous child metadata work before its entry cap is enforced.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🌊 off-meta tidepool and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.

Evidence

Acceptance criteria:

  • [P1] pnpm test extensions/file-transfer/src/node-host/dir-fetch.test.ts --maxWorkers=1.
  • [P1] pnpm test src/infra/fs-safe-import-boundary.test.ts --maxWorkers=1.
  • [P1] node scripts/check-changed.mjs --base 32ba81a -- extensions/file-transfer/src/node-host/dir-fetch.ts extensions/file-transfer/src/node-host/dir-fetch.test.ts.

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • qingminglong: 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-27T13:05:54.794Z sha a6956017ff16c0c1a3928340560d367af15a7cd9 :: blocked before merge. :: [P2] Bound enumeration before reading every child
  • reviewed 2026-09-27T13:16:44.105Z sha a6956017ff16c0c1a3928340560d367af15a7cd9 :: blocked before merge. :: [P2] Bound enumeration before reading every child

@steipete
steipete force-pushed the deslop/l113-file-transfer-sdk-boundary branch from a695601 to b7b8ca2 Compare September 27, 2026 13:22
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Sep 27, 2026
@steipete
steipete merged commit e8b0919 into main Sep 27, 2026
109 checks passed
@steipete
steipete deleted the deslop/l113-file-transfer-sdk-boundary branch September 27, 2026 13:36
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. P2 Normal backlog priority with limited blast radius. plugin: file-transfer rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: XS status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant