Skip to content

feat: run sandbox Auto Review with a restricted host reviewer - #173455

Merged
shakkernerd merged 4 commits into
mainfrom
feat/autoreview-sandbox-tool
Oct 16, 2026
Merged

shakkernerd merged 4 commits into
mainfrom
feat/autoreview-sandbox-tool

Conversation

@shakkernerd

@shakkernerd shakkernerd commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Sandboxed development needs the canonical Auto Review checkpoint to review the repository the session is editing. Its Git state can differ from the host worktree, while provider credentials and the OpenClaw CLI belong to the host. The existing plugin context did not expose the actual prepared sandbox and current caller authority needed to complete that operation.

User Impact

The optional autoreview plugin adds one tool call for this checkpoint. The installed helper captures and rechecks changes inside the current sandbox, the host runs the admitted reviewer through openclaw agent exec, and the same helper validates its complete output. Operators enable the plugin and grant the tool through the existing agent and sandbox policies. The integration requires the canonical helper from openclaw/agent-skills#328 and the native run-only configuration override in #173636.

A normal call supplies the review target. The canonical helper owns review model, effort, severity, prompts, pass planning, and timeout defaults, so an installed-helper update changes those defaults without rebuilding OpenClaw. Explicit overrides remain available. An allowed configured model is preserved; a prohibited configured preference uses the caller's existing permitted default before execution. Explicit prohibited choices are rejected, and execution failure never switches models or engines. The canonical status records the effective model.

Native execution inherits ordinary host configuration and authentication. Run-only restrictions give the reviewer an empty private workspace, no tools or selected skills, no injected workspace context, and no remembered permission grant that could relax those restrictions. Saved configuration is unchanged and credentials remain on the host. Complete report/status results fit within the existing Code Mode full-value route; oversized direct calls fail explicitly with guidance to use Code Mode or split the review.

Why This Change Was Made

The existing native and plugin harness owners now capture the original invocation authority and skill installation identity for version 2 tool factories. The sandbox owner supplies the actual execution working directory and protected installed package. Repository-local shadows, writable aliases, package-replacing mounts, and backends without enforced read-only resources do not qualify. This preserves the distinction between a host workspace and the repository projected into a sandbox.

The plugin transports the existing helper request/response exchange. It binds the first pass plan, admits its model through the existing model-policy owner, launches the fixed native CLI entry, and returns the complete raw CLI envelope to the helper. No host configuration object, executable path, credential, or runtime grant comes from sandbox output. Capture, source revalidation, response ownership, report parsing, and review policy remain with the canonical helper.

The required backend adaptation explicitly admits piped input while retaining background process and workspace-finalization ownership. Cancellation and model-policy revocation settle each operation's helper, waiter, and reviewer before releasing authority. Reviewer cancellation gives native cleanup up to five seconds before forced termination; concurrent invocations own separate temporary exchanges. Complete-result delivery reuses the existing direct-call budget and Code Mode value owner. The optional plugin has no custom settings, reviewer profile, service, or persistent job store.

Evidence

The earlier temporary-storage guard failure is corrected by using the SDK temporary-directory owner. The retained process mock now documents its isolation contract; the superseded model-projection mock was removed with the projection.

Changed formatting/lint and the affected core, agent-test, extension, and extension-test compiler graphs passed. After conflict resolution, the affected tool, native-caller, and result-delivery files passed all 68 cases in 50.17 seconds, with the affected type graphs and generated metadata rechecked. The tool and execution-owner suites passed 23 cases across the focused runs. The latest tool-only run passed 11 cases in 32.80 seconds including cold SDK preparation; the unchanged execution-owner cases retain their earlier joined 34.35-second batch. Earlier applicable controls cover actual native caller preparation, remapped skill discovery, protected mounts and writable aliases, managed-workspace process lifetime, stdin, revocation, and ordinary versus full-value result delivery. The remaining 44 literal caller files passed 577 cases with one Windows-only skip in 338.54 seconds on the qualified combined source.

A synthetic near-limit response passed through the real canonical helper, plugin lifecycle wrapper, tool, catalog value call, and Code Mode inbox on the combined source: all 283 findings and the effective-model receipt survived a 1,989,634-byte encoded exchange. The same flow rejected an oversized direct result, accepted a small complete direct result, preserved source state, and removed each exchange. This transport case substitutes reviewer output and caller authority; it is not a live provider claim.

A separate provider-effect control exercises the real invocation admission, model-policy binding, plugin instance, Code Mode value call, canonical helper, and native CLI against an observed synthetic HTTP provider. The allowed review made one request and returned a complete validated report in 11.85 seconds. After the real prompt handoff and native startup, the second case removed the selected model from the caller’s permitted policy and notified the existing policy owner: it made zero provider requests, rejected the authority, and exited cooperatively in 3.87 seconds. Every owned command process had settled; native state, host review directories, and helper exchanges were removed; authority subscriptions were released; source and saved configuration were unchanged. The test uses the existing local helper transport fixture; actual protected sandbox binding is covered by the separate guest execution above. No real provider or credential was used.

The native CLI and canonical helper dependencies separately passed an actual synthetic-provider command proving inherited configuration/authentication, custom environment references, no tools or ambient skills, and unchanged saved configuration. The clean combined runtime build, including the final caller-grace correction and native cleanup dependency, passed in 280.4 seconds. In the actual guest UI, a target-only call returned a complete scoped-clean report in a 33-second parent turn. Changing only the installed helper defaults then selected the configured allowed model and detected a known P2 defect; restoring the source passed its tests and review. Additional live checks confirmed permitted-default selection for a prohibited configured preference, rejection of an explicit prohibited override without substitution, two concurrent completed reviews, and cancellation of one review while the other completed. The integration settled its helper and reviewer processes and removed its exchanges. The required native CLI ephemeral-state cleanup repair has landed in #173761. The final two-guest early-Stop check used that repair and the five-second caller grace: the stopped guest was interrupted, the other target-only review completed scoped-clean in 25 seconds, and all native state, host review directories, and sandbox exchanges were gone while both guest containers remained running. An early-start cancellation control exposed forced termination at the process owner’s 300 ms default. The reviewer caller now uses its existing five-second grace option; the same control exited cooperatively in 3.94 seconds with no provider request, surviving process, or temporary state. Independent review is clean for the landing composition containing the native cleanup repair, and all exact-head hosted checks passed.

@clawsweeper

clawsweeper Bot commented Oct 15, 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.

@github-actions github-actions Bot added the dependencies-changed PR changes dependency-related files label Oct 15, 2026
@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Dependency graph changes

This maintainer PR changes the dependency graph.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: 5f6e79d2fb40889cf0ac077a2fde09dc882138c1
  • Maintainer: @shakkernerd
  • Repository role: maintain

These dependency graph changes were made:

  • pnpm-lock.yaml
  • extensions/autoreview/package.json

Carefully review these changes before merging.

@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: 5f6e79d2fb40889cf0ac077a2fde09dc882138c1
  • Maintainer: @shakkernerd
  • Repository role: maintain

These security sensitive changes were made:

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

Carefully review these changes before merging.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation agents Agent runtime and tooling size: XL labels Oct 15, 2026
@shakkernerd
shakkernerd force-pushed the feat/autoreview-sandbox-tool branch from 9061979 to b742ff9 Compare October 15, 2026 20:39
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 15, 2026
@clawsweeper

clawsweeper Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Adds an optional Auto Review tool that captures sandbox changes and runs a restricted, caller-authorized reviewer on the host.

Example: A sandbox session calls autoreview with {"mode":"local"}.

  • Before: The plugin cannot bind review execution to the prepared sandbox and original caller authority.
  • After: The installed helper captures sandbox changes, the host runs the permitted reviewer, and the helper returns a complete validated report.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Coherent optional feature with shipped-entry-point evidence, a resolved authority-proof gap, compatible additive contracts, and no open findings.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): Supplied guest execution exercises protected sandbox capture, helper defaults, model denial, concurrent reviews, and Stop cleanup; the real plugin/helper/native-CLI provider control records one allowed request and zero requests after model-policy revocation, resolving the prior rank-up request.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Feature · Worth it: Yes · Fix scope: Complete
User problem: Sandbox changes need review without substituting host Git state or exposing host credentials and tools.
Reason: Maintainer-authored direction delivers a concrete checkpoint through an optional plugin and narrow generic capabilities.

Merge readiness

✅ Ready for maintainer review

This maintainer-authored PR adds a useful sandbox review capability; no actionable introduced defects remain in this review.

Priority: P2
Reviewed head: 5f6e79d2fb40889cf0ac077a2fde09dc882138c1

Before merge

None.

Findings

None.

Agent review details

How this fits together

The plugin connects the sandbox-owned review helper to host-native inference, carrying caller authority and returning complete reports through existing tool-result delivery.

flowchart LR
  A[Sandbox session] --> B[Auto Review plugin]
  B --> C[Protected sandbox helper]
  C --> D[Captured review request]
  D --> E[Caller model authority]
  E --> F[Restricted native reviewer]
  F --> C
  C --> G[Validated report]
Loading

Technical review

Best possible solution:

Land the optional plugin with the merged native prerequisites and current canonical helper while retaining existing authority and result-delivery owners.

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

This is a capability addition; source inspection confirms the missing sandbox-bound execution contract, and supplied guest runs exercise the added flow.

Is this the best way to solve the issue?

The implementation fits the existing plugin, sandbox, model-policy, native CLI, and canonical-helper owners without introducing a competing review engine or persistent job service.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Plugin invocation authority keeps the original intent (861f60e: Keep retained plugin effects bound to current invocation and plugin lifecycle authority.)
  • Prepared native tool context keeps the original intent (ddcae51: Carry prepared execution facts through asynchronous tool construction while preserving live checks.)
  • Code Mode result projection and scheduling keeps the original intent (fix(code-mode): nested tool errors lose their message when details only flag the error #159359: Preserve nested-tool error messages in projected values; sequential-tool scheduling remains owned by the shared runtime.)
  • Sandbox mount interpretation keeps the original intent (0ab1513: Keep filesystem tools aligned with overlapping mounts and protected resource precedence.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Shakker: Raw commit 08f5fb8 adds src/agents/sandbox/docker-backend.ts:222 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 08f5fb80f301; files: src/agents/sandbox/docker-backend.ts)
  • Peter Steinberger: Raw commit ddcae51 adds src/agents/harness/host-capability.ts:424 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: ddcae5101d78; files: src/agents/harness/host-capability.ts)
  • 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: high; commits: 861f60e0bc5c; files: src/plugins/tool-factory-context.ts)
  • Vincent Koc: Raw commit 0ab1513 adds src/agents/sandbox/fs-paths.ts:44 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 0ab1513aaedf; files: src/agents/sandbox/fs-paths.ts)

PR surface

Source +1002, Tests +829, Docs +127, Config +10, Generated 0, Other +10. Total +1978 across 35 files. Added test files: 2.

View PR surface stats
Area Files Added Removed Net
Source 19 1015 13 +1002
Tests 6 831 2 +829
Docs 6 129 2 +127
Config 1 10 0 +10
Generated 2 3 3 0
Other 1 10 0 +10
Total 35 1998 20 +1978

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: A useful optional developer capability with limited blast radius.
  • merge-risk: 🚨 compatibility: Adds public version-2 plugin capabilities and sandbox stdin admission; existing signatures and default behavior remain compatible.
  • merge-risk: 🚨 security-boundary: Connects sandbox requests to host inference; protected helper binding, restricted native execution, and allowed/revoked provider-effect controls address the boundary.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • 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.

History

Review history (2 earlier review cycles)
  • reviewed 2026-10-15T20:57:25.163Z sha b742ff9 :: needs real behavior proof before merge. :: [P2] Use the SDK temporary-directory owner for host review state | [P2] Explain the isolation contract for the two closed module mocks
  • reviewed 2026-10-16T05:22:58.934Z sha 5f6e79d :: needs real behavior proof before merge. :: none

Reviewed October 16, 2026, 1:39 AM ET / 05:39 UTC (Revision 3).

@shakkernerd
shakkernerd force-pushed the feat/autoreview-sandbox-tool branch 2 times, most recently from 1982924 to 4e4bf9a Compare October 16, 2026 04:55
@shakkernerd
shakkernerd force-pushed the feat/autoreview-sandbox-tool branch from 4e4bf9a to 5f6e79d Compare October 16, 2026 05:06
@shakkernerd

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Oct 16, 2026
@shakkernerd

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. labels Oct 16, 2026
@clawsweeper clawsweeper Bot added status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. 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. labels Oct 16, 2026
@shakkernerd
shakkernerd merged commit 24ed521 into main Oct 16, 2026
204 checks passed
@shakkernerd
shakkernerd deleted the feat/autoreview-sandbox-tool branch October 16, 2026 05:46
@shakkernerd

Copy link
Copy Markdown
Contributor Author

Added: sandboxed code review with a restricted host reviewer and complete validated results.

steipete added a commit that referenced this pull request Oct 16, 2026
The optional Auto Review plugin landed in 24ed521 (#173455) without
an extension labeler rule. Add the standard path registration so the
repository-wide coverage contract includes extensions/autoreview.

The plugin registers a tool, not typed hooks, so no hook inventory entry
is needed. Existing package metadata and TypeBox dependency are complete;
all 580 boundary, package and runtime-dependency contract cases pass.
The labeler failure reproduces on main; the repaired labeler and cap
suites pass all 9 cases. No production code, assertions or deadlines change.
Formatting and diff checks pass; independent P2 review is clean (0.99).
steipete added a commit that referenced this pull request Oct 16, 2026
Hourly 38863277510 found exports left behind by recent owner refactors.
Fresh main also exposes a retired queue preparation API and two Slack
assertion helpers. Remove six uncovered exports at their owners:

- Keep the Auto Review parameter schema and theme initial state private.
- Register the chat bridge without exporting its unused component alias;
  exercise its existing registered host in both affected tests.
- Inline the queue-clear preparation into its sole immediate caller,
  preserving selection, lane identity, rejection, and survivor ordering.
  Remove the stale abort mock and cover selective clearing through the API.
- Keep two Slack assertion helpers private, retaining all their assertions.

No Knip ignores, policy changes, retries, timeout changes, or removed test
cases. Production exports fall from five to the one palette factory covered
by active PR #173919; full-tree and script exports are clean. References:
#173455, #173688, #173833. Production shrinks by nine lines.

Proof: all three deadcode scripts, focused owner tests with --maxWorkers=1,
core/UI/extension production types and owning test types, targeted lint,
boundary lint, format, assertion safety, and isolated P2 review. Shared
Slack helper proof runs its sole importer in full. New selective-clear
case passes inside its seven-case file in 4.69s. The three unchanged global
max-lines suppression findings are inherited, with base blobs verified.

Changed-test wall times: chat-page 21.00s, snapshot custody 30.78s,
abort 58.02s, queue cancellation 4.69s. The sole Slack helper importer
passes all 90 tests in 75.86s. Total focused coverage: 205 cases.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 17, 2026
…aw#173455)

Add an optional sandboxed code-review tool that preserves caller permissions and returns canonical validated reports through a restricted host reviewer.

Refs openclaw#173636 and openclaw#173761.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 17, 2026
The optional Auto Review plugin landed in 09b9660 (openclaw#173455) without
an extension labeler rule. Add the standard path registration so the
repository-wide coverage contract includes extensions/autoreview.

The plugin registers a tool, not typed hooks, so no hook inventory entry
is needed. Existing package metadata and TypeBox dependency are complete;
all 580 boundary, package and runtime-dependency contract cases pass.
The labeler failure reproduces on main; the repaired labeler and cap
suites pass all 9 cases. No production code, assertions or deadlines change.
Formatting and diff checks pass; independent P2 review is clean (0.99).
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 17, 2026
Hourly 38863277510 found exports left behind by recent owner refactors.
Fresh main also exposes a retired queue preparation API and two Slack
assertion helpers. Remove six uncovered exports at their owners:

- Keep the Auto Review parameter schema and theme initial state private.
- Register the chat bridge without exporting its unused component alias;
  exercise its existing registered host in both affected tests.
- Inline the queue-clear preparation into its sole immediate caller,
  preserving selection, lane identity, rejection, and survivor ordering.
  Remove the stale abort mock and cover selective clearing through the API.
- Keep two Slack assertion helpers private, retaining all their assertions.

No Knip ignores, policy changes, retries, timeout changes, or removed test
cases. Production exports fall from five to the one palette factory covered
by active PR openclaw#173919; full-tree and script exports are clean. References:
openclaw#173455, openclaw#173688, openclaw#173833. Production shrinks by nine lines.

Proof: all three deadcode scripts, focused owner tests with --maxWorkers=1,
core/UI/extension production types and owning test types, targeted lint,
boundary lint, format, assertion safety, and isolated P2 review. Shared
Slack helper proof runs its sole importer in full. New selective-clear
case passes inside its seven-case file in 4.69s. The three unchanged global
max-lines suppression findings are inherited, with base blobs verified.

Changed-test wall times: chat-page 21.00s, snapshot custody 30.78s,
abort 58.02s, queue cancellation 4.69s. The sole Slack helper importer
passes all 90 tests in 75.86s. Total focused coverage: 205 cases.
RomneyDa pushed a commit that referenced this pull request Oct 26, 2026
…ol authority

Backport 714d666 (main 6a62821) declares codex_threads for every
sender and rejects nonowners inside execution. Port main's follow-up
74dfd5e, which expects the inherited declaration and the
owner-authorization denial instead of an undeclared tool.

Release adaptation: main's harness host passes its liveness check as plugin
invocation authority (#173455, not on stable). Stable takes that authority
from the admitted Gateway caller that run-attempt dispatch
(withPreparedEmbeddedGatewayTools) keeps ambient for the attempt, so the
fixture now supplies the same admitted caller identity for non-worker turns.

(cherry picked from commit 74dfd5e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling dependencies-changed PR changes dependency-related files docs Improvements or additions to documentation 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: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. security-sensitive-changed size: XL 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.

1 participant