Skip to content

fix: spawned child prompt omits staged attachment file paths - #123676

Merged
obviyus merged 8 commits into
openclaw:mainfrom
felirami:cursor/subagent-attachment-file-paths-8a8e
Aug 20, 2026
Merged

obviyus merged 8 commits into
openclaw:mainfrom
felirami:cursor/subagent-attachment-file-paths-8a8e

Conversation

@felirami

@felirami felirami commented Aug 14, 2026 •

Copy link
Copy Markdown
Contributor

Related to #123583. Native sessions_spawn snapshot staging only; inbound channel attachment resolution is unchanged.

What Problem This Solves

A native child received only the attachment staging directory. File-only tools then used that directory and returned “not a file” even though the requested file had already been staged inside it.

Why This Change Was Made

The staging owner now emits every validated workspace-relative file path as bounded untrusted-text in the child system prompt. The obsolete bare-directory instruction is removed, so the prompt has one canonical tool argument.

Prompt integrity remains at the producer boundary:

  • Native prompted filenames reject Cc/Cf/line separators and </>, which the prompt wrapper cannot preserve losslessly.
  • ACP image attachments keep their existing filename behavior because ACP forwards bytes and never prompts or stages the name.
  • Instruction-shaped filenames remain inside an untrusted-data block.
  • The complete wrapped block is capped at 4096 characters and rejected rather than truncated.
  • Ampersands remain lossless.
  • attachAs.mountPath stays outside the untrusted block.

Exact paths intentionally repeat the UUID directory. At maxFiles=50, measured render cost is 21.1µs/spawn and roughly 1.4K–2.5K tokens. This cost avoids another model round trip and avoids asking the model to reconstruct file-tool arguments.

No directory-to-file fallback was added.

User Impact

Delegated native agents receive the exact staged file path accepted by image/media tools. Unsafe or over-budget path lists fail visibly at spawn. ACP behavior is unchanged.

Evidence

Exact pushed head: a4040009698d300622536f59b9ba5de031b28c4f.

Owner path: spawnSubagentDirect → materializeSubagentAttachments → bounded path block → child Gateway agent request.

Regression test: src/agents/subagents/spawn/subagent-spawn.attachments.test.ts proves the staged regular file and exact child prompt path, while rejecting the old bare-directory wording. It fails on pre-fix main because the exact file path is absent.

Codex contract checked at openai/codex@4642370542739d5dd080b0c87a9de06a6435d3db: codex-rs/core/src/tools/handlers/view_image.rs:143-168 resolves the supplied path against cwd, checks metadata, and rejects directories before reading bytes; codex-rs/core/tests/suite/view_image.rs:1118-1182 covers that directory failure.

Before-fix real Telegram proof on main: the child reported CHILD_DIRECTORY_ONLY_123676; the captured prompt contained only .openclaw/attachments/{uuid} and omitted receipt.jpg.

Local proof on the exact head:

node scripts/run-vitest.mjs src/agents/subagents/spawn/subagent-spawn.attachments.test.ts src/agents/sanitize-for-prompt.test.ts src/agents/tools/sessions-spawn-tool.test.ts
→ 3 files passed; 150 tests passed

node_modules/.bin/oxfmt --check <six changed files>
node scripts/run-oxlint.mjs <six changed files>
pnpm tsgo
pnpm check:test-types
pnpm deadcode:exports
node scripts/check-changed.mjs
git diff --check origin/main...HEAD
→ all passed

Distill removed the test-only production export, duplicate cap case, cross-owner media assertions, repeated prompt extraction, and obsolete directory prompt. Greybeard found no CPU/allocation issue and corrected the prompt-budget claim.

LOC versus current-main merge base: production +61/−28; tests +182/−0. Positive production LOC is the exact-path capability, bounded prompt owner, and shared control-character predicate; no fallback or compatibility path was added.

Final gates on the same exact head:

  • Local ClawSweeper (gpt-5.6-terra, high): patch correct; 0 findings; security cleared with 0 concerns; no maintainer decision; 0 Rank-up moves.
  • Telegram real-user DM (spawn-attachment-path): sent Test native child attachment staging. (recorded Bot API message 14). Parent Code Mode called openclaw:core:sessions_spawn with inline receipt.png and returned accepted. The child prompt contained .openclaw/attachments/{uuid}/receipt.png; child view_image used that exact path and returned input_image content. Telegram observed SPAWN_ATTACHMENT_ACCEPTED (message 1609) then the child completion SPAWN_ATTACHMENT_PATH_OK (message 1610). No Local media path is not a file appeared. Recorded timeline: 4 messages, 2 typing events, 1 cleanup deletion. Evidence: /tmp/telegram-e2e-pr123676-final.jT2Mv5/spawn-attachment-paths/.

sessions_spawn already writes named files, but the child system prompt
only named the staging directory. File-consuming tools then failed with
"Local media path is not a file".

Closes openclaw#123583
@clawsweeper

clawsweeper Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: XS labels Aug 14, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 37e4c69a49

ℹ️ 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".

@clawsweeper clawsweeper Bot added merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 14, 2026
@clawsweeper

clawsweeper Bot commented Aug 14, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 20, 2026, 5:24 AM ET / 09:24 UTC.

ClawSweeper review

What this changes

The PR makes native sessions_spawn child prompts list each staged attachment file path as bounded untrusted data instead of naming only the containing directory.

Regression provenance

Possible regression — probable (reproduction; reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

The patch correctly repairs the native spawned-agent path handoff, but merging it intentionally makes oversized otherwise-valid attachment batches fail; that compatibility change needs maintainer acceptance before merge.

Priority: P1
Reviewed head: a4040009698d300622536f59b9ba5de031b28c4f
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) The repair is well-scoped, covered at the spawn boundary, and backed by credible real-flow proof; only the explicit compatibility choice remains.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (logs): The PR body provides exact-head after-fix Telegram/Gateway evidence that the child received and used the staged file path, with an observed successful completion.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (logs): The PR body provides exact-head after-fix Telegram/Gateway evidence that the child received and used the staged file path, with an observed successful completion.
Evidence reviewed 8 items Current-main failure path: Current main writes files but tells the child only the staging directory, not an individual file path.
Owner-boundary repair: The PR validates native names and renders the complete staged file list before writing files, then supplies that block as the child prompt suffix.
Caller and launch boundary: The spawn owner appends the materializer suffix, and the launch request forwards it as the child agent request's extra system prompt.
Findings None None.
Security None None.

Live Verification

Command: pnpm openclaw --help

Result: PASS (completed)

pnpm openclaw --help
runner@runnervm76f27:/tmp/clawsweeper-live-proof-123676-0VBCqO/target$ pnpm openclaw --help
$ node scripts/run-node.mjs --help
pnpm openclaw --help
[openclaw] Building TypeScript (dist is stale: missing_build_stamp - build stamp missing).
[openclaw] Building bundled plugin assets.
[canvas] build: node scripts/bundle-a2ui.mjs
[log] ‹DIR›/a2ui.bundle.js  chunk │ size: 399.96 kB
[log] ‹DIR›/a2ui-v0.9.bundle.js  chunk │ size: 615.66 kB
[log]
[success] rolldown v1.2.0 Finished in 107.00 ms
[diffs] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts curated
[diffs-language-pack] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts full
[discord] build: node --import tsx ../../scripts/build-discord-activity-sdk.mts
[tsdown-build] invocation 1/2 finished in 0.7s
node_modules/web-tree-sitter/web-tree-sitter.js (2343:30) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2343:31 ]
      │
 2343 │           ASM_CONSTS[start] = eval(func);
      │                               ──┬─
      │                                 ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2366:32) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2366:33 ]
      │
 2366 │           moduleExports[name] = eval(func);
      │                                 ──┬─
      │                                   ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

node_modules/playwright-core/lib/coreBundle.js (65821:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65821:29 ]
       │
 65821 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/playwright-core/lib/coreBundle.js (65828:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65828:29 ]
       │
 65828 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

[tsdown-build] invocation 2/2 finished in 12.8s
[plugin-control-plane-loads] verified 35 built modules with native require and checked doctor closures
runtime-postbuild: 10 phases completed in 3839ms (slowest: built plugin control-plane loads 3232ms)

OpenClaw 2026.8.1 (a404000) — All your chats, one OpenClaw.

Usage: openclaw [options] [command]

Options:
  --container ‹name›   Run the CLI inside a running Podman/Docker container named ‹name› (default: env OPENCLAW_CONTAINER)
  --dev                Dev profile: isolate state under ~/.openclaw-dev, default gateway port 19001, and shift derived ports (browser/canvas)
  -h, --help           Display help for command
  --log-level ‹level›  Global log level override for file + console
… output truncated …

Assertions:

  • PASS expect_output: Usage:

How this fits together

sessions_spawn snapshots inline attachments into the child workspace before launching a child agent through Gateway. The child prompt guides media tools to those files, which then resolve relative paths against the workspace and read the exact file.

flowchart LR
A[Parent agent calls sessions spawn] --> B[Attachment staging]
B --> C[Validate names and render bounded paths]
C --> D[Child system prompt]
D --> E[Gateway agent request]
E --> F[Media tool reads staged file]
Loading

Decision needed

Question Recommendation
Should native sessions_spawn reject otherwise-valid attachment batches once their complete staged-path prompt block exceeds 4096 characters? Accept the bounded path contract: Merge with the 4096-character rejection so native children always receive exact paths without unbounded prompt growth.

Why: The cap prevents unbounded model-visible context but changes behavior for existing callers that can submit up to 50 long filenames, so code review cannot choose that compatibility tradeoff alone.

Before merge

  • Resolve merge risk (P1) - Native attachment batches whose wrapped path list exceeds 4096 characters will now return attachments_prompt_paths_exceeded even though main previously accepted them under maxFiles; this is an intentional compatibility change.
  • Resolve merge risk (P1) - Production code is net +33 lines for a bug fix; the exact-path prompt, bounded renderer, and shared validation are owner-boundary behavior, and no smaller net-neutral absorption was evident.
Agent review details

Security

None.

PR surface

Source +33, Tests +182. Total +215 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 3 61 28 +33
Tests 3 182 0 +182
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 243 28 +215

Review metrics

Metric Value Why it matters
Production versus test LOC production +61/-28 (net +33); tests +182/-0 The production growth is confined to the attachment producer's exact-path, prompt-boundary, and validation behavior; tests cover the native and ACP split.

Stored data model

Persistent data-model change detected: serialized state: src/agents/tools/sessions-spawn-tool.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Accept the explicit prompt cap (recommended)
    Treat attachments_prompt_paths_exceeded as the supported native outcome for batches beyond the fixed prompt budget.
  2. Define a larger-batch contract first
    Pause this PR if preserving all currently valid 50-file batches requires a different bounded presentation or attachment interface.

Technical review

Best possible solution:

Accept the bounded exact-path list as the native attachment contract only if maintainers accept the explicit oversized-batch failure; keep the materializer as the single producer of both staged files and prompt guidance.

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

Yes—source reproducible: current main emits only the attachment directory, while the media loader resolves the supplied relative path and requires a file; the PR also supplies an after-fix real-flow record.

Is this the best way to solve the issue?

Yes for the defect: the materializer is the only owner that knows the finalized staged filenames, so emitting exact bounded paths there is preferable to a directory-to-file fallback in consumers.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 2ebe24e9b258.

Labels

Label justifications:

  • P1: This repairs a broken spawned-agent attachment workflow that can make the child use a directory where a file is required.
  • merge-risk: 🚨 compatibility: The new fixed prompt budget can reject native attachment batches that current main accepts.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (logs): The PR body provides exact-head after-fix Telegram/Gateway evidence that the child received and used the staged file path, with an observed successful completion.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides exact-head after-fix Telegram/Gateway evidence that the child received and used the staged file path, with an observed successful completion.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Current-main blame assigns the validation and materialization boundary to this authored baseline commit. (role: current-main attachment-path author; confidence: high; commits: a947730c6645; files: src/agents/subagents/spawn/subagent-attachments.ts, src/agents/subagents/spawn/subagent-spawn.ts)

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 (11 earlier review cycles; latest 8 shown)
  • reviewed 2026-08-14T17:33:06.156Z sha 1a04554 :: needs changes before merge. :: [P1] Preserve valid ACP attachment names | [P1] Render attachment names as untrusted prompt data
  • reviewed 2026-08-14T18:00:06.463Z sha 58016db :: needs changes before merge. :: [P0] Cap the escaped staged-path block | [P1] Preserve literal staged paths through prompt encoding
  • reviewed 2026-08-14T18:51:54.005Z sha b74bf2e :: needs changes before merge. :: [P1] Keep ampersand attachment names usable | [P1] Do not echo unsafe filenames in tool results | [P2] Separate the mount hint from the data block
  • reviewed 2026-08-14T19:53:49.088Z sha d9460ac :: needs maintainer review before merge. :: none
  • reviewed 2026-08-15T06:02:48.245Z sha d9460ac :: needs maintainer review before merge. :: none
  • reviewed 2026-08-15T07:30:39.257Z sha d9460ac :: needs changes before merge. :: [P3] Keep the prompt-budget constant private
  • reviewed August 20, 2026, 1:49 AM ET / 05:49 UTC sha unknown :: needs changes before merge. :: [P3] Keep the prompt-budget constant private
  • reviewed 2026-08-20T09:07:22.019Z sha a404000 :: needs maintainer review before merge. :: none

Reject prompt-separator names with the shared prompt-control owner, and
fail batches whose rendered path list exceeds a 4096-char hard cap.
Keep listing exact staged file paths so file tools do not receive a directory.
@felirami

Copy link
Copy Markdown
Contributor Author

Addressed the two code blockers on this head:

  • Rendered attachment path block is now hard-capped at 4096 chars. Oversized batches fail with attachments_prompt_paths_exceeded.
  • Attachment names reuse hasPromptUnsafeControlCharacter (same owner as the mount-path hint), so U+0085 / U+2028 / U+2029 are rejected before render.

Evidence in the PR body now includes a real spawn/materialize/launch prompt plus loadWebMediaRaw on the exact staged path. Gateway RPC client is the only recording fake.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Aug 14, 2026
Reuse sanitizeForPromptLiteral so U+202E and remaining C1 controls fail
before raw path rendering. Keep the 4096-char path-list cap.
@felirami

Copy link
Copy Markdown
Contributor Author

Addressed the remaining P1 on this head:

hasPromptUnsafeControlCharacter now reuses sanitizeForPromptLiteral instead of a second character-class loop. All Unicode Cc and Cf are rejected before raw path rendering, including U+202E and remaining C1 controls. Spawn-boundary tests cover U+202E and U+009B. The 4096-char path-list cap and attachments_prompt_paths_exceeded are unchanged.

Live Gateway child-run proof is still blocked here (no packaged dist, no CLI, no model keys). I did not invent a live trace and I am not calling callGatewayMock live. Evidence in the PR body is updated honestly.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@felirami

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Live after-fix Gateway child-run is now in Evidence. Real local Gateway process, real sessions_spawn via /tools/invoke, child system prompt captured from the Gateway's actual POST /v1/chat/completions to a local stub (not a paid provider). The prompt lists .openclaw/attachments/bafa552a-dc63-4c11-b2bf-483096a50b12/receipt.jpg. Same workspace, loadWebMediaRaw on that path returned kind=image / image/jpeg / 516 bytes. The stub returned a text stop; I did not invent a model file-read completion.

@clawsweeper

clawsweeper Bot commented Aug 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. proof: sufficient ClawSweeper judged the real behavior proof convincing. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 14, 2026
…ted data

ACP only forwards {mediaType,data} and must still accept format-character filenames. Native staging keeps the Cc/Cf check and 4096 path-list cap, and renders staged paths through wrapUntrustedPromptDataBlock.
@felirami

Copy link
Copy Markdown
Contributor Author

Addressed both P1s on this head (58016dbd878):

  • Prompt-safe Cc/Cf name checks are native-only. ACP still forwards {mediaType,data} and accepts a format-character filename.
  • Staged paths are rendered with wrapUntrustedPromptDataBlock. Instruction-shaped names stay inside <untrusted-text>.
  • 4096 path-list cap is unchanged.

Live Gateway proof rerun on this head. Real openclaw gateway run, real sessions_spawn, child prompt captured from the Gateway's actual POST /v1/chat/completions. Excerpt is in Evidence, including the untrusted path block for .openclaw/attachments/0bed498c-c471-4f22-92e8-4b8caeb5acfd/receipt.jpg. loadWebMediaRaw on that path returned kind=image / image/jpeg / 516 bytes. The stub returned a text stop; I did not invent a model file-read completion.

PR scope is sessions_spawn snapshot-by-value staging only. Inbound channel attachment resolution is unchanged.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@felirami

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added the merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. label Aug 14, 2026
…ve names

Measure the wrapped untrusted path block, not raw paths, and reject oversize lists instead of truncating. Native names containing <, >, or & are rejected so the prompted path matches the staged file. ACP still accepts those names because it never renders them.
@felirami

Copy link
Copy Markdown
Contributor Author

Addressed the two wrap blockers on b74bf2e06cc:

  • The 4096 cap now measures the wrapped rendered path block. Oversized lists are rejected, not truncated.
  • Native names with <, >, or & are rejected so the prompted path matches the staged file. ACP still accepts those names.

Live Gateway proof rerun on this head. Real openclaw gateway run, real sessions_spawn, child prompt captured from the Gateway POST /v1/chat/completions. Excerpt is in Evidence for .openclaw/attachments/a934f3fe-977f-41c2-9990-cfcaadbbf2e3/receipt.jpg. loadWebMediaRaw returned kind=image / image/jpeg / 516 bytes. The stub returned a text stop; I did not invent a model file-read completion.

PR body no longer uses Closes #123583. This is native sessions_spawn staging only. Inbound channel attachment resolution is unchanged.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. labels Aug 14, 2026
Native spawn still rejects angle-bracket names that wrapUntrustedPromptDataBlock rewrites. Ampersand names stay staged and prompted as-is. Invalid-name tool errors no longer echo raw Cc/Cf. The optional mountPath hint starts on the line after the untrusted path block.
@felirami

Copy link
Copy Markdown
Contributor Author

Addressed the three leftover findings on d9460ac5db9:

  • Native ampersand names stay usable. Only < and > are rejected. a&b.jpg is staged and prompted as the same path.
  • Cc/Cf invalid-name errors are now the generic attachments_invalid_name code. Raw control characters are not echoed in the tool result.
  • The optional mountPath hint starts on the next line after the untrusted path block.

Live Gateway proof rerun on this head. Real openclaw gateway run, real sessions_spawn with attachAs.mountPath=inputs, child prompt captured from the Gateway POST /v1/chat/completions. Excerpt is in Evidence for .openclaw/attachments/0ed52f54-e54d-475b-9d7a-324a1c08ad4d/receipt.jpg, with the hint on its own line. loadWebMediaRaw returned kind=image / image/jpeg / 516 bytes. The stub returned a text stop; I did not invent a model file-read completion.

PR body still does not use Closes #123583. This is native sessions_spawn staging only.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 14, 2026
@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Aug 20, 2026
@obviyus
obviyus merged commit 9752283 into openclaw:main Aug 20, 2026
262 checks passed
@obviyus

obviyus commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 21, 2026
…w#123676)

* fix: list staged attachment file paths in the child spawn prompt

sessions_spawn already writes named files, but the child system prompt
only named the staging directory. File-consuming tools then failed with
"Local media path is not a file".

Closes openclaw#123583

* fix: bound and sanitize staged attachment paths in the child prompt

Reject prompt-separator names with the shared prompt-control owner, and
fail batches whose rendered path list exceeds a 4096-char hard cap.
Keep listing exact staged file paths so file tools do not receive a directory.

* fix: reject all Cc/Cf attachment names via shared prompt sanitizer

Reuse sanitizeForPromptLiteral so U+202E and remaining C1 controls fail
before raw path rendering. Keep the 4096-char path-list cap.

* fix: scope prompt-safe names to native spawn and wrap paths as untrusted data

ACP only forwards {mediaType,data} and must still accept format-character filenames. Native staging keeps the Cc/Cf check and 4096 path-list cap, and renders staged paths through wrapUntrustedPromptDataBlock.

* fix: cap rendered attachment prompt size and reject non-lossless native names

Measure the wrapped untrusted path block, not raw paths, and reject oversize lists instead of truncating. Native names containing <, >, or & are rejected so the prompted path matches the staged file. ACP still accepts those names because it never renders them.

* fix: keep ampersand names, hide Cc/Cf in errors, separate mount hint

Native spawn still rejects angle-bracket names that wrapUntrustedPromptDataBlock rewrites. Ampersand names stay staged and prompted as-is. Invalid-name tool errors no longer echo raw Cc/Cf. The optional mountPath hint starts on the line after the untrusted path block.

* fix(agents): tighten spawned attachment path prompt

---------

Co-authored-by: felirami <[email protected]>
Co-authored-by: Ayaan Zaidi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants