Repository navigation
fix(file-transfer): directory tools hide filenames from direct model calls - #138542
Conversation
…calls Expose bounded, complete directory records in tool content so direct callers can follow listing pagination and read saved files. Preserve structured details, archive integrity, path authorization, and media selection. Refs #138480.
|
🦞👀 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: blocked before merge. Reviewed September 4, 2026, 3:56 PM ET / 19:56 UTC. ClawSweeper reviewWhat this changesThe PR makes File Transfer directory-list and directory-fetch tools return bounded, actionable filenames and saved-file records in model-visible text while retaining their structured details. Merge readiness⛔ Blocked before merge - 5 items remain Keep open. This is a focused, producer-boundary repair for a shipped direct-tool-result defect; no introduced correctness defect was found. A maintainer must accept the intentional bounded model-context contract before merge. Priority: P1 Review scores
Verification
How this fits togetherFile Transfer tools invoke an authorized paired node through the Gateway and return tool results to the model. The new producer-side projections make the listing and extracted-file manifest visible to direct model result serializers while preserving structured data for programmatic consumers. flowchart LR
A[Model tool call] --> B[File Transfer directory tool]
B --> C[Authorized node operation]
C --> D[Bounded result projection]
D --> E[Direct model result serializer]
D --> F[Structured tool details]
E --> G[Model follow-up action]
F --> H[Programmatic consumers]
Decision needed
Why: Source proves a shipped usability defect and a bounded repair, but accepting the model-context tradeoff for existing integrations is a product and compatibility choice. Before merge
Agent review detailsSecurityNone. PR surfaceSource +101, Tests +460, Docs +17. Total +578 across 6 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: 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: Keep the two bounded producer-local projections because listing pagination and fetched manifests need distinct complete record shapes; merge once a maintainer accepts the explicit context-budget contract. Do we have a high-confidence way to reproduce the issue? Yes, from source and the PR's deterministic content-only harness: current producers place names only in details while direct serializers consume explicit content; this read-only review did not execute the harness. Is this the best way to solve the issue? Yes, subject to maintainer acceptance of the bounded context contract: projecting complete, sanitized records at the producing tools fixes the information loss without changing provider serializers, media trust, or configuration. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against c4b91f5c7052. LabelsLabel changes:
Label justifications:
EvidenceAcceptance criteria:
What I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
Maintainer disposition and land-ready proofAddressing the maintainer items in the updated ClawSweeper review, including its explicit context-budget decision, for head
Source: listing owner, fetch owner, and model-content versus details contract. The before/after runtime comparison independently verified every normalized structured file record and the full media sequence as identical. Exact-head CI: run 33910730253, attempt 1 completed successfully, and Local and runtime proof: the original content-only assertions failed before repair (2 failed / 36 passed); the final directory suite passed 55/55. The broader owner/Tool Search/Code Mode/Codex/shared-result run passed 542 tests with 2 Linux-only skips. The complete changed gate and build passed. Fresh isolated pre-land Codex autoreview of this committed head returned scoped-clean with zero P0–P2 findings and no filtering. node scripts/run-vitest.mjs extensions/file-transfer/src/tools/dir-list-tool.test.ts extensions/file-transfer/src/tools/dir-fetch-tool.test.tsnode scripts/check-changed.mjs -- docs/nodes/index.md extensions/file-transfer/src/tools/descriptors.ts extensions/file-transfer/src/tools/dir-list-tool.ts extensions/file-transfer/src/tools/dir-fetch-tool.ts extensions/file-transfer/src/tools/dir-list-tool.test.ts extensions/file-transfer/src/tools/dir-fetch-tool.test.tspnpm buildThe accepted built-Gateway/native-node comparison used the same independent content-only consumer: 0 → 240 discoverable names, 0 → 85 local reads, maximum 8163 UTF-8 bytes, with all 442 saved archive members per variant and raw details/media preserved. The parent independently verified the retained raw responses, archives and controller observations. Full commands, scope, source identities, and initial harness failures are recorded in the PR body. Known limits remain explicit: no live model/provider/channel/UI or Windows run, no continuous syscall trace, and no physical 5000-file fixture (full-size sequences are unit proof). Native AppleDouble/PAX behavior and the unrelated Control UI build-size advisory remain separate follow-ups; no limits, policies or baselines were relaxed. Operator docs: https://docs.openclaw.ai/nodes#agent-file-transfers No source changes were needed after the review. Proceeding through the repository-native prepare/merge gates, not bypassing them. |
|
Merged via squash.
|
…calls (openclaw#138542) Expose bounded, complete directory records in tool content so direct callers can follow listing pagination and read saved files. Preserve structured details, archive integrity, path authorization, and media selection. Refs openclaw#138480.
…138427) Fixes #138383. ## What Problem This Solves `dir_fetch` saved files fetched from a paired node, but the embedded runner and Codex bridge discarded their local attachment paths. The final reply contained no files. The earlier misleading directory summary was already removed by #138542. ## Why This Change Was Made Carry the existing concrete tool metadata into both reply pipelines. Keep core tool behavior, exact registered names, filesystem grants, private-media rejection, and MCP filtering. An unmarked plugin cannot gain trust by reusing a core name or setting a public result flag; the special TTS path uses the existing private core result provenance and its original URLs. Complete delivery through the existing host-selected path: suppress final text already sent as the same assistant message's file caption, append UI media supplements without recreating runtime-owned text, and read image downloads through the existing authenticated media route without relaxing the browser policy. ## User Impact Permitted files arrive with the final reply, up to the existing 25-file selection limit. The complete saved inventory remains available. No schema, configuration option, protocol, dependency, or direct adapter-send path is added. ## Evidence - Real embedded Control UI and Telegram Test Server baseline: successful paired-node fetch, zero final attachments. - Real Codex app-server baseline: 26 fetched files, zero final attachments. - Repaired native Codex flow: one caption and 25 final attachments from 26 files; image and document downloads match the source bytes, and attachments survive history refresh. - Real unmarked plugin calls succeed while local attachments remain blocked. An ungranted directory returns `POLICY_DENIED`. Core aliases, HTTP media, MCP provenance, private results, and TTS provenance also have focused owner-boundary coverage. - Telegram delivers one captioned photo and one document; the document matches the original bytes. Owned test messages and credential leases were cleaned up. - Focused integration, delivery, trust, and browser-policy checks plus the matching runtime/UI build passed on an isolated native runner. Independent source-blind acceptance passed both native and embedded public flows: final attachments, 25-file selection, all 26 saved-file hashes, image/document downloads, history refresh, and actual unmarked-plugin rejection. Baseline and Telegram results above are separate retained proof. Exact-head hosted checks and final review are required before landing. This preserves the implementation from @NianJiuZst and includes useful regression coverage offered by @igs-rogenlo in #144609. The two-runtime scope is retained; the older wording-only alternative is not reopened. Co-authored-by: igs-rogenlo <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]>
…penclaw#138427) Fixes openclaw#138383. ## What Problem This Solves `dir_fetch` saved files fetched from a paired node, but the embedded runner and Codex bridge discarded their local attachment paths. The final reply contained no files. The earlier misleading directory summary was already removed by openclaw#138542. ## Why This Change Was Made Carry the existing concrete tool metadata into both reply pipelines. Keep core tool behavior, exact registered names, filesystem grants, private-media rejection, and MCP filtering. An unmarked plugin cannot gain trust by reusing a core name or setting a public result flag; the special TTS path uses the existing private core result provenance and its original URLs. Complete delivery through the existing host-selected path: suppress final text already sent as the same assistant message's file caption, append UI media supplements without recreating runtime-owned text, and read image downloads through the existing authenticated media route without relaxing the browser policy. ## User Impact Permitted files arrive with the final reply, up to the existing 25-file selection limit. The complete saved inventory remains available. No schema, configuration option, protocol, dependency, or direct adapter-send path is added. ## Evidence - Real embedded Control UI and Telegram Test Server baseline: successful paired-node fetch, zero final attachments. - Real Codex app-server baseline: 26 fetched files, zero final attachments. - Repaired native Codex flow: one caption and 25 final attachments from 26 files; image and document downloads match the source bytes, and attachments survive history refresh. - Real unmarked plugin calls succeed while local attachments remain blocked. An ungranted directory returns `POLICY_DENIED`. Core aliases, HTTP media, MCP provenance, private results, and TTS provenance also have focused owner-boundary coverage. - Telegram delivers one captioned photo and one document; the document matches the original bytes. Owned test messages and credential leases were cleaned up. - Focused integration, delivery, trust, and browser-policy checks plus the matching runtime/UI build passed on an isolated native runner. Independent source-blind acceptance passed both native and embedded public flows: final attachments, 25-file selection, all 26 saved-file hashes, image/document downloads, history refresh, and actual unmarked-plugin rejection. Baseline and Telegram results above are separate retained proof. Exact-head hosted checks and final review are required before landing. This preserves the implementation from @NianJiuZst and includes useful regression coverage offered by @igs-rogenlo in openclaw#144609. The two-runtime scope is retained; the older wording-only alternative is not reopened. Co-authored-by: igs-rogenlo <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]>
Closes #138480
Related: #137213 (File Fetch saved-media receipt and standalone-tool guidance).
Additional instructions
MUST: Keep Allow edits from maintainers enabled for this PR so maintainers can help update the branch when needed.
What Problem This Solves
Fixes an issue where users asking an agent to inspect or fetch a paired-node directory would receive a successful operation but no usable filenames when the model used direct/traditional tool calls.
dir_listexposed only counts and a page token.dir_fetchexposed only the saved root/count and sometimes directed the model to a manifest it could not see.Why This Change Was Made
Repair the File Transfer producers, not provider serializers: return a whole-record prefix within an 8192-byte UTF-8 budget that includes security wrapping, with listing continuation immediately after the last displayed entry and explicit saved-manifest omissions for fetches. Preserve the full structured result, original node pagination, media metadata and selection, filesystem/path authorization, archive validation, integrity checks, and cleanup; Tool Search raw
tool_calland Code Mode deliberately use structured details and keep their existing contracts.User Impact
Direct tool callers can discover remote names, distinguish files from directories, and use saved
rootDirplusrelPathfor local follow-up work. Listing text may be shorter than the node's returned page; its own continuation token prevents hidden rows from being skipped. Requests retain the existing default of 200 entries and hard maximum of 5000. Fetching still saves the entire accepted tree and has no pagination; omitted text records remain inspectable under the saved root.The 8 KiB ceiling deliberately allows a useful group of exact, variable-length filesystem names plus the security wrapper, while preventing a 5000-record context burst. It is an internal display budget, not a new setting; the ordinary captured outputs are approximately 1–1.3 KiB. Every emitted path record is complete and unchanged by security wrapping. Oversized or reserved-marker paths produce explicit bounded omission/no-progress guidance instead of a fake usable pathname. No SDK/production export, dependency, config/env option, schema, or timeout change is introduced. Channel-delivery behavior is unchanged; this does not claim to repair the separate delivery concern in #138383.
Operator documentation: https://docs.openclaw.ai/nodes#agent-file-transfers
Evidence
Fail-first and boundary tests
The original two-file suite passed 38 tests. Adding content-only filename assertions to those existing tests, before changing production owners, produced 2 failing tests and 36 passing: listing content lacked
report.txt/nested, and fetch content lackedok.txt/.root-notedespite successful extraction. The repaired final suite passed 55/55.A broader owner/sibling run passed 542 tests, with 2 Linux-only skips on macOS. It covered the complete File Transfer suite, raw Tool Search nested details, Code Mode guest/output contracts, shared result text, and Codex dynamic-tool handling. The final directory-only rerun followed test typing/lint cleanup; production bytes were unchanged.
Coverage includes actual canonical filesystem listing and real archive extraction; text-only continuation/file reads; more than 200 real directory entries; five 5000-entry synthetic sequences exhausted without skipped/duplicated names; strict token parsing; final and empty pages; Unicode, quoted/newline and long names; complete-record byte bounds; unrepresentable paths; all saved files; image-first media selection; and the existing archive/security rejection paths.
Exact small synthetic outputs measured 1030 bytes for the two-entry listing and 1321 bytes for the four-file fetch, including wrappers. The latter exposed hidden and nested saved files and supported byte-verified local reads from content alone.
Checks, build, and independent review
The complete changed gate passed, including production/test typechecks, formatting, lint, doctor-contract tests, package/architecture guards, zero-finding dead-export scans and zero runtime import cycles.
pnpm docs:list,git diff --check, andpnpm buildpassed using Node 24.20.0 and repository-pinned pnpm 12.1.0. Fresh isolated Codex autoreview of the complete six-file candidate and full owner/caller/sibling/dependency datasets returned scoped-clean with zero P0–P2 findings and no filtering. No review isolation or credential-scanning control was bypassed.Initial tooling failures were resolved without changing dependency policy: use the cached exact pnpm version and install the unchanged lockfile in the isolated worktree. Earlier type/lint checks caught two unknown mock-argument reads, an unnecessary escape and a loop-form violation; the tests now use runtime record validation and asserted pagination progress. No suppression, baseline, limit or timeout was relaxed.
The build retained four dependency direct-eval warnings, two Node-path browser externalizations and a plugin-timing diagnostic; no ineffective dynamic import appeared. It also reported a Control UI startup-size advisory (350405 gzip bytes versus 350141 threshold), not a failed build. Baseline attribution is a separate follow-up; this is not a warning-free build or
ui:check-performancepass claim. Existing fs-safe Unicode/newline PAX restrictions remain unchanged and are tracked separately; the Unicode archive projection fixture uses the supported short USTAR format.Runtime integration proof
Accepted before/after proof: a built Gateway handled real HTTP
tools/invokecalls and WebSocket node transport through the public File Transfer handlers. The same separate deterministic controller received onlycontent, neverdetails, fixture inventory, raw media, a before/after label, or verifier feedback. The baseline compiled the exact pre-fix owner/descriptor sources and changed only the two executed owner bundles in a 41,262-entry runtime inventory; all Gateway, node, archive, policy and media helpers were identical. This is an isolated producer comparison, not a full historical-release install.The candidate exhausted its real 240-entry listing in 78/77/77/8 displayed entries. Text tokens were 78 → 155 → 232 → exhausted; the first raw result still contained 200 entries and token
200. A separate maximum request forwardedmaxEntries:5000through both node phases but used the same 240-entry physical fixture; the five full 5000-entry sequences are unit proof, not a claimed live 5000-file fixture.Small/large fetches preserved 11/431 complete saved files and 11/25 media URLs; content exposed 11/74 complete records, with 357 explicit omissions in the large result. Native macOS tar adds AppleDouble members: the original source counts were 4/214, all preserved byte-for-byte. The verifier checked actual archive membership, every saved member, all normalized details, all controller-read hashes, metadata headers/counterparts, and the exact image-first media order. No metadata was hidden, filtered, or suppressed. Original source files, not only metadata, were read using content paths. The parent independently reverified the retained raw responses, archives, controller results and all 24 binding-checked node frames.
{"before":{"successfulCalls":5,"discoveredNames":0,"contentOnlyReads":0},"after":{"successfulCalls":7,"discoveredNames":240,"contentOnlyReads":85,"maxContentBytes":8163},"archiveFilesVerifiedPerVariant":442,"normalizedStructuredFilesAndMediaUnchanged":true,"nodeFrames":24,"allFinalFramesBoundToPreflight":true,"operatorStateAccessed":false}Both runs used fresh home/state/config/workspace/cache roots, task-owned
logging.file, normal pairing/path authorization, and distinct loopback ports. Exact task lifecycle-coordinator filenames were declared from the canonical fresh database paths before launch, required absent, and bound to the actual Gateway PID/UID/device/inode; no global directory exception or runtime lock bypass was used. Writable-descriptor snapshots passed at readiness, around each HTTP call, and completion. All owned processes joined, ports were rebound, and temporary roots/credentials were removed. Empty coordinator remnants lacking observed live-FD deletion identity were deliberately retained rather than reclaimed unsafely.Earlier harness attempts remain unaccepted: an omitted log override, over-strict/mistaken descriptor and rollback-journal classification, and a baseline linker error were corrected in task-only proof code. No production guard, timeout, schema, dependency or source file changed to obtain proof. The initial shared default log was not read or cleaned up. Existing macOS metadata behavior has a separate follow-up.
This is built Gateway + real node transport with a deterministic content-only consumer, not a live model/provider/channel/UI test or an adversarial OS sandbox. Descriptor audits are snapshots, not a continuous syscall trace. No UI screenshot or channel-delivery claim is made. The complete local evidence is retained under
.artifacts/file-transfer-content/runtime-proof/attempt07/, including source/runtime hashes andparent-retained-verification.json; proof artifacts and temporary harness code are not product changes.Scope and provenance
Both pre-fix owners were byte-identical in stable
v2026.9.1, the tested source baselinea86a1b505d335ce6b40cb4f9f1af4ece5103f0c5, and inspected maina33604ea1ecab8212865cd225e17511cc0b69cb3. Raw parent-relative history shows the directory owners originally shipped with this content/details split; it was not introduced by the companion File Fetch receipt repair.Production LOC: +118/-17 (net +101). Tests: +482/-22 (net +460). Docs: +17/-0. The growth owns complete-record byte budgeting, exact-path representability, and the different listing/fetch continuation contracts; obsolete count-only summaries and invisible-details guidance are removed. There is no new shared/public production seam or persisted manifest artifact.
Pre-merge review disposition
All distinct maintainer items in ClawSweeper's updated review are addressed without source changes:
JSON.stringifycalls render text in the existingcontent[].textfield. They do not change a database, schema/version, migration, store, configuration or protocol field. Existing stored files, audit writes and raw details/media are unchanged; old transcript records are not rewritten. Before/after runtime verification established identical normalized structured file records and media order, and input schemas/numeric-offset tokens remain compatible.The exact committed head is
5a20e549f08df4f2c6ee20e413f561e7d279aca3. CI run 33910730253, attempt 1 completed successfully and the required CI gate isSUCCESS. Initial Blacksmith runner allocation queued, then resumed; no cancellation, rerun, workflow edit or bypass was needed for that accepted run. A fresh pre-land Codex autoreview of the committed head was scoped-clean with zero P0–P2 findings and no filtering. Native prepare/merge remains the landing owner.