Skip to content

feat(media): point the agent at unsupported documents on disk instead of dead-ending - #122408

Merged
obviyus merged 9 commits into
mainfrom
feat/unsupported-document-self-serve
Aug 12, 2026
Merged

obviyus merged 9 commits into
mainfrom
feat/unsupported-document-self-serve

Conversation

@obviyus

@obviyus obviyus commented Aug 12, 2026 •

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Unsupported local documents (DOCX, XLSX, …) currently yield a capability marker and dead-end even when the host-run agent can inspect the saved file itself.

Why This Change Was Made

unsupported-format now retains the cache-approved local path through preprocessing, then promotes the plain marker only after the final embedded provider, owner, tool, sandbox, and filesystem policy permit host reads. The marker directs the agent to extract the file itself; OOXML gets an unzip hint. URL-only attachments, generic ACP, sandboxed sessions, unsafe filenames, and operator-policy rejections retain the plain marker. No parsers, dependencies, or config.

User Impact

A default host-run agent can inspect a locally saved unsupported document instead of asking the sender to paste its contents.

Maintainer Decision

Approved by Ayaan on 2026-08-12: eligible embedded host runs may include the root-approved absolute attachment path in model context after sandbox, filesystem-scope, final provider/tool-policy, and authoritative owner gates pass.

Evidence

  • Regression-first proof: external Telegram direct chats sharing the main transcript previously received a host path under sandbox.mode: non-main; restricted tools, workspace-only filesystems, final provider policy, owner policy, classified MIME, and shell metacharacters each reproduce before their repair and pass afterward.
  • Focused: media owner 955 passed / 10 skipped across 63 passing files / 2 skipped; final reply boundary 25 passed; grouped changed-surface command 120 passed.
  • Static: targeted oxfmt + oxlint, tsgo, and check:test-types clean.
  • Broad auto-reply owner run: 12,267 passed / 3 skipped; 24 unrelated failures across 19 untouched suites, including 120-second timeout phantoms. Exact-head CI arbitrates the broad matrix.

Telegram DOCX proof — f126696438cb6c3f1205eca8f010a6f2564c0961

  • Real QA user sent e2e-quarterly-report.docx with “Please read this document and summarize it.” as message 917.
  • Recorded SUT timeline: typing at 8.0s and 9.2s; message 918 at 9.2s with deterministic mock reply OPENCLAW_E2E_OK.
  • One provider request. Its user payload contained:
    [Unsupported document format: application/vnd.openxmlformats-officedocument.wordprocessingml.document. The approved local file path follows as external attachment metadata. Its text is not extracted automatically. Read the file yourself with your tools before answering (this Office file is a zip archive containing XML); do not ask the user to paste the contents.]
  • The following <managed-media-path>/e2e-quarterly-report---<id>.docx appeared only inside its own EXTERNAL_UNTRUSTED_CONTENT fence.
  • Runner removed its scratch tree; durable local evidence contains events.ndjson, summary.json, gateway.log, and mock-openai-requests.ndjson.

Review Scope Notes

  • Local paths come only from the cache's root-policy-approved read, never raw attachment input.
  • Promotion uses the final provider policy and authoritative owner fact plus the canonical peer-scoped runtime-policy session key. External direct chats may share the main transcript while their tools remain sandboxed.
  • Model-visible paths must be absolute, at most 300 characters, and use a positive Unicode-safe alphabet: letters, marks, digits, spaces, /, \\, :, ., _, and -. Prompt markup and executable shell syntax suppress self-service.
  • Operator allowedMimes rejection wins before any path can be named.
  • Sandbox-staged references for this marker and existing media notes remain tracked in Self-serve document marker and media notes should name sandbox-staged paths when staging is active #122411.

@clawsweeper

clawsweeper Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@obviyus
obviyus marked this pull request as ready for review August 12, 2026 03:20
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: S maintainer Maintainer-authored PR labels Aug 12, 2026
@obviyus
obviyus force-pushed the feat/unsupported-document-self-serve branch from 7ed8b4f to 9933d06 Compare August 12, 2026 03:25
@obviyus
obviyus force-pushed the feat/unsupported-document-self-serve branch 4 times, most recently from e799546 to 0642cab Compare August 12, 2026 03:52
@clawsweeper clawsweeper Bot added merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 12, 2026
@clawsweeper

clawsweeper Bot commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge. Reviewed August 12, 2026, 1:16 AM ET / 05:16 UTC.

ClawSweeper review

What this changes

The PR lets an agent running on the host inspect a root-approved unsupported local document by adding a safe on-disk path directive to its media prompt.

Merge readiness

⛔ Blocked by patch quality or review findings - 6 items remain

The host-reply path is well scoped and the prior sandbox-policy fixes are present, but the ACP dispatch path now assumes every registered ACP backend can read host-local paths. That violates the generic ACP backend contract and can restore the dead end for remote or container-backed plugins, so this PR needs a narrow correction before merge.

Priority: P2
Reviewed head: ba1a08794f3856258fee1df169ca3a620380cceb

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The host-path proof is strong, but the unconditional ACP placement assumption is a merge-blocking correctness and boundary defect.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (logs): The PR body provides a real Telegram DOCX after-fix trace with the observed model request and response; it validates the host flow, though not the separate generic-ACP contract concern.
Patch quality 🦪 silver shellfish (2/6) Security review found an item that needs attention.

Verification

Check Result Evidence
Real behavior Verified Sufficient (logs): The PR body provides a real Telegram DOCX after-fix trace with the observed model request and response; it validates the host flow, though not the separate generic-ACP contract concern.
Evidence reviewed 8 items Current main behavior: Current main renders unsupported documents as a plain capability marker without an on-disk path, establishing the behavior this PR extends.
ACP backend contract: The configured ACP backend may be any registered plugin backend; registry entries carry only an id, runtime, and optional health probe.
No placement capability: The public ACP runtime capabilities describe controls and config options, not whether a backend shares the Gateway host filesystem.
Findings 1 actionable finding [P1] Do not assume every ACP backend can read host paths
Security Needs attention Host path reaches an unplaced ACP backend: A registered ACP plugin can receive an absolute host path without any contract that it shares the Gateway filesystem, exposing host layout while directing the model toward an inaccessible file.

How this fits together

Inbound attachments pass through the media cache and classifier before OpenClaw appends a file marker to the agent prompt. The marker must describe a path the executing runtime can actually open, whether the reply uses the embedded host runtime or an ACP backend plugin.

flowchart LR
  A[Inbound document] --> B[Root-approved media cache]
  B --> C[Format classifier]
  C --> D[Runtime placement check]
  D --> E[File prompt marker]
  E --> F[Embedded agent or ACP backend]
  F --> G[Agent reads document]
Loading

Before merge

  • Do not assume every ACP backend can read host paths (P1) - acp.backend accepts any registered backend, but its public contract has no host-filesystem placement capability. This unconditional flag therefore tells a remote or container backend to open a Gateway-host path it cannot access. Keep ACP path-free unless placement is authoritative, and add coverage for that generic case. This was visible at the already-reviewed head, so it is a late finding.
  • Resolve security concern: Host path reaches an unplaced ACP backend - A registered ACP plugin can receive an absolute host path without any contract that it shares the Gateway filesystem, exposing host layout while directing the model toward an inaccessible file.
  • Resolve merge risk (P1) - A remote or container-backed ACP plugin can receive an absolute Gateway-host path it cannot read, causing a renewed dead end and exposing host layout in its prompt.
  • Complete next step (P2) - A bounded repair can remove the unconditional ACP host-path assertion and preserve the already-proven embedded host behavior; the protected maintainer review still owns the merge decision.
  • Improve patch quality - Remove the unconditional ACP host-path flag or gate it on an authoritative backend placement fact.
  • Improve patch quality - Add a focused ACP dispatch regression for a backend without verified host-path access.

Findings

  • [P1] Do not assume every ACP backend can read host paths — src/auto-reply/reply/dispatch-acp.ts:724-726
  • [medium] Host path reaches an unplaced ACP backend — src/auto-reply/reply/dispatch-acp.ts:724
Agent review details

Security

Needs attention: The unconditional ACP host-path directive crosses an unproven backend filesystem boundary.

PR surface

Source +86, Tests +193, Docs +1. Total +280 across 10 files.

View PR surface stats
Area Files Added Removed Net
Source 5 92 6 +86
Tests 4 195 2 +193
Docs 1 2 1 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 10 289 9 +280

Review metrics

Metric Value Why it matters
Production versus test delta production +86 net (92 added, 6 removed); docs +1 net; tests +193 net (195 added, 2 removed) The feature adds bounded prompt and placement behavior with substantial focused regression coverage; the remaining ACP assumption is a correctness issue, not an LOC concern.

Stored data model

Persistent data-model change detected: persistent cache schema: src/media-understanding/media-understanding-misc.test.ts, serialized state: src/media-understanding/media-understanding-misc.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Keep generic ACP path-free (recommended)
    Remove the unconditional ACP self-service flag and add a regression that preserves the plain marker for a generic registered backend.
  2. Define backend placement explicitly
    Only add host-path guidance to ACP after maintainers approve and document a backend capability that proves the runtime shares the host media filesystem.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Remove ACP's unconditional host-path self-service flag, preserve the generic plain marker, and add focused ACP dispatch regression coverage.

Technical review

Best possible solution:

Keep generic ACP markers path-free until the ACP backend contract can authoritatively prove host-path visibility or translate the document into the backend workspace.

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

Yes for the existing behavior: current main always renders the plain unsupported-document marker, and the PR body supplies an after-fix Telegram request trace for the host path. The new ACP regression is source-reproducible from its generic backend contract, though it was not live-run here.

Is this the best way to solve the issue?

No. The embedded reply path uses the correct peer-scoped sandbox decision, but ACP dispatch must not treat all registered backends as host-local; the safe narrow repair is to keep its generic marker plain.

Full review comments:

  • [P1] Do not assume every ACP backend can read host paths — src/auto-reply/reply/dispatch-acp.ts:724-726
    acp.backend accepts any registered backend, but its public contract has no host-filesystem placement capability. This unconditional flag therefore tells a remote or container backend to open a Gateway-host path it cannot access. Keep ACP path-free unless placement is authoritative, and add coverage for that generic case. This was visible at the already-reviewed head, so it is a late finding.
    Confidence: 0.92
    Late finding: first raised on code an earlier review cycle already covered.

Overall correctness: patch is incorrect
Overall confidence: 0.94

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add merge-risk: 🚨 compatibility: Existing ACP backend plugins are configured through a generic backend contract and may not share Gateway host paths.
  • add merge-risk: 🚨 security-boundary: The unconditional ACP directive can expose an absolute host path to a backend whose filesystem placement is not known.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides a real Telegram DOCX after-fix trace with the observed model request and response; it validates the host flow, though not the separate generic-ACP contract concern.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦞 diamond lobster and patch quality is 🦪 silver shellfish.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (logs): The PR body provides a real Telegram DOCX after-fix trace with the observed model request and response; it validates the host flow, though not the separate generic-ACP contract concern.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦪 silver shellfish, so this older rating label is no longer current.
  • remove status: 👀 ready for maintainer look: Current PR status label is status: ⏳ waiting on author.

Label justifications:

  • P2: This is a useful media-flow enhancement with a bounded ACP-plugin regression risk, not an outage on the default shipped path.
  • merge-risk: 🚨 compatibility: Existing ACP backend plugins are configured through a generic backend contract and may not share Gateway host paths.
  • merge-risk: 🚨 security-boundary: The unconditional ACP directive can expose an absolute host path to a backend whose filesystem placement is not known.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦞 diamond lobster and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (logs): The PR body provides a real Telegram DOCX after-fix trace with the observed model request and response; it validates the host flow, though not the separate generic-ACP contract concern.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides a real Telegram DOCX after-fix trace with the observed model request and response; it validates the host flow, though not the separate generic-ACP contract concern.

Evidence

Security concerns:

  • [medium] Host path reaches an unplaced ACP backend — src/auto-reply/reply/dispatch-acp.ts:724
    A registered ACP plugin can receive an absolute host path without any contract that it shares the Gateway filesystem, exposing host layout while directing the model toward an inaccessible file.
    Confidence: 0.91

Acceptance criteria:

  • [P1] node scripts/run-vitest.mjs src/auto-reply/reply/dispatch-acp.test.ts.
  • [P1] node scripts/run-vitest.mjs src/media-understanding/apply.test.ts.
  • [P1] node scripts/run-vitest.mjs src/media-understanding/file-attachment-outcomes.test.ts.

What I checked:

Likely related people:

  • steipete: Current marker code is attributed to this history, and related media-facts, staging, and peer-scoped runtime-policy work appears in the local feature history. (role: recent media and runtime-policy architecture contributor; confidence: high; commits: 8876528f7c0e, 7eb9fa3389c3, f199384420c3; files: src/media-understanding/file-attachment-outcomes.ts, src/media-understanding/apply.ts, src/auto-reply/reply/runtime-policy-session-key.ts)
  • Harjoth Khara: Recent history connects this contributor to resolving managed media references in the cache whose approved local-path fact this PR extends. (role: recent attachment-cache boundary contributor; confidence: medium; commits: 18f31f6d229; files: src/media-understanding/attachments.cache.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 (3 earlier review cycles)
  • reviewed 2026-08-12T03:57:10.210Z sha 0642cabaa679e0f70a169a3f3678f75c22f462fc :: found issues before merge. :: [P1] Use the canonical session key before rendering a host path | [P2] Allow safe non-ASCII local paths in the marker
  • reviewed 2026-08-12T04:04:42.676Z sha c94d63ff2060f87ba3ea909b56f2d2b69cd8d08d :: needs changes before merge. :: [P1] Resolve sandbox status from the runtime policy key | [P2] Permit safe Unicode local paths in the marker
  • reviewed 2026-08-12T05:09:51.121Z sha ba1a087 :: needs maintainer review before merge. :: none

@obviyus
obviyus force-pushed the feat/unsupported-document-self-serve branch from 0642cab to c94d63f Compare August 12, 2026 03:58
@clawsweeper clawsweeper Bot added the merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. label Aug 12, 2026
@obviyus
obviyus force-pushed the feat/unsupported-document-self-serve branch from c94d63f to 1a142b8 Compare August 12, 2026 04:40
@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. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 12, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed 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 Aug 12, 2026
@obviyus

obviyus commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator Author

Latest public ClawSweeper review (ba1a087) resolved on exact head f126696:

  • Generic ACP remains path-free; regression coverage asserts no host-path capability.
  • Path promotion now occurs only at the final embedded turn boundary, after authoritative owner, sandbox, filesystem-scope, provider, model, and effective tool-policy checks.
  • Ayaan approved the bounded host-path disclosure on 2026-08-12.
  • Exact-head local ClawSweeper: PASS — zero findings, security concerns, maintainer decisions, or Rank-up moves.
  • Final Telegram DOCX proof recorded the trusted directive plus separately fenced external path and completed the live round trip.

@obviyus
obviyus merged commit b8ddddd into main Aug 12, 2026
132 checks passed
@obviyus
obviyus deleted the feat/unsupported-document-self-serve branch August 12, 2026 06:12
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 13, 2026
…#122408)

Let eligible embedded host runs inspect root-approved unsupported documents after final sandbox, filesystem, provider, owner, and tool-policy gates. Generic ACP, sandboxed, URL-only, and restricted-tool paths retain the plain marker.

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

docs Improvements or additions to documentation maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: L status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant