Skip to content

feat(plugins): stream external files through native session resources - #162530

Open
lazytalk wants to merge 11 commits into
openclaw:mainfrom
lazytalk:feat/plugin-managed-artifacts
Open

lazytalk wants to merge 11 commits into
openclaw:mainfrom
lazytalk:feat/plugin-managed-artifacts

Conversation

@lazytalk

@lazytalk lazytalk commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Rebuilt on current main (7a62f6ec184f2e2c9dbb7ddd6cc1a848e359531b); final head 9bd5ed1ac361cc13e9cbd0718701e180b77a2c35. 28 files changed (3161 insertions, 159 deletions). Related: #162529.

What Problem This Solves

Fixes: trusted plugins cannot stream an external provider file (for example a
Microsoft Graph download) into the current OpenClaw session as a durable,
discoverable resource without putting base64 file contents or host filesystem
paths into model-visible tool results.

User Impact

User impact: plugin authors can importStream() provider bytes into the current
admitted session and get back an opaque artifactRef; the resource is
discoverable through the existing artifacts.list/get/download APIs, survives a
Gateway restart while the exact session is retained, and can be projected into
and read back from the active execution workspace for processing.

There is no user-visible change to existing chat uploads, media, or
attachments, and their limits are unchanged. Providers do not need to know the
execution placement. This adds no new artifact database, ACL model, GC
scheduler, or cron/subagent principal.

Why This Change Was Made

The change extends OpenClaw's existing session attachment/artifact custody
with one missing generic seam instead of adding a parallel framework:

trusted provider stream -> ctx.files.importStream() -> native session-owned resource
native session-owned resource -> ctx.files.openStream() -> trusted provider stream

Native custody is reused: the managed outgoing media/document record gains a
session retention class with the exact native sessionId, SHA-256 and minimal
non-secret provenance; bytes are ingested through the existing saveMediaStream()
(incremental, bounded, atomic) and read through openMediaStream(). Discovery
reuses artifacts.*; lifecycle/cleanup reuses the native session store
(retained / gone / unavailable, fail-safe keep).

Ownership is by sessionKey plus exact sessionId: a copied artifactRef
is a locator, not a credential, and a /reset replacement stops disclosing the
previous generation.

Execution projection is placement-neutral. ctx.files consumes a
SessionResourceProjection supplied by the current execution placement
(AgentWorkspaceAccess / native local execution); the Session Resource layer
never selects sandbox/host/remote. Export reads bytes only from a natively
safe-opened descriptor (canonical containment inside the workspace root;
symlinks, hardlinks and non-regular files rejected); local materialize writes
through the native safe-write boundary and owns any partial output for cleanup.

Provider-facing capacity is split:

ctx.files.capabilities = {
  contractVersion: 3,
  resource:   { streamingImport: true, streamingOpen: true, maxBytes },
  projection: { materialize, materializeMaxBytes, export, exportMaxBytes },
}

Resource capacity and execution-projection capacity are reported independently;
each projection direction derives its own ceiling from the primitive it uses,
so a bounded direction advertises its own lower ceiling rather than reducing the
resource ceiling. materialize returns { workspacePath, size } and export
takes workspacePath; the execution placement label is not part of the provider
contract.

api.session.workflow.sendSessionAttachment() is deliberately not used: it is
outbound delivery of existing local files, not durable current-session provider
ingestion.

Evidence

pnpm tsgo                                           PASS (rebased tree)
oxfmt --check / oxlint (changed files)              clean
pnpm test src/agents/plugin-tool-files.test.ts      16 passed
pnpm test src/gateway/session-resource-store.test.ts 16 passed
pnpm test src/agents/workspace-access.test.ts       35 passed
pnpm test src/gateway/managed-image-attachments*.test.ts  56 + 21 passed
pnpm test src/agents/sandbox.context.attachments.test.ts  1 passed
pnpm test src/gateway/server.agent-session-resource-artifacts.test.ts  1 passed (real Gateway)

GitHub Actions on the final head: resolve, dispatch, label,
PR context and evidence, TypeScript contracts, Rust workspace,
actionlint, auto-response pass. The Critical Quality (CodeQL boundary)
suite is gated on a non-draft PR and currently skips; it runs when the PR is
marked Ready.

The real-Gateway E2E proves: session-resource import → artifacts.list →
artifacts.get → artifacts.download → HTTP bytes → Gateway restart →
list/get/download again, with source: "session-resource" stable across
list/get/download and a physical session replacement (same key, new sessionId)
denying the old resource.

Security/lifecycle proof: final/intermediate symlink escapes rejected, hardlink
rejected, valid confined file streams; failed or cancelled materialize removes
its partial output (local and bridge) while the durable resource survives;
oversized materialize fails explicitly without leaking a descriptor;
cleanup-pending resources excluded from discovery.

Office365 is a motivating consumer, not a core dependency. Its branch adopts the
same contract and, in probeStatus, withholds a stored proof once a different
generation has been observed for the logical session (a best-effort observation
check, not an authoritative session-store read).

Gaps / not done: no remote/cloud execution placement is implemented here
(they use their backend's own transfer, reported through projection.*MaxBytes);
sandbox command-transport streaming-stdin is left as a separate execution-runtime
follow-up rather than expanding this PR; the CodeQL Critical Quality suite runs
only once the PR is marked Ready.

@clawsweeper

clawsweeper Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

lazytalk commented Oct 1, 2026

Copy link
Copy Markdown
Contributor Author

Branch status verified after creation: GitHub reports mergeable: false / mergeable_state: dirty against main. Conflict resolution and fresh validation are required before this draft is ready for review.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation agents Agent runtime and tooling plugin: file-transfer size: M labels Oct 1, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. 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. 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. labels Oct 1, 2026
@clawsweeper

clawsweeper Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

The branch adds plugin file-stream capabilities, durable session-owned resources, artifact discovery and downloads, and tools for transferring files into and out of execution workspaces.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) Useful native-custody work and reported Gateway coverage are outweighed by concrete boundary defects and incomplete required proof.
Proof confidence 🦪 silver shellfish (2/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🧂 unranked krab (1/6) Security review found an item that needs attention.

Merge readiness

⛔ Blocked before merge - 25 items remain

This remains a distinct capability proposal that current main does not provide. The prior boundary defects remain in the pinned head, and the reported Gateway coverage does not establish safe factory-bound access or existing-state compatibility.

Likely related people: steipete for recent managed-media work and VACInc for plugin invocation authority, both with medium routing confidence.

Priority: P2
Reviewed head: f757ccb9f6b055b86d81d3e0f861934a443eab3b
Owner decision: Required. See Decision needed.

Decision needed

  • Question: Should the plugin handoff contract support durable session retention and host projection, and should its two transfer tools be exposed automatically?
  • Recommendation: Approve a narrow native contract: Have SDK and storage owners define retention, supported placements, tool enablement, and upgrade behavior before completing the implementation.
  • Why: These choices expand the paired proposal’s ephemeral sandbox-only design and establish new public, persistent, and model-facing contracts.

Before merge

  • Add real behavior proof - Authority-chain proof required: the reported real-Gateway run covers native custody, artifact HTTP downloads, restart, and replacement between requests, but bypasses factory-bound ctx.files and does not prove rejection before final I/O after factory revocation, run closure, non-workspace source resolution, or replacement during HTTP preparation. Add redacted production-path traces or diagnostic recordings showing allowed and forbidden effects; redact credentials, private endpoints, IP addresses, phone numbers, and user data. Existing-state upgrade and rollback proof is independently missing. Updating the PR body should trigger re-review; otherwise ask a maintainer to comment @clawsweeper re-review. 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.
  • Bind files to each factory’s complete authority (P1) - The prior blocker remains: this shared capability captures assembly authority before createPluginToolFactoryContext adds plugin lifecycle and owner-continuation checks. A factory retaining ctx.files can invoke it after those authorities are revoked, outside its guarded tool callback. Bind each factory’s files capability to its complete assertion.
  • Carry live authority to final workspace writes (P1) - The prior blocker remains: projection receives only a signal. Buffered materialization consumes the guarded stream before bridge path preparation awaits, so revocation during preparation can still reach write dispatch. Pass the complete live assertion to the final write boundary and settle accepted writes before cleanup.
  • Require canonical-source confinement for bridge exports (P1) - The prior blocker remains: lexical containment does not identify the bytes returned by the bridge. Without usable host backing, a workspace alias or nested non-workspace mount can pass confine, while readFile discards the canonical source available through readFileWithSource. Require source-bound workspace confinement for buffered and streaming exports before importing bytes.
  • Preserve sandbox placement in plugin-only assembly (P1) - The prior blocker remains: agent-tools.ts forwards the resolved sandbox bridge and container workdir to normal assembly but omits them from plugin-only assembly. With a sandbox and no registered projection, this fallback selects host projection and returns host workspace paths. Forward resolved placement through both assembly paths.
  • Revalidate session generation before HTTP disclosure (P1) - The prior blocker remains: retention is checked before consume, which awaits file opening and optional rendition preparation. Publication checks only request or ticket validity. A reset during preparation can therefore disclose the previous generation’s resource; carry a generation-bound fence to response publication.
  • Verify integrity before exposing upload bytes (P2) - The prior blocker remains: chunks reach consumers before SHA-256 is compared at EOF. A streaming upload can transmit tampered bytes before rejection, and early iterator termination skips the comparison. Verify a stable source before disclosure or prevent the consuming final effect until verification succeeds.
  • Provide a supported sandbox-tool enablement path (P2) - The prior blocker remains: these tools are appended but absent from the sandbox default allowlist and contained-tool registration, so normal sandbox policy removes them from the advertised processing flow. Integrate through the policy owner or document and verify explicit tools.sandbox.tools.alsoAllow enablement.
  • Move retention queries into the session read worker (P2) - The prior blocker remains: HTTP retrieval and cleanup reach this loop on the Gateway thread. loadExactSessionEntryReadOnlyResult synchronously opens and queries SQLite, adding blocking database work to resource retention checks. Use the existing worker owner while preserving retained, gone, and unavailable outcomes.
  • Close resource streams abandoned before iteration (P2) - The prior blocker remains: openMediaStream eagerly acquires a descriptor, but this wrapper returns an unstarted generator and drops the explicit close operation. Abandoning the stream without iteration or abort never enters its finally, leaking descriptors. Open lazily or provide lifecycle-owned closure for unused streams.
  • Enforce the advertised export projection ceiling (P2) - The prior blocker remains: a buffered bridge advertises a 50 MiB export ceiling, but its host-backed branch uses the larger resource limit passed by the adapter. Files above the advertised maximum can succeed. Clamp this branch to exportCeiling or report its actual supported capacity.
  • Describe the actual materialize result (P3) - The previously reported copy mismatch remains: this description promises a backend field, while materialize returns only workspacePath and size and intentionally keeps placement identity internal. Remove the unavailable field from the model-facing description.
  • Resolve security concern: Retained files bypass factory revocation - Shared files omit the plugin lifecycle and owner-continuation authority composed for each factory.
  • Resolve security concern: Workspace writes can outlive authority - Projection cannot recheck complete invocation authority after asynchronous preparation and before final writes.
  • Resolve security concern: Bridge exports lose source confinement - Fallback exports can import bytes from a non-workspace source because canonical source information is discarded.
  • Resolve security concern: Plugin-only assembly loses sandbox placement - Missing resolved sandbox inputs cause the introduced fallback to select host projection.
  • Resolve security concern: HTTP disclosure can outlive session replacement - Response publication does not revalidate session generation after awaited preparation.
  • Resolve merge risk - The public files API, durable session retention, host projection, automatic tool exposure, and SDK budget expansion lack recorded SDK/storage owner acceptance.
  • Resolve merge risk - Existing populated databases and ordinary attachments have no demonstrated upgrade, rollback, and candidate-reopen compatibility, including older-reader treatment of the new session retention class.
  • Complete next step - Resolve the current merge conflicts and obtain required exact-head maintainer security approval after repairing the boundary defects.
  • Improve patch quality - Repair factory binding, final-I/O guards, confinement, placement, integrity, descriptor lifecycle, and the remaining tool-contract findings.
  • Improve patch quality - Add final-effect proof for revoked factory authority and session replacement during awaited I/O.
  • Improve patch quality - Record SDK/storage acceptance and demonstrate populated-state upgrade, rollback, and candidate-reopen compatibility.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.
  • Add data-model compatibility proof - The review found that existing stored data may not work after upgrade. Show that existing data still loads and works with this change.

Findings

  • [P1] Bind files to each factory’s complete authority — src/agents/openclaw-plugin-tools.ts:374-377
  • [P1] Carry live authority to final workspace writes — src/agents/plugin-tool-files.ts:125-129
  • [P1] Require canonical-source confinement for bridge exports — src/agents/execution-workspace.ts:388-393
  • [high] Retained files bypass factory revocation — src/agents/openclaw-plugin-tools.ts:377
  • [medium] Workspace writes can outlive authority — src/agents/plugin-tool-files.ts:125
  • [medium] Bridge exports lose source confinement — src/agents/execution-workspace.ts:388
Agent review details

How this fits together

Plugin tools receive external file streams and place them under OpenClaw’s managed-media custody. Session ownership controls discovery and downloads, while the execution workspace handles file processing and export.

flowchart LR
 A[External file stream] --> B[Plugin file capability]
 B --> C[Managed media custody]
 C --> D[Session ownership]
 D --> E[Artifact discovery and downloads]
 C --> F[Execution workspace]
 F --> G[Processed file export]
 G --> C
Loading

Technical review

Best possible solution:

Keep native custody as the single owner, with an explicitly approved file contract, complete authority at final I/O, and verified existing-state compatibility.

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

Yes for the patch defects: source establishes retained-capability revocation, closure during write preparation, incorrect sandbox placement, and replacement during HTTP preparation as concrete triggers. They were not executed in this read-only review.

Is this the best way to solve the issue?

Unclear: extending native custody avoids duplicate storage ownership, but the lifetime and placement choices need approval and complete authority must reach final effects.

Full review comments:

  • [P1] Bind files to each factory’s complete authority — src/agents/openclaw-plugin-tools.ts:374-377
    The prior blocker remains: this shared capability captures assembly authority before createPluginToolFactoryContext adds plugin lifecycle and owner-continuation checks. A factory retaining ctx.files can invoke it after those authorities are revoked, outside its guarded tool callback. Bind each factory’s files capability to its complete assertion.
    Confidence: 0.99
  • [P1] Carry live authority to final workspace writes — src/agents/plugin-tool-files.ts:125-129
    The prior blocker remains: projection receives only a signal. Buffered materialization consumes the guarded stream before bridge path preparation awaits, so revocation during preparation can still reach write dispatch. Pass the complete live assertion to the final write boundary and settle accepted writes before cleanup.
    Confidence: 0.98
  • [P1] Require canonical-source confinement for bridge exports — src/agents/execution-workspace.ts:388-393
    The prior blocker remains: lexical containment does not identify the bytes returned by the bridge. Without usable host backing, a workspace alias or nested non-workspace mount can pass confine, while readFile discards the canonical source available through readFileWithSource. Require source-bound workspace confinement for buffered and streaming exports before importing bytes.
    Confidence: 0.97
  • [P1] Preserve sandbox placement in plugin-only assembly — src/agents/openclaw-plugin-tools.ts:359-363
    The prior blocker remains: agent-tools.ts forwards the resolved sandbox bridge and container workdir to normal assembly but omits them from plugin-only assembly. With a sandbox and no registered projection, this fallback selects host projection and returns host workspace paths. Forward resolved placement through both assembly paths.
    Confidence: 0.98
  • [P1] Revalidate session generation before HTTP disclosure — src/gateway/managed-image-attachments.ts:1610-1613
    The prior blocker remains: retention is checked before consume, which awaits file opening and optional rendition preparation. Publication checks only request or ticket validity. A reset during preparation can therefore disclose the previous generation’s resource; carry a generation-bound fence to response publication.
    Confidence: 0.99
  • [P2] Verify integrity before exposing upload bytes — src/gateway/session-resource-store.ts:436-445
    The prior blocker remains: chunks reach consumers before SHA-256 is compared at EOF. A streaming upload can transmit tampered bytes before rejection, and early iterator termination skips the comparison. Verify a stable source before disclosure or prevent the consuming final effect until verification succeeds.
    Confidence: 0.99
  • [P2] Provide a supported sandbox-tool enablement path — src/agents/openclaw-plugin-tools.ts:411-416
    The prior blocker remains: these tools are appended but absent from the sandbox default allowlist and contained-tool registration, so normal sandbox policy removes them from the advertised processing flow. Integrate through the policy owner or document and verify explicit tools.sandbox.tools.alsoAllow enablement.
    Confidence: 0.96
  • [P2] Move retention queries into the session read worker — src/gateway/session-resource-store.ts:515-522
    The prior blocker remains: HTTP retrieval and cleanup reach this loop on the Gateway thread. loadExactSessionEntryReadOnlyResult synchronously opens and queries SQLite, adding blocking database work to resource retention checks. Use the existing worker owner while preserving retained, gone, and unavailable outcomes.
    Confidence: 0.98
  • [P2] Close resource streams abandoned before iteration — src/gateway/session-resource-store.ts:447-451
    The prior blocker remains: openMediaStream eagerly acquires a descriptor, but this wrapper returns an unstarted generator and drops the explicit close operation. Abandoning the stream without iteration or abort never enters its finally, leaking descriptors. Open lazily or provide lifecycle-owned closure for unused streams.
    Confidence: 0.99
  • [P2] Enforce the advertised export projection ceiling — src/agents/execution-workspace.ts:369-374
    The prior blocker remains: a buffered bridge advertises a 50 MiB export ceiling, but its host-backed branch uses the larger resource limit passed by the adapter. Files above the advertised maximum can succeed. Clamp this branch to exportCeiling or report its actual supported capacity.
    Confidence: 0.99
  • [P3] Describe the actual materialize result — src/agents/tools/artifact-tools.ts:12-13
    The previously reported copy mismatch remains: this description promises a backend field, while materialize returns only workspacePath and size and intentionally keeps placement identity internal. Remove the unavailable field from the model-facing description.
    Confidence: 1

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against f0f0e3aa47bb.

Merge-risk options

Maintainer options:

  1. Approve scope and prove existing-state compatibility (recommended)
    Record SDK/storage acceptance and verify populated-state upgrade and rollback alongside the concrete boundary repairs.
  2. Narrow the persistence contract
    Remove durable retention and host projection if owners prefer transient sandbox handoff.
  3. Pause for contract sponsorship
    Keep the implementation in design discussion until its lifetime, authority, and upgrade contracts have an owner.

Security

Needs attention: The introduced capabilities leave concrete revocation, placement, confinement, and stale-session disclosure failures.

Evidence

Security concerns:

  • [high] Retained files bypass factory revocation — src/agents/openclaw-plugin-tools.ts:377
    Shared files omit the plugin lifecycle and owner-continuation authority composed for each factory.
    Confidence: 0.99
  • [medium] Workspace writes can outlive authority — src/agents/plugin-tool-files.ts:125
    Projection cannot recheck complete invocation authority after asynchronous preparation and before final writes.
    Confidence: 0.98
  • [medium] Bridge exports lose source confinement — src/agents/execution-workspace.ts:388
    Fallback exports can import bytes from a non-workspace source because canonical source information is discarded.
    Confidence: 0.97
  • [high] Plugin-only assembly loses sandbox placement — src/agents/openclaw-plugin-tools.ts:359
    Missing resolved sandbox inputs cause the introduced fallback to select host projection.
    Confidence: 0.98
  • [medium] HTTP disclosure can outlive session replacement — src/gateway/managed-image-attachments.ts:1612
    Response publication does not revalidate session generation after awaited preparation.
    Confidence: 0.99

What I checked:

  • Pinned introduction and parentage: Reviewed the merge-base-to-head introduction, independently of base-branch drift. The checkout and verified original PR head are f757ccb; its raw recorded parent is 9bd5ed1. No pinned test merge is available, so this review makes no claims that merging would delete current-main work. (f757ccb9f6b0)
  • Current main still lacks the proposed capability: Fetched main lacks the new custody and plugin adapter modules, and its plugin tool context has no files capability. The documented sendSessionAttachment contract sends existing files to an outbound route; it does not provide durable provider-stream ingestion. Canonical searches found the paired proposal, but no verified merged replacement. (src/plugins/tool-types.ts:24, f0f0e3aa47bb)
  • Release boundary: The latest release tree, v2026.9.7, also lacks src/gateway/session-resource-store.ts and src/agents/plugin-tool-files.ts; this is not established shipped functionality. (c074824a27c9)
  • Factory authority is not bound into files: Files are created before per-factory context construction and capture only assembly authority. The existing factory owner subsequently composes plugin lifecycle and owner-continuation assertions, but leaves the shared files object unchanged. (src/agents/openclaw-plugin-tools.ts:377, f757ccb9f6b0)
  • Final workspace effects and confinement: Materialization passes only a stream and signal into projection. Buffered writes can await bridge preparation after the stream’s last authority assertion. Export fallback uses lexical containment and readFile, discarding the source-bound canonical path supplied by the existing readFileWithSource contract. (src/agents/execution-workspace.ts:388, f757ccb9f6b0)
  • Sandbox assembly differs between entry points: Normal agent assembly forwards the resolved sandbox bridge and container workdir; plugin-only assembly forwards pluginToolOptions without those resolved values. The introduced projection resolver then selects local execution when no bound projection exists. (src/agents/openclaw-plugin-tools.ts:359, f757ccb9f6b0)

Likely related people:

  • Vito Cappello: Raw commit 861f60e adds src/plugins/tool-factory-context.ts:24 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 861f60e0bc5c; files: src/plugins/tool-factory-context.ts)

PR surface

Source +1664, Tests +1365, Other +2. Total +3031 across 33 files.

View PR surface stats
Area Files Added Removed Net
Source 26 1833 169 +1664
Tests 6 1365 0 +1365
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 3 1 +2
Total 33 3201 170 +3031

Review metrics

Metric Value Why it matters
New capability surface 4 file operations, 2 agent tools, 1 configurable byte ceiling These additions establish public and model-facing contracts requiring explicit scope acceptance.
Persistent record expansion 5 nullable columns and 1 retention class Fresh-state restart coverage does not establish compatibility with existing databases or older readers.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #162529
Summary: This PR is the same author’s implementation candidate for the open binary-handoff proposal, with different lifetime and placement choices.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a bounded plugin capability improvement without evidence of an urgent shipped regression.
  • merge-risk: 🚨 compatibility: The new public API and persistent retention contract require accepted upgrade and older-reader behavior.
  • merge-risk: 🚨 security-boundary: Introduced file access can bypass factory revocation, workspace placement, canonical confinement, and session-generation fencing.
  • merge-risk: 🚨 availability: Eagerly opened unused streams can leak descriptors, and retention checks add synchronous SQLite work to Gateway request paths.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🦪 silver shellfish and patch quality is 🧂 unranked krab.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (14 earlier review cycles; latest 8 shown)
  • reviewed 2026-10-02T08:41:59.007Z sha 451dfccb63a8b1741a55c4b30abf13e39c353846 :: needs real behavior proof before merge. :: [P1] Bind files to the factory’s complete authority | [P1] Carry live authority to final workspace publication | [P1] Confine exports using the canonical opened source | [P1] Preserve sandbox placement in plugin-only assembly | [P1] Give session-specific mounts a compatible runtime identity | [P1] Revalidate session generation before sending HTTP bytes
  • reviewed 2026-10-02T09:56:01.677Z sha bd1432dcd86557e50eafb92fbe797a67d41b8d8b :: needs real behavior proof before merge. :: [P1] Bind files to the factory’s complete authority | [P1] Carry live authority to final workspace publication | [P1] Check the canonical source on bridge exports | [P1] Preserve sandbox placement in plugin-only assembly | [P1] Give session-specific mounts a compatible runtime identity | [P1] Revalidate session generation before sending HTTP bytes
  • reviewed 2026-10-02T10:08:25.421Z sha 661252c0a574f5958918ffbcf6a70fc7f817f0d0 :: needs real behavior proof before merge. :: [P1] Bind files to each factory’s complete authority | [P1] Carry live authority to final workspace publication | [P1] Require canonical-source confinement for bridge exports | [P1] Preserve sandbox placement in plugin-only assembly | [P1] Give session-specific mounts a compatible runtime identity | [P1] Revalidate session generation before HTTP disclosure
  • reviewed 2026-10-02T10:56:23.410Z sha 64950bed84882029f2c7d7bfb4da6fc57f6954ed :: needs real behavior proof before merge. :: [P1] Bind files to each factory’s complete authority | [P1] Carry live authority to final workspace writes | [P1] Require canonical-source confinement for bridge exports | [P1] Preserve sandbox placement in plugin-only assembly | [P1] Revalidate session generation before HTTP disclosure | [P2] Verify integrity before exposing upload bytes
  • reviewed 2026-10-02T12:53:39.298Z sha 9bd5ed1 :: needs real behavior proof before merge. :: [P1] Bind files to each factory’s complete authority | [P1] Carry live authority to final workspace writes | [P1] Require canonical-source confinement for bridge exports | [P1] Preserve sandbox placement in plugin-only assembly | [P1] Revalidate session generation before HTTP disclosure | [P2] Verify integrity before exposing upload bytes
  • reviewed 2026-10-02T14:11:58.289Z sha 9bd5ed1 :: needs real behavior proof before merge. :: [P1] Bind files to each factory’s complete authority | [P1] Carry live authority to final workspace writes | [P1] Require canonical-source confinement for bridge exports | [P1] Preserve sandbox placement in plugin-only assembly | [P1] Revalidate session generation before HTTP disclosure | [P2] Verify integrity before exposing upload bytes
  • reviewed 2026-10-02T14:45:55.037Z sha f757ccb :: needs real behavior proof before merge. :: [P1] Bind files to each factory’s complete authority | [P1] Carry live authority to final workspace writes | [P1] Require canonical-source confinement for bridge exports | [P1] Preserve sandbox placement in plugin-only assembly | [P1] Revalidate session generation before HTTP disclosure | [P2] Verify integrity before exposing upload bytes
  • reviewed 2026-10-02T15:11:41.105Z sha f757ccb :: needs real behavior proof before merge. :: [P1] Bind files to each factory’s complete authority | [P1] Carry live authority to final workspace writes | [P1] Require canonical-source confinement for bridge exports | [P1] Preserve sandbox placement in plugin-only assembly | [P1] Revalidate session generation before HTTP disclosure | [P2] Verify integrity before exposing upload bytes

Reviewed October 2, 2026, 11:23 AM ET / 15:23 UTC (Revision 15).

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: XL and removed size: M labels Oct 1, 2026
@lazytalk
lazytalk force-pushed the feat/plugin-managed-artifacts branch from 640a89d to c4b974f Compare October 2, 2026 04:28
@lazytalk lazytalk changed the title feat(plugins): safely hand off binary files through managed artifacts feat(plugins): stream external files through native session resources Oct 2, 2026
@openclaw-barnacle openclaw-barnacle Bot added the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Oct 2, 2026
@lazytalk
lazytalk force-pushed the feat/plugin-managed-artifacts branch from c4b974f to b87034f Compare October 2, 2026 04:31
@openclaw-barnacle openclaw-barnacle Bot removed docs Improvements or additions to documentation plugin: file-transfer labels Oct 2, 2026
@lazytalk
lazytalk force-pushed the feat/plugin-managed-artifacts branch from b87034f to 6137c83 Compare October 2, 2026 05:17
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Oct 2, 2026
@openclaw-barnacle openclaw-barnacle Bot added the docker Docker and sandbox tooling label Oct 2, 2026
@lazytalk
lazytalk force-pushed the feat/plugin-managed-artifacts branch from bd1432d to 661252c Compare October 2, 2026 09:58
@openclaw-barnacle openclaw-barnacle Bot removed docker Docker and sandbox tooling triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Oct 2, 2026
lazytalk and others added 5 commits October 2, 2026 20:35
…and discovery

Close the V11 hardening blockers.

- Export reads bytes only from a natively safe-opened descriptor: open-local
  no-follow, canonical containment inside the workspace root, hardlink and
  non-regular-file rejection, then stream from that exact handle. Final and
  intermediate symlink escapes and hardlinks now fail closed; no lexical
  resolve is an authorization boundary.
- Projection staging is scoped to the exact native sessionId, so a reset or
  generation replacement never mounts the previous generation's bytes.
- Mounted (read-only mount + native copy) materialization now tracks and removes
  its writable workspace copy at run cleanup; cleanup is idempotent and never
  removes the durable Session Resource.
- Materialize preflights the trusted durable size before opening a descriptor,
  so an oversized request cannot leak an unread stream.
- Projection ceilings are independent: mount+copy materialize advertises the
  resource ceiling (streaming staging) while export stays bounded separately.
- Provider API drops placement identity: materialize returns
  `{ workspacePath, size }` and export takes `workspacePath` only.
- Discovery: `cleanup_pending` session resources are excluded, and the
  `source: "session-resource"` classification is stable across
  list/get/download.
- Tests: symlink/intermediate-symlink/hardlink escape, lifecycle cleanup with
  durable-resource survival, generation-scoped staging, cleanup-pending
  exclusion, and Gateway E2E source consistency plus physical-replacement denial.

Co-authored-by: Copilot <[email protected]>
Upstream renamed the E2E port helper to `acquireGatewayE2ePortBlock` in
`test-helpers.listener.js`; update the session-resource Gateway test to the
current claim/release API.

Co-authored-by: Copilot <[email protected]>
…ialize safe-write

Follow-up to the projection hardening.

- Do not change sandbox scope for this PR: drop the session-resource
  read-only mount, the sessionId threading into sandbox provisioning, and the
  mount+native-copy projection. Sandbox materialize/export use the generic
  bridge projection and report their bounded projection ceilings honestly.
- Host materialize opens its destination through the native safe-write
  boundary (`fsSafeRoot(...).openWritable`, mutation symlinks rejected) and
  streams chunks to that handle, closing the write-side TOCTOU. Export still
  reads from a natively safe-opened descriptor.
- Remove the now-unused projection-paths module and mount tests.

Co-authored-by: Copilot <[email protected]>
… internal

- Register each materialize destination before the write starts and, on failure
  or cancellation, close the descriptor first and then remove the partial
  output (local), or remove the partial destination (bridge). Add
  partial-write and cancellation cleanup tests.
- Derive bridgeProjection materialize and export ceilings independently from the
  primitive each direction actually uses, instead of forcing both to one value.
- Stop re-exporting PluginToolFilesBackend from the plugin public barrels; the
  execution placement label stays internal.

Co-authored-by: Copilot <[email protected]>
…source E2E

Upstream now requires explicit surface owners for legacy `agents.entries`
default markers; the E2E config uses only an explicit workspace entry.

Co-authored-by: Copilot <[email protected]>
@lazytalk
lazytalk force-pushed the feat/plugin-managed-artifacts branch from b4a0eda to 9bd5ed1 Compare October 2, 2026 12:40
@lazytalk
lazytalk marked this pull request as ready for review October 2, 2026 13:56
@github-actions

github-actions Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Maintainer security review required

This external contributor PR changes sensitive security components. A maintainer must review these changes before merging.

Current SHA: f757ccb9f6b055b86d81d3e0f861934a443eab3b

These sensitive security changes were made:

  • src/agents/sandbox/fs-bridge.types.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.

After reviewing the changes, post a new PR comment containing only approval commands, each on its own line:

/allow-security-sensitive-change

A later push requires a fresh approval comment.

Fix the checks that gate the PR once it leaves draft.

- Break the `managed-image-attachments <-> session-resource-store` import cycle
  by extracting the `ManagedOutgoingMediaArtifactDownload` shape to a leaf
  contract module.
- Keep execution placement identity internal: un-export the projection and
  retention helpers (and the internal constants) that only their own module
  uses; route tests through production entry points
  (`resolveSessionResourceProjection`, `shouldReclaimSessionResource`,
  `resolveSessionResourceArtifactDownload`).
- Remove now-dead `toSessionResourceMetadata` and the newly exported constants.
- Add tool-display metadata for `artifact_materialize`/`artifact_export` and
  regenerate the tool-display snapshot.
- Drop the new non-const type assertions instead of annotating them.
- Pin the plugin SDK public-export budget to the current count (3641).
- Fix the E2E/tests for the current `SessionAccessScope` and
  `ManagedOutgoingMediaArtifactDownload` shapes.

Co-authored-by: Copilot <[email protected]>
@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label Oct 2, 2026
@lazytalk
lazytalk marked this pull request as draft October 2, 2026 15:01
@lazytalk
lazytalk marked this pull request as ready for review October 2, 2026 15:01
@lazytalk lazytalk closed this Oct 2, 2026
@lazytalk lazytalk reopened this Oct 2, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling gateway Gateway runtime merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. 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. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. scripts Repository scripts security-review-required security-sensitive-changed size: XL 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.

1 participant