Skip to content

Pass through already-managed inbound PDFs in chat.send #90097

Description

@joeykrug

Summary

chat.send can offload large PDFs to the managed inbound media store, but already-managed inbound PDFs may still be forced through optional sandbox staging. If staging is unavailable or incomplete, the send fails even though the managed media path is already safe to pass as MediaPath/MediaPaths.

Observed behavior

  • A large PDF uploaded through the Control UI was saved as managed inbound media.
  • The gateway attempted optional sandbox staging and could fail before the agent saw the media path.

Expected behavior

  • If every non-image offloaded reference is an application/pdf saved under the managed inbound media store, the gateway should pass those paths through as MediaPath/MediaPaths and MediaType/MediaTypes.
  • If optional sandbox staging fails for that same already-managed inbound PDF case, the gateway should fall back to the managed paths instead of deleting the media and failing the send.

Safety constraints

  • Only managed inbound media-store PDF paths should get this pass-through.
  • Do not allow arbitrary local paths or media:// references from untrusted input.
  • Do not grant locked-down agents read or exec.

Local runtime evidence

The local runtime fix allowed already-saved inbound PDFs to continue as managed media paths. A full gateway chat.send smoke with the Semianalysis PDF returned status:"started" and logged successful offload without fresh stack/staging errors.

Activity

  1. clawsweeper commented on Jun 4, 2026

    @clawsweeper
    Contributor

    Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed June 15, 2026, 7:37 AM ET / 11:37 UTC.

    Summary
    Keep this issue open: current main and latest release still route sandboxed managed inbound PDF offloads through the failing staging path, and two open PRs explicitly close this issue. The right cleanup is to land or close the canonical PR first, then close this issue as implemented after merge.

    Reproducibility: yes. at source level: current main routes sandboxed non-image PDF offloads through prestageMediaPathOffloads, where oversize, throw, or incomplete staging fails before dispatch. I did not run a live gateway smoke because this review is read-only.

    Next step
    Do not queue a separate repair job because open closing PRs already implement candidate fixes for this issue.

    Review details

    Best possible solution:

    Review and land one canonical fix, likely #92220 if maintainers accept its broader extraction envelope, then close this issue after the merge proves the managed-PDF path on main.

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

    Yes, at source level: current main routes sandboxed non-image PDF offloads through prestageMediaPathOffloads, where oversize, throw, or incomplete staging fails before dispatch. I did not run a live gateway smoke because this review is read-only.

    Is this the best way to solve the issue?

    Yes, the requested fix shape is narrow if it reuses resolveInboundMediaReference, stays PDF-only, and keeps non-PDF or untrusted paths fail-closed. A separate ClawSweeper repair job is not the best path now because open PRs already own the implementation candidates.

    AGENTS.md: found and applied where relevant.

    Remaining risk / open question:

    • Two open closing PRs overlap on the gateway fallback path, so maintainers should choose one canonical landing path before the issue is closed.

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

    Label changes

    Label changes:

    • remove clawsweeper:fix-shape-clear: Current issue advisory state no longer selects this label.
    • remove clawsweeper:queueable-fix: Current issue advisory state no longer selects this label.

    Label justifications:

    • P2: This is a bounded gateway attachment delivery bug with real PDF send impact but no evidence of broad runtime outage.
    • impact:message-loss: The issue is about a PDF attachment failing before it reaches the agent as an inbound media path.
    Evidence reviewed

    What I checked:

    Likely related people:

    • amknight: Authored the open maintainer PR that closes this issue and changes both the managed-PDF chat.send path and media-understanding extraction limits. (role: current proposed fix owner; confidence: high; commits: 5ceefc76cb73, 451ed20afb20; files: src/gateway/server-methods/chat.ts, src/gateway/server-methods/chat.directive-tags.test.ts, src/media-understanding/apply.ts)
    • harjothkhara: Authored the narrower open PR that closes this issue by adding a managed-inbound PDF fallback in the gateway prestage path. (role: current focused PR author; confidence: high; commits: 4657a5bb0466, de87445b1afc; files: src/gateway/server-methods/chat.ts, src/gateway/server-methods/chat.directive-tags.test.ts)
    • samzong: GitHub commit history ties the non-image chat.send attachment offload feature that this issue extends to commit 25ef9c0. (role: introduced adjacent behavior; confidence: medium; commits: 25ef9c0c419d; files: src/gateway/chat-attachments.ts, src/gateway/server-methods/chat.ts)
    • steipete: Recent path history shows repeated work on inbound media reference resolution and sandbox/media staging helpers used by the safe fallback boundary. (role: adjacent media owner; confidence: high; commits: 6290ed52ff9f, a6a4140ee71a, 41c5990d1313; files: src/media/media-reference.ts, src/auto-reply/reply/stage-sandbox-media.ts, src/gateway/chat-attachments.ts)
    • vincentkoc: Recent GitHub history shows adjacent gateway chat and media attachment maintenance, including media sniffing and gateway reply behavior. (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)
    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.
  2. added
    P2
    impact:message-loss
    issue-rating: 🦞 diamond lobster
    clawsweeper:source-repro
    clawsweeper:queueable-fix
    clawsweeper:fix-shape-clear
    on Jun 4, 2026
  3. added a commit that references this issue on Jun 4, 2026
    4657a5b
  4. added
    clawsweeper:linked-pr-open
    clawsweeper:no-new-fix-pr
    and removed
    clawsweeper:fix-shape-clear
    clawsweeper:queueable-fix
    on Jun 15, 2026
  5. added a commit that references this issue on Jun 15, 2026
    158d3db
  6. added 3 commits that reference this issue on Jun 16, 2026
    9df7986
    f5c31e3
    1bfb7e6
  7. locked as resolved and limited conversation to collaborators on Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2clawsweeper:linked-pr-openclawsweeper:no-new-fix-prclawsweeper:source-reproimpact:message-lossissue-rating: 🦞 diamond lobster

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions