Skip to content

[2026.9.36] Preserve filesystem policy in Gateway-built tools - #187308

Merged
RomneyDa merged 6 commits into
extended-stable/2026.9.33from
backport/fs-policy-extended-2026.9
Oct 29, 2026
Merged

RomneyDa merged 6 commits into
extended-stable/2026.9.33from
backport/fs-policy-extended-2026.9

Conversation

@RomneyDa

Copy link
Copy Markdown
Member

Scope

Focused backport of Agustin Rivera's #185094, source commit 3e0c610. Derive an omitted fsPolicy from the captured session/config policy before delegate and media tool construction. Preserve explicit policy overrides, session permission roots and read-only attachment roots. No approval/cancellation/revocation enforcement is removed.

Adaptation

This train predates asynchronous OpenClaw tool preparation. Derive in the synchronous factory before createHostedGatewayTools delegates and before media factories; do not import the newer preparation architecture.
The upstream unit tests use the existing branch-local config fixture shape; the historical inference fixture passes its dependency adapter to preserve route re-verification while keeping approval and persistence real. Additional factory regressions cover global and per-agent workspace restrictions plus explicit unrestricted overrides.

Validation

  • Local policy/media regressions: 15 policy + 12 media passed.
  • Core TypeScript check passed with the checkout-owned scripts/run-tsgo.mjs wrapper.
  • Source-only formatting and git diff whitespace checks passed.
  • Gateway tool-resolution suite: 34/34 passed using documented OPENCLAW_GATEWAY_PROJECT_SHARDS=0 fork-pool mode, including real approval and revocation persistence.

Review gates

Draft only. Independent full-context review, required hosted checks, and release qualification remain outstanding. This does not claim ready-for-review, merge approval, or release inclusion. No version, dependency, lockfile, or release-validation changes.

…spaceOnly reaches the delegate and media tools (#185094)

* fix(agents): derive fsPolicy for Gateway-built OpenClaw tools so workspaceOnly reaches the delegate and media tools

* test(gateway): prove workspace policy at delegation and media sinks

Backport adaptation (#185094): Resolve policy before synchronous hosted gateway/delegate and media assembly; this train has no separate asynchronous preparation module. Keep branch-local policy unit fixtures; wire the historical inference test dependency fixture and add factory-level restriction/override regressions.

(cherry picked from commit 3e0c610)

Co-authored-by: RomneyDa <[email protected]>
@clawsweeper

clawsweeper Bot commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime agents Agent runtime and tooling size: M labels Oct 29, 2026
@RomneyDa
RomneyDa marked this pull request as ready for review October 29, 2026 04:34
@RomneyDa

Copy link
Copy Markdown
Member Author

@clawsweeper review

@clawsweeper

clawsweeper Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 29, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 29, 2026
@clawsweeper

clawsweeper Bot commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR derives omitted filesystem policy before Gateway-built delegate and media tools are constructed.

Example: With tools.fs.workspaceOnly=true, a Gateway-built delegate receives config set logging.level debug.

  • Before: Missing filesystem policy can classify the delegate as Full Access and apply the change without approval.
  • After: The delegate waits for approval and prevents the write after cancellation or run revocation.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful, focused backport with no actionable finding and relevant production-owner harness evidence; confidence remains bounded by in-process proof.
Proof confidence 🦐 gold shrimp (3/6) Sufficient (none): The maintainer reports passing backport Gateway final-effect cases using production tool resolution, approval routing, persisted decisions, config writes, and media reads. The inspected harness covers allowed application, no write before approval, cancellation, pending and precommit revocation, and denied outside-root media access. Inference is deterministic scaffolding; no socket Gateway or live model run is claimed, and no tests were rerun during this review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Configured workspace restrictions can be bypassed by Gateway-built administrative delegation and local-media reads.
Reason: The maintainer-authored backport restores an existing permission contract without adding configuration, changing stored formats, or replacing enforcement owners.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored backport repairs a filesystem-policy bypass still present on the extended-stable base; no actionable introduced defect was found.

Priority: P1
Reviewed head: d519ecd748eca03ba079ff6806506901675f61b8

Before merge

None.

Findings

None.

Agent review details

How this fits together

Gateway tool resolution supplies configuration and session context to the shared tool factory, which passes filesystem restrictions to existing delegation, approval, and media-access owners.

flowchart TD
  A[Gateway tool resolution] --> B[Shared tool factory]
  C[Config and session policy] --> B
  B --> D[Captured filesystem policy]
  D --> E[Delegate approval owner]
  D --> F[Media access owner]
  E --> G[Guarded config write]
  F --> H[Allowed file bytes]
Loading

Technical review

Best possible solution:

Retain the synchronous shared-factory backport while leaving approval, live-authority enforcement, and media validation with their existing owners.

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

The extended-stable parent omits policy derivation, while the delegate interprets absent workspaceOnly as unrestricted and media resolution admits default roots; fetched main already contains the upstream repair.

Is this the best way to solve the issue?

Deriving omitted policy at shared construction fixes the missing input without duplicating enforcement or importing the newer asynchronous preparation architecture.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Agent and global filesystem-policy precedence keeps the original intent (878b4e0: Centralize workspaceOnly resolution with agent settings taking precedence over global settings.)
  • Media filesystem restrictions keeps the original intent (824e16f: Prevent dynamic local-media roots from exceeding effective filesystem-read policy.)
  • Task workspace media access keeps the original intent (2433b00: Carry task cwd and filesystem policy into media resolution while preserving session-root containment.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 878b4e0 adds src/agents/tool-fs-policy.ts:22 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 878b4e0ed7cf; files: src/agents/tool-fs-policy.ts)
  • Jacob Tomlinson: Raw commit 824e16f adds src/agents/tool-fs-policy.ts:44 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 824e16f9dddd; files: src/agents/tool-fs-policy.ts)

PR surface

Source +63, Tests +373. Total +436 across 7 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 3 63 0 +63
Tests 4 373 0 +373
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 436 0 +436

Review metrics

Metric Value Why it matters
Production versus regression coverage Production +63/-0; tests and support +373/-0 Production growth propagates existing policy; regression coverage exercises distinct authority, media, and override contracts.

Labels

Label changes:

  • add P1: The extended-stable base can bypass configured restrictions for administrative delegation and outside-workspace media reads.
  • add merge-risk: 🚨 security-boundary: Policy propagation controls automatic persistent writes and local-file access; the supplied final-effect harness covers allowed, restricted, cancelled, and revoked execution.
  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P1: The extended-stable base can bypass configured restrictions for administrative delegation and outside-workspace media reads.
  • merge-risk: 🚨 security-boundary: Policy propagation controls automatic persistent writes and local-file access; the supplied final-effect harness covers allowed, restricted, cancelled, and revoked execution.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

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.

Reviewed October 29, 2026, 12:41 AM ET / 04:41 UTC.

@RomneyDa RomneyDa changed the title [extended-stable/2026.9.33] Preserve filesystem policy in Gateway-built tools [2026.9.36] Preserve filesystem policy in Gateway-built tools Oct 29, 2026
roboclaw-bot and others added 5 commits October 29, 2026 05:14
Only the immutable options adapter is consumed across modules. Keep its implementation helper private so the full export inventory reflects the actual public surface.

Co-authored-by: RomneyDa <[email protected]>
@RomneyDa

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@RomneyDa
RomneyDa merged commit cf98d7c into extended-stable/2026.9.33 Oct 29, 2026
200 checks passed
@RomneyDa
RomneyDa deleted the backport/fs-policy-extended-2026.9 branch October 29, 2026 06:29
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: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants