Repository navigation
fix(file-transfer): report unreadable directory metadata - #173336
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 SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 22954c5e1c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } catch { | ||
| continue; | ||
| } | ||
| const { size } = await fs.stat(absPath); |
There was a problem hiding this comment.
Settle metadata failures before rethrowing
When fs.stat rejects—the scenario added by this commit—execution leaves both savedTar.path and the extracted rootDir in managed media and exits before either audit call; only the extractArchive catch performs cleanup and records an error. Because this failure returns no paths, repeated failures can accumulate inaccessible 16 MiB archives and up to 64 MiB extracted trees while producing no file-transfer error record. Clean up the post-extraction artifacts and record the error before rethrowing.
AGENTS.md reference: AGENTS.md:L50-L52
Useful? React with 👍 / 👎.
|
Codex review: needs changes before merge. What this changesMake directory downloads fail when saved-file metadata cannot be read instead of returning an incomplete successful manifest. Example: An extracted ok.txt contains "saved", but reading its metadata fails with EIO.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 1 item remains Keep this PR open: it fixes a current silent failure, but the newly propagated metadata error bypasses artifact cleanup and transfer-error recording. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherThe File Transfer plugin receives an authorized node archive, saves and extracts it in Gateway media storage, then builds the manifest and attachments returned to the agent. flowchart LR
A[Agent directory request] --> B[Authorized node invocation]
B --> C[Archive payload]
C --> D[Gateway media extraction]
D --> E[Metadata and hashes]
E --> F[Manifest and attachments]
E --> G[Transfer audit]
Technical reviewBest possible solution: Propagate metadata failures after best-effort removal of the failed transfer's artifacts and recording its error outcome. Do we have a high-confidence way to reproduce the issue? Current-main source deterministically skips a walked file when stat rejects; the added regression exercises that condition with EIO, and the body reports its baseline failure and fixed pass, which this read-only review did not rerun. Is this the best way to solve the issue? Removing the swallowing catch addresses the silent incomplete manifest directly, but failure settlement must cover the new rejection path. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 0c5d6813cfa9. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceSource -6, Tests +23, Docs +3. Total +20 across 3 files. Added test files: 0. View PR surface stats
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 15, 2026, 1:48 PM ET / 17:48 UTC. |
…3336) ## What Problem This Solves `dir_fetch` silently skipped saved files when reading their metadata failed, then returned a successful incomplete manifest and recorded an allowed outcome. A real tool-boundary regression reproduces this: an extracted `ok.txt` whose `stat` fails is reported as “Fetched 0 files.” ## User Impact User impact: directory downloads now fail visibly if saved-file metadata cannot be read, instead of reporting a successful incomplete download. Successful downloads are unchanged; no migration or configuration change is needed. ## Why This Change Was Made Propagate metadata read failures instead of skipping the file. Keep archive extraction, path/policy authorization, size limits, hashing, attachment ordering and the existing successful manifest shape unchanged. Document the visible failure behavior and add one regression to the existing archive suite. ## Best-effort tradeoffs accepted - A saved file removed or made unreadable before manifest construction now makes the tool fail visibly rather than returning a partial success. The swallowing catch dates to `535fb87d1c7` (openclaw#74742); no human report requiring partial-success behavior was identified. This repairs a reproduced silent failure, not a speculative concurrency mechanism. ## Net LOC Production: 6 net lines removed (+1/-7). Tests: 23 added. Documentation: 3 added. This is a bug-fix exemption, not a qualifying large cleanup PR. ## Evidence - Baseline: new tool-boundary regression fails for the intended reason, returning success with `fileCount: 0` instead of rejecting the injected metadata error. - Fixed: all 18 `dir-fetch-tool.test.ts` cases pass, including archive path/link/collision/expansion protections. Wrapper wall time 161.12 seconds; test-file wall time 138.79 seconds on the loaded shared host. Hosted CI timing pending. - Lint-suppression suite: 3/3 pass; no new suppressions. - Fresh independent review of the exact production/test patch: no accepted P0–P2 findings. Documentation adds only the corresponding failure description. - Source-mapped typecheck of the changed production graph passes. The secondary checkout's package-boundary type/lint attempts correctly refused its shared dependency links; source-mapped proof ran in the owning dependency checkout with the same tool implementation. - Runtime cycles: 0; Madge cycles: 0. Formatting passes on all three files; diff whitespace check passes. - Changed-file checks passed conflict markers, line-cap growth and assertion safety. They found stale max-lines baseline entries for two unchanged core test files, then remained capacity-bound in the repo-wide SQLite ratchet. Targeted lint reached the existing 300-second SDK declaration-preparation deadline before lint execution. These are local proof gaps, not claims of green or inherited CI. Exact-head hosted CI is the broad gate. All runtime proof used task-owned HOME, OpenClaw state/config and XDG directories. No real Gateway/state or remote runner was used.
What Problem This Solves
dir_fetchsilently skipped saved files when reading their metadata failed, then returned a successful incomplete manifest and recorded an allowed outcome. A real tool-boundary regression reproduces this: an extractedok.txtwhosestatfails is reported as “Fetched 0 files.”User Impact
User impact: directory downloads now fail visibly if saved-file metadata cannot be read, instead of reporting a successful incomplete download. Successful downloads are unchanged; no migration or configuration change is needed.
Why This Change Was Made
Propagate metadata read failures instead of skipping the file. Keep archive extraction, path/policy authorization, size limits, hashing, attachment ordering and the existing successful manifest shape unchanged. Document the visible failure behavior and add one regression to the existing archive suite.
Best-effort tradeoffs accepted
0603c2327d3(fix(file-transfer): require canonical node policy authorization #74742); no human report requiring partial-success behavior was identified. This repairs a reproduced silent failure, not a speculative concurrency mechanism.Net LOC
Production: 6 net lines removed (+1/-7). Tests: 23 added. Documentation: 3 added. This is a bug-fix exemption, not a qualifying large cleanup PR.
Evidence
fileCount: 0instead of rejecting the injected metadata error.dir-fetch-tool.test.tscases pass, including archive path/link/collision/expansion protections. Wrapper wall time 161.12 seconds; test-file wall time 138.79 seconds on the loaded shared host. Hosted CI timing pending.All runtime proof used task-owned HOME, OpenClaw state/config and XDG directories. No real Gateway/state or remote runner was used.