Skip to content

fix(gateway): pass managed inbound PDFs through chat.send - #90115

Merged
vincentkoc merged 2 commits into
openclaw:mainfrom
harjothkhara:fix/chat-send-managed-pdf-passthrough
Jun 15, 2026
Merged

vincentkoc merged 2 commits into
openclaw:mainfrom
harjothkhara:fix/chat-send-managed-pdf-passthrough

Conversation

@harjothkhara

@harjothkhara harjothkhara commented Jun 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #90097.

chat.send offloads large attachments to the managed inbound media store, then for a sandboxed session may copy non-image refs into the sandbox through stageSandboxMedia. That sandbox copy is optional for already-managed inbound PDFs: the managed media directory is host-readable by media understanding, so the gateway can pass the managed path through as MediaPath/MediaPaths without granting locked-down agents broader filesystem access.

This PR keeps the fix scoped to the #90097 gateway path:

  • Falls back to absolute managed inbound PDF paths when sandbox staging throws or is incomplete.
  • Lets trusted managed inbound PDFs above the 5 MB sandbox staging cap pass through instead of being rejected before fallback can run.
  • Keeps the behavior all-or-nothing: every offloaded non-image ref must be a managed inbound application/pdf, or the previous fail-closed path remains.
  • Preserves non-PDF and untrusted oversize rejection as a client-side 4xx; managed buffers are not deleted on the PDF pass-through path.

AI-assisted: this change was prepared with AI assistance. I have reviewed and understand the diff and own it. Happy to share prompt/session detail on request.

Collision check

Direct competing PR checked:

Safety model

Rolling a managed PDF through this path requires both checks:

  • resolveInboundMediaReference(ref.path) accepts the saved path as managed inbound media.
  • ref.mimeType === "application/pdf" for every offloaded non-image ref in the batch.

A single non-managed path, non-PDF mime type, or unresolved media ref keeps the previous delete + failure behavior. The sandboxed agent still receives MediaStaged: true; for the pass-through path, MediaWorkspaceDir is unset so host-side media understanding resolves the absolute managed path instead of treating it as a sandbox-relative file.

Real behavior proof

Behavior addressed: an already-managed inbound PDF send can fail or be rejected before the agent sees it when optional sandbox staging is unavailable, incomplete, or over the 5 MB staging cap (#90097). The fix reaches a managed-PDF fallback inside prestageMediaPathOffloads that passes refs through only when every ref is application/pdf and every path is accepted by the resolveInboundMediaReference managed-inbound trust predicate; anything else stays fail-closed. The two merge-risk flags on this PR (message-delivery and security-boundary) hinge on that path, so the proof drives it two ways at real-filesystem runtime: Leg 1 runs the real prestageMediaPathOffloads end-to-end so the oversize branch actually fires; Leg 2 exercises the trust gate across the boundary cases.

Real environment tested: a real Node v22.19.0 process ran the code committed by this PR against a real on-disk managed media store (OPENCLAW_STATE_DIR pointed at a scratch directory holding a real media/inbound/ tree). Leg 1 drove the real prestageMediaPathOffloads (src/gateway/server-methods/chat.ts) with a host-only sandbox (sandbox.mode: "all", workspaceAccess: "rw" — ensureSandboxWorkspaceForSession resolves a host workspace with no Docker daemon, so the real oversize branch is genuinely reached rather than skipped). Leg 2 drove the managed-PDF gate and the real, already-exported resolveInboundMediaReference predicate against on-disk files: a 6.29 MB managed inbound PDF, a non-PDF, a nested-path PDF, an absolute PDF outside the store, and a symlink inside inbound/ pointing outside it. Nothing was stubbed — the predicate's real path-containment and fs.realpath/symlink checks ran against the real filesystem. Both legs are driven by functions that are module-internal in the committed source; to import them, a throwaway export keyword was added in the worktree and reverted afterward, so the executed function bodies are byte-for-byte the committed code at de87445 and the branch diff stays the shipped 2 files.

Exact steps or command run after this patch: wrote the real media store to disk (<media>/inbound/report.pdf 6.29 MB, a 6.29 MB non-PDF big.bin, archive.zip, sub/nested.pdf, an outside-store evil.pdf, and a link.pdf symlink to it), then ran two harnesses in real Node processes — OPENCLAW_STATE_DIR=<root>/state node --import tsx integration-harness.mjs (Leg 1, drives prestageMediaPathOffloads) and OPENCLAW_STATE_DIR=<root>/state node --import tsx harness.mjs (Leg 2, drives the gate + predicate). Reproducing this requires temporarily re-adding export to prestageMediaPathOffloads and resolveManagedInboundPdfFallback in chat.ts (both are module-internal); the executed bodies are otherwise unchanged from de87445, and every per-ref ACCEPTED/REJECTED decision in Leg 2 can also be reproduced with zero source edits via the already-exported resolveInboundMediaReference.

Evidence after fix (copied live console output from the real Node runs):

Leg 1 — real prestageMediaPathOffloads, host sandbox active, oversize branch fires:

[env] node=v22.19.0  source=de87445b1a (committed branch head)
[env] sandbox mode=all workspaceAccess=rw (host workspace, no Docker)

[case 1] managed inbound PDF <media>/inbound/report.pdf (6291472 bytes > 5 MB cap)
[case 1] RETURNED (no throw):
           paths: ["<media>/inbound/report.pdf"]
           types: ["application/pdf"]
           workspaceDir: undefined (host pass-through, not sandbox-staged)
           => managed-PDF fallback fired; the send proceeds with the managed path

[case 2] managed inbound non-PDF <media>/inbound/big.bin (6291456 bytes > 5 MB cap)
[case 2] REJECTED (4xx): UnsupportedAttachmentError: attachments exceed sandbox staging limit (5242880 bytes): big.bin (6291456 bytes)
           => non-PDF over the cap stays fail-closed; only managed PDFs pass through

Leg 2 — managed-PDF gate + real trust predicate across the boundary cases:

[env] OPENCLAW_STATE_DIR=<root>/state
[env] node=v22.19.0  source=de87445b1a (committed branch head)

=== Case A: managed inbound PDF, 6.29 MB (over the 5 MB sandbox cap) — DELIVERY path
    ref <media>/inbound/report.pdf [application/pdf] -> trust predicate: ACCEPTED (managed inbound)
    resolveManagedInboundPdfFallback -> { paths: [<media>/inbound/report.pdf], types: [application/pdf] }
    => PASS-THROUGH (refs delivered)   [expected pass-through: OK]

=== Case B: non-PDF (zip) sitting in inbound — BOUNDARY
    ref <media>/inbound/archive.zip [application/zip] -> trust predicate: ACCEPTED (managed inbound)
    resolveManagedInboundPdfFallback -> null
    => FAIL-CLOSED (null -> normal rejection)   [expected fail-closed: OK]

=== Case C: mixed: managed PDF + one non-PDF — BOUNDARY (all-or-nothing)
    ref <media>/inbound/report.pdf [application/pdf] -> trust predicate: ACCEPTED (managed inbound)
    ref <media>/inbound/archive.zip [application/zip] -> trust predicate: ACCEPTED (managed inbound)
    resolveManagedInboundPdfFallback -> null
    => FAIL-CLOSED (null -> normal rejection)   [expected fail-closed: OK]

=== Case D: nested path inbound/sub/nested.pdf — BOUNDARY (not a first-level inbound file)
    ref <media>/inbound/sub/nested.pdf [application/pdf] -> trust predicate: REJECTED (not a managed inbound file)
    resolveManagedInboundPdfFallback -> null
    => FAIL-CLOSED (null -> normal rejection)   [expected fail-closed: OK]

=== Case E: absolute PDF outside the inbound store — BOUNDARY
    ref <outside-store>/evil.pdf [application/pdf] -> trust predicate: REJECTED (not a managed inbound file)
    resolveManagedInboundPdfFallback -> null
    => FAIL-CLOSED (null -> normal rejection)   [expected fail-closed: OK]

=== Case F: symlink inbound/link.pdf -> outside target — BOUNDARY (symlink escape)
    ref <media>/inbound/link.pdf [application/pdf] -> trust predicate: REJECTED (not a managed inbound file)
    resolveManagedInboundPdfFallback -> null
    => FAIL-CLOSED (null -> normal rejection)   [expected fail-closed: OK]

[summary] 6/6 cases matched expectation

Observed result after fix: Leg 1 confirms the real call site — with a host sandbox resolved (so the oversize branch is reached, not skipped by the no-sandbox early return), the 6.29 MB managed inbound PDF returns the fallback { paths: [managed path], types: ["application/pdf"] } with workspaceDir: undefined. That undefined uniquely identifies the managed-PDF fallback firing rather than the staging path (the post-staging return always sets a workspace dir), so the send proceeds with the PDF delivered. The 6.29 MB non-PDF over the same cap throws the real UnsupportedAttachmentError ("attachments exceed sandbox staging limit") as a client-side 4xx — fail-closed. Leg 2 confirms the trust gate across the boundary: the managed PDF (Case A) is delivered, and a non-PDF in inbound (B), a mixed batch (C), a nested-path PDF (D), an absolute PDF outside the store (E), and a symlink inside inbound pointing outside it (F) all resolve to null, keeping the prior delete-and-reject path. Case F is the key security-boundary check — a managed-looking path that resolves outside inbound/ via a symlink is rejected, so the pass-through cannot be used to read host files outside the managed store.

What was not tested: the live oversize branch was driven above; the staging-throw and incomplete-staging branches that also route into the fallback were not driven against a live stageSandboxMedia here (no containerized Docker sandbox runtime is available) and remain covered by the existing gateway regression suite listed under Regression coverage. The final announce transport hop over a real external channel was likewise not exercised.

Supplemental checks

  • node scripts/run-vitest.mjs src/gateway/server-methods/chat.directive-tags.test.ts → 2 files, 214 cases green (gateway suite, supplemental).
  • node scripts/run-tsgo.mjs -p tsconfig.core.json and -p test/tsconfig/tsconfig.test.src.json → clean.
  • node scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.core.json src/gateway/server-methods/chat.ts src/gateway/server-methods/chat.directive-tags.test.ts → clean.
  • node_modules/.bin/oxfmt --check --threads=1 src/gateway/server-methods/chat.ts src/gateway/server-methods/chat.directive-tags.test.ts → clean.
  • git diff --check → clean.

Regression coverage

  • src/gateway/server-methods/chat.directive-tags.test.ts: fallback on incomplete sandbox staging.
  • src/gateway/server-methods/chat.directive-tags.test.ts: fallback on sandbox staging throw.
  • src/gateway/server-methods/chat.directive-tags.test.ts: 6 MB managed inbound PDF passes through instead of hitting the staging cap rejection.
  • src/gateway/server-methods/chat.directive-tags.test.ts: mixed PDF + non-PDF managed batch still fails closed and deletes media buffers.
  • src/gateway/server-methods/chat.directive-tags.test.ts: 6 MB non-PDF still returns a 4xx sandbox staging limit error.

Files

  • src/gateway/server-methods/chat.ts — managed-inbound-PDF fallback in prestageMediaPathOffloads, now reached before sandbox-size rejection.
  • src/gateway/server-methods/chat.directive-tags.test.ts — focused chat.send regression coverage for fallback, oversize pass-through, and fail-closed cases.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui gateway Gateway runtime size: M proof: supplied External PR includes structured after-fix real behavior proof. labels Jun 4, 2026
@clawsweeper

clawsweeper Bot commented Jun 4, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed June 14, 2026, 5:56 PM ET / 21:56 UTC.

Summary
This PR changes gateway chat.send media prestaging so managed inbound PDF offloads can pass through when sandbox staging fails, is incomplete, or hits the staging size cap, and adds focused regression coverage.

PR surface: Source +49, Tests +220. Total +269 across 2 files.

Reproducibility: yes. at source level: current main rejects sandboxed offloads over the 5 MB staging cap and deletes/fails on throwing or incomplete staging before managed inbound PDFs can proceed. I did not execute the runtime path because this review is read-only.

Review metrics: 1 noteworthy metric.

  • Fallback decision points: 3 added. Oversize, staging throw, and incomplete staging now all invoke the managed-PDF pass-through decision, which is the merge-sensitive delivery and boundary behavior to prove.

Merge readiness
Overall: 🦪 silver shellfish
Proof: 🦪 silver shellfish
Patch quality: 🐚 platinum hermit
Result: blocked until stronger real behavior proof is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

Proof guidance:

  • [P1] Needs stronger real behavior proof before merge: The PR body supplies copied terminal output from real-filesystem harnesses for the internal fallback and trust predicate, but it does not show a full after-fix gateway chat.send run for the user path; ask for redacted logs/terminal output or a maintainer waiver. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Risk before merge

  • [P1] The supplied proof uses terminal harnesses around module-internal functions with a temporary export, not a full after-fix gateway chat.send run through the user path.
  • [P1] Merging this changes a sandbox staging failure/rejection path into host-side managed-PDF pass-through, so maintainers need confidence that delivery and fail-closed trust boundaries hold in the actual gateway runtime.
  • [P1] The open maintainer PR at fix(media): extract large managed inbound PDFs via media-understanding #92220 overlaps the same issue with a broader extraction-limit fix, so landing both without coordination could duplicate or conflict in the pass-through logic.

Maintainer options:

  1. Require full gateway proof (recommended)
    Ask for redacted terminal or runtime-log proof from a real gateway chat.send run that shows managed-PDF pass-through plus one non-PDF or untrusted-path fail-closed case.
  2. Accept the narrower harness proof
    Maintainers can intentionally accept the current real-filesystem function-level proof, but that owns the remaining runtime-path uncertainty.
  3. Use the maintainer PR instead
    Pause or close this PR only if maintainers decide fix(media): extract large managed inbound PDFs via media-understanding #92220 is the canonical path and its proof/review gaps are resolved.

Next step before merge

  • [P1] Human maintainer review is needed for proof sufficiency and coordination with the overlapping maintainer PR; no narrow automated code repair is identified.

Security
Cleared: No supply-chain, dependency, workflow, or secret-handling changes are present; the sandbox trust-boundary concern is captured as merge risk.

Review details

Best possible solution:

Choose one canonical fix path: land this focused gateway fallback after full redacted chat.send proof, or route the issue through the broader maintainer PR if maintainers want extraction-limit changes in the same landing branch.

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

Yes at source level: current main rejects sandboxed offloads over the 5 MB staging cap and deletes/fails on throwing or incomplete staging before managed inbound PDFs can proceed. I did not execute the runtime path because this review is read-only.

Is this the best way to solve the issue?

Yes for the narrow chat.send delivery bug: the PR reuses the existing managed-inbound predicate and keeps the pass-through all-or-nothing instead of broadening filesystem access. It still needs maintainer choice against the overlapping broader PR and stronger runtime proof before merge.

AGENTS.md: found and applied where relevant.

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

Label changes

Label justifications:

  • P2: This is a normal-priority gateway attachment delivery bugfix with limited files touched but real impact for managed PDF sends.
  • merge-risk: 🚨 message-delivery: The diff decides whether managed PDF offloads reach the agent or fail before dispatch when sandbox staging cannot copy them.
  • merge-risk: 🚨 security-boundary: The diff intentionally bypasses sandbox copying for a narrow managed-PDF case and relies on the managed inbound trust predicate plus host media roots.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The PR body supplies copied terminal output from real-filesystem harnesses for the internal fallback and trust predicate, but it does not show a full after-fix gateway chat.send run for the user path; ask for redacted logs/terminal output or a maintainer waiver. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed

PR surface:

Source +49, Tests +220. Total +269 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 57 8 +49
Tests 1 224 4 +220
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 281 12 +269

What I checked:

  • repository-policy: Read the full root AGENTS.md plus scoped gateway and server-methods AGENTS.md; their proof, gateway hot-path, and security-boundary review guidance applies to this PR. (AGENTS.md:1, f1b8827d20c8)
  • current-main-failure-path: Current main rejects sandboxed offloads above the 5 MB staging cap and deletes/fails offloaded media on staging errors or incomplete staging before dispatch. (src/gateway/server-methods/chat.ts:1375, f1b8827d20c8)
  • pr-merge-result: The GitHub merge ref adds resolveManagedInboundPdfFallback and routes oversize, staging-throw, and incomplete-staging branches through it before failing closed. (src/gateway/server-methods/chat.ts:1356, de87445b1afc)
  • managed-inbound-trust-contract: The fallback reuses resolveInboundMediaReference, whose current implementation accepts canonical inbound refs or first-level inbound media paths and rejects nested/path-escape cases after containment checks. (src/media/media-reference.ts:188, f1b8827d20c8)
  • downstream-media-roots: Host-side media understanding resolves attachments using default media roots and ctx.MediaWorkspaceDir; when workspace dir is unset, absolute managed media paths remain under the allowed state/config media roots. (src/media-understanding/runner.ts:314, f1b8827d20c8)
  • staging-contract: stageSandboxMedia stages allowed source paths, silently skips too-large or failed copies, and returns only successfully staged sources, matching the incomplete-staging failure mode this PR handles. (src/auto-reply/reply/stage-sandbox-media.ts:38, f1b8827d20c8)

Likely related people:

  • steipete: GitHub history shows repeated ownership of managed media references and staging-adjacent media helpers, including canonical inbound path handling and consistent inbound media reference resolution. (role: feature owner / adjacent owner; confidence: high; commits: 4e9c83d4d8e5, a6a4140ee71a, 6290ed52ff9f; files: src/media/media-reference.ts, src/auto-reply/reply/stage-sandbox-media.ts, src/gateway/chat-attachments.ts)
  • samzong: GitHub history ties the non-image chat.send attachment offload feature to the earlier gateway offload commit that this PR builds on. (role: introduced adjacent behavior; confidence: medium; commits: 25ef9c0c419d; files: src/gateway/chat-attachments.ts, src/gateway/server-methods/chat.ts)
  • vincentkoc: Recent GitHub history shows gateway chat/media and sandbox-staging-adjacent maintenance, including media sniffing, webchat attachment support, and recent gateway command/media reply fixes. (role: recent area contributor; confidence: medium; commits: 6b6dcafcee9c, 3b663ad1c17d, b4741302c6aa; files: src/gateway/chat-attachments.ts, src/gateway/server-methods/chat.ts, src/auto-reply/reply/stage-sandbox-media.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. labels Jun 4, 2026
@harjothkhara harjothkhara changed the title fix(gateway): pass managed inbound PDFs through when sandbox staging fails (#90097) fix(gateway): pass managed inbound PDFs through chat.send Jun 4, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. labels Jun 4, 2026
harjothkhara and others added 2 commits June 3, 2026 22:14
…fails

chat.send force-stages offloaded non-image media into the sandbox workspace when
one exists. If that optional staging was unavailable or incomplete,
prestageMediaPathOffloads deleted the media buffers and failed the whole send
with a 5xx — even for already-managed inbound PDFs that are safe to read
host-side. A Control-UI-uploaded PDF could fail to send.

When staging throws or is incomplete, fall back to the absolute managed paths
iff every non-image offloaded ref is a managed-inbound application/pdf (reusing
the existing resolveInboundMediaReference allow-check + the PDF mime type). This
mirrors the existing no-sandbox passthrough: with MediaWorkspaceDir unset the
managed media dir is a default media-understanding local root, so the absolute
path resolves host-side. Gated all-or-nothing so a single non-managed or non-PDF
ref keeps the previous delete + 5xx behavior. Success path and oversized 4xx are
unchanged; managed buffers are not deleted on the fallback.

Fixes openclaw#90097

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@harjothkhara
harjothkhara force-pushed the fix/chat-send-managed-pdf-passthrough branch from b72b99e to de87445 Compare June 4, 2026 05:28
@harjothkhara

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review please. This has been green on all checks since June 4 with no review pass yet — could you run a review so it can be queued for a maintainer? Scope is small: routes managed inbound PDFs through chat.send on the gateway path.

@clawsweeper

clawsweeper Bot commented Jun 7, 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 repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. labels Jun 12, 2026
@vincentkoc vincentkoc self-assigned this Jun 15, 2026
@vincentkoc
vincentkoc merged commit 158d3db into openclaw:main Jun 15, 2026
208 of 219 checks passed
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jun 16, 2026
…0115)

* fix(gateway): pass managed inbound PDFs through when sandbox staging fails

chat.send force-stages offloaded non-image media into the sandbox workspace when
one exists. If that optional staging was unavailable or incomplete,
prestageMediaPathOffloads deleted the media buffers and failed the whole send
with a 5xx — even for already-managed inbound PDFs that are safe to read
host-side. A Control-UI-uploaded PDF could fail to send.

When staging throws or is incomplete, fall back to the absolute managed paths
iff every non-image offloaded ref is a managed-inbound application/pdf (reusing
the existing resolveInboundMediaReference allow-check + the PDF mime type). This
mirrors the existing no-sandbox passthrough: with MediaWorkspaceDir unset the
managed media dir is a default media-understanding local root, so the absolute
path resolves host-side. Gated all-or-nothing so a single non-managed or non-PDF
ref keeps the previous delete + 5xx behavior. Success path and oversized 4xx are
unchanged; managed buffers are not deleted on the fallback.

Fixes openclaw#90097

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* fix(gateway): exempt managed PDFs from staging cap

---------

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

Labels

app: web-ui App: web-ui gateway Gateway runtime merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. proof: supplied External PR includes structured after-fix real behavior proof. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: M status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pass through already-managed inbound PDFs in chat.send

2 participants