Skip to content

feat(plugins): expose requester-bound native delegation - #175276

Merged
fuller-stack-dev merged 13 commits into
openclaw:mainfrom
fuller-stack-dev:openclaw/plugin-native-delegation-20261016
Oct 20, 2026
Merged

fuller-stack-dev merged 13 commits into
openclaw:mainfrom
fuller-stack-dev:openclaw/plugin-native-delegation-20261016

Conversation

@fuller-stack-dev

@fuller-stack-dev fuller-stack-dev commented Oct 17, 2026 •

Copy link
Copy Markdown
Member

Related: #175275

What Problem This Solves

Plugins handling normal reply dispatch need a supported way to delegate to native children and collect results without replacing the requester's execution or permission context.

User Impact

Eligible plugins can use optional api.runtime.subagent.native.spawn and collect while retaining the requester's identity, parent incarnation, model policy, finalized tool admission, and sandbox restrictions. Existing background helpers and ordinary noncollector spawning are unchanged. This capability is limited to normal Gateway reply_dispatch; detached callbacks, timers, direct ACP dispatch, and unsupported runtimes do not gain it.

Why This Change Was Made

The facade reuses native spawning, collector ownership, and replay handling instead of adding a scheduler or privileged plugin identity. Identical in-flight requests join; mismatches fail. Tool hooks still run, with reserved native collector/replay parameters checked before effects. Host-only collector context is bound to its exact invocation so nested ordinary waits retain their own requester.

The sandbox follow-up passes the existing prepared sandbox policy into capability admission. Both configured sandbox restrictions and persisted required-sandbox restrictions now apply to native spawn and collection. Denied operations cannot use the facade to bypass the existing tool policy; allowed sandbox operations and unsandboxed controls still work.

The qualification follow-up also includes Peter Steinberger's upstream snapshot call-site fix from c711c07: remove an unsupported argument to the BigInt-stat helper, clearing the compiler/declaration blocker without changing runtime behavior.

Evidence

Draft: required non-draft CI and integrated-current-base validation remain unproved. This is not merge-ready.

  • 111 distinct SDK behavioral cases: 61 freshly passed production-boundary cases, including four sandbox regressions; 50 unchanged, source-bound passing cases reused (34 collector, 7 reply-dispatch, 4 registry, 5 runtime-context). The four focused sandbox cases failed against the previous production adapter and passed after this fix. They are included in 61, not counted twice.
  • The sandbox tests exercise the real reply dispatcher, finalized native tools, and native session/collector implementation. They cover configured and persisted-required sandbox policies for spawn and collection, plus allowed and unsandboxed controls. Only embedded model I/O is mocked. Prior veto, replay, revocation, empty-scope, rewrite, and nested-requester regressions remain covered.
  • 77 separate snapshot/backup tests passed, with 2 Windows-only skips, reused unchanged for the sandbox-only follow-up.
  • Current compiler/build qualification passed: core typecheck, all 29 selected default core-test compiler graphs, and full pnpm build, including declarations and UI build. The actual plugin-SDK compiler graph includes the SDK contract test. No additional root/extension-specific compiler graphs are claimed; the separate type-only Vitest execution is not counted as behavioral or compiler proof.
  • Changed-file formatting and typed lint passed. The complete current changed-check ran all 37 stages: 35 passed, 2 failed. Remaining failures are unchanged UI max-lines suppressions and unrelated dead exports. Their diagnostic source files match the original base; these failures remain red and unwaived, not a successful full baseline build or an integrated-current-base CI result.
  • Full touched-source/test audits and all three independent API-only review partitions completed. The raw latest review reported one issue; direct source inspection disproved it (the inbound authority resolver returns flat fields, unlike the separate nested overlay helper). No supported actionable findings remain after adjudication; this is not a raw-clean helper result. Reviewers inspected source and receipts, not runtime tests.
Current qualification commands and limitations
pnpm tsgo:core
# exit 0

pnpm tsgo:core:test
# exit 0; all 29 selected default graphs, including plugin-sdk

pnpm build
# exit 0; including declarations and UI build

node scripts/run-vitest.mjs src/agents/subagents/spawn/subagent-spawn.production-boundary.test.ts --maxWorkers=1 --reporter=verbose
# exit 0; 61 passed

node scripts/check-changed.mjs --staged --base 65609329cfbf32427aa52b252d342b4537c39976 --timed
# exit 1; 35/37 stages passed, 2 unchanged failures as described above

Runtime checks used isolated state, configuration, and temporary directories; the resolved update-handoff database was verified private before execution. No live deployment or runtime configuration was changed. Historical failed and cancelled attempts are not counted as passes. No integrated-current-base CI or native landing admission is claimed.

@clawsweeper

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

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime agents Agent runtime and tooling plugin: file-transfer size: XL labels Oct 17, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. 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. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Oct 17, 2026
@clawsweeper

clawsweeper Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Adds optional requester-bound native child spawning and result collection to the plugin runtime SDK.

Example: A reply-dispatch plugin delegates task "Review the implementation" with requestId "review-implementation".

  • Before: The supported plugin runtime cannot spawn and collect a native child under the current requester's context.
  • After: native.spawn returns native child IDs, and native.collect retrieves the result while enforcing requester ownership and tool policy.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful, coherent implementation with no actionable finding; confidence rests on supplied production-path harness evidence rather than a shipped-entry-point demonstration.
Proof confidence 🦐 gold shrimp (3/6) Sufficient (terminal): For this maintainer-authored PR, the supplied isolated production-path harness exercises the dispatch adapter, finalized tools, real native session/collector owners and Gateway method boundary; allowed calls succeed while sandbox denials, empty scopes, revoked sources and foreign requester incarnations are refused before the relevant effect or disclosure. The body reports 61 passing cases and four sandbox regressions failing before repair; these are supplied results, not an independent run.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Feature · Worth it: Yes · Fix scope: Complete
User problem: Plugin controllers cannot use supported native child delegation and collection while retaining the current requester's execution context.
Reason: The maintainer-authored direction addresses a concrete SDK gap through a bounded optional capability and preserves existing background-helper behavior.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR fills a supported SDK gap, and the prior sandbox finding is repaired with no new actionable defect found.

Priority: P2
Reviewed head: fc6e602810f38c57b900541fe191f47fdcc8ee62

Before merge

None.

Findings

None.

Agent review details

How this fits together

Gateway reply dispatch supplies the requester context to a plugin-scoped facade, which invokes finalized native tools and returns accepted child IDs or collector results.

flowchart TD
A[Gateway reply dispatch] --> B[Requester capability scope]
B --> C[Plugin native facade]
C --> D[Finalized tool admission]
D --> E[Native spawn and replay owner]
D --> F[Native collector owner]
E --> F
F --> G[Plugin result]
Loading

Technical review

Best possible solution:

Retain the narrow requester-bound facade over existing native owners and complete the draft's normal landing qualification.

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

Source confirms the missing supported SDK capability; the prior sandbox defect has supplied before/after regression evidence, but no target code was executed during this review.

Is this the best way to solve the issue?

The facade fits the existing runtime namespace and preserves native admission, replay and collector ownership instead of introducing a competing scheduler.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Collector ownership and waiting keeps the original intent (ccb1475: Swarm established native collector waiting and requester ownership; later changes preserved cancellation, truthful outcomes and explicit agent ownership.)
  • Claiming-hook admission and timeout keeps the original intent (742f866: Dispatch-owned admission prevents unadopted work and fail-open consumption; the new invocation wrapper retains admission and timeout handling while closing native capability custody.)
  • Plugin registry runtime lifetime keeps the original intent (05a2844: Accepted work retains its supplying plugin owner while retirement closes admission; native calls compose that lifecycle with full-registration checks.)
  • Existing background subagent API keeps the original intent (164bd67: Session forks provide tool-free background side questions; the optional native API leaves that distinct contract intact.)
  • Snapshot BigInt-stat call changes intended behavior with a stated reason (b7bb85a: Snapshot roots require trusted filesystem identity; the explicitly credited upstream correction removes an unsupported argument while preserving BigInt stats.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

  • Introduced patch and policy: Reviewed the pinned introduced diff and all applicable ancestor AGENTS.md files; .agents/maintainer-notes is absent, and the checkout remained clean. (AGENTS.md:1, fc6e602810f3)
  • Current-main capability gap: Fetched main exposes background complete, forkSession, run and wait operations without the proposed native spawn/collect capability; the linked request describes the same bounded requirement: [Feature]: Requester-bound native delegation for plugin controllers #175275. (src/plugins/runtime/types.ts:199, 333a06849b0c)
  • Sandbox repair: The dispatch adapter passes prepared sandbox policy into the capability profile consumed by finalized tool construction, covering both spawn and collection. (src/auto-reply/reply/dispatch-native-subagent.ts:110, fc6e602810f3)
  • Allowed and forbidden effect controls: Four parameterized cases cover configured and persisted-required sandbox denial for sessions_spawn and agents_wait, allowed controls, completed-result disclosure, and unchanged child/transcript state on denial. (src/agents/subagents/spawn/subagent-spawn.plugin-native-sandbox.test-support.ts:176, fc6e602810f3)
  • Authority and invocation ownership: The facade composes live operator and plugin checks, guards finalized replay parameters, and binds collector ownership to the exact invocation and parent incarnation; supporting cases exercise revocation, empty scopes, nested requesters and handler expiry. (src/agents/plugin-native-subagent.ts:52, fc6e602810f3)
  • Supplied qualification and draft hold: The complete body and maintainer follow-up report 61 passing production-boundary cases, including sandbox failures before repair and passes afterward, plus compiler/build qualification; they explicitly retain the draft hold and unproved broader CI qualification. These results were inspected, not independently executed. (fc6e602810f3)

Likely related people:

  • Peter Steinberger: Raw commit ccb1475 adds src/agents/tools/agents-wait-tool.ts:20 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: ccb147518cc8; files: src/agents/tools/agents-wait-tool.ts)
  • Ayaan Zaidi: Raw commit 164bd67 adds src/plugins/runtime/types.ts:200 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 164bd6756af1; files: src/plugins/runtime/types.ts)

PR surface

Source +746, Tests +1648, Docs +31. Total +2425 across 24 files. Added test files: 7.

View PR surface stats
Area Files Added Removed Net
Source 14 797 51 +746
Tests 9 1657 9 +1648
Docs 1 31 0 +31
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 24 2485 60 +2425

Review metrics

Metric Value Why it matters
Public SDK additions 2 optional operations; 0 new configuration options native.spawn and native.collect extend the existing namespace without replacing background helpers.

Root-cause cluster

Relationship: same_root_cause
Canonical: #175275
Summary: The linked feature request specifies the same requester-bound native spawn and collection capability.

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: A bounded plugin-controller capability merits normal feature review without evidence of an urgent user-facing regression.
  • merge-risk: 🚨 compatibility: This expands the supported plugin API; member-authored direction, optional typing, documentation and contract tests establish its additive contract.
  • 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.

History

Review history (2 earlier review cycles)
  • reviewed 2026-10-17T07:21:42.211Z sha 5c8dfaa :: needs real behavior proof before merge. :: [P1] [P1] Preserve the requester's sandbox tool policy
  • reviewed 2026-10-17T08:11:36.052Z sha fc6e602 :: needs maintainer review before merge. :: none

Reviewed October 17, 2026, 4:18 AM ET / 08:18 UTC (Revision 3).

Apply Peter Steinberger's upstream call-site correction from c711c07 to unblock typechecks and declaration generation.
@fuller-stack-dev

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

Updated in fc6e602: the native capability now honors both configured and persisted required-sandbox policy for spawn and collection. Four production-boundary regressions fail with the previous adapter and pass with the fix; the complete affected production suite passes 61 cases. The PR description has the current compiler/build evidence, reused test counts, and remaining CI/baseline limitations.

@clawsweeper

clawsweeper Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. 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 rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Oct 17, 2026
@fuller-stack-dev
fuller-stack-dev marked this pull request as ready for review October 18, 2026 16:23
@fuller-stack-dev
fuller-stack-dev enabled auto-merge (squash) October 18, 2026 20:55
@fuller-stack-dev
fuller-stack-dev enabled auto-merge (squash) October 20, 2026 00:05
@fuller-stack-dev
fuller-stack-dev merged commit 46d7d89 into openclaw:main Oct 20, 2026
148 checks passed
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 20, 2026
)

* feat(plugins): expose requester-bound native delegation

* fix(snapshot): match bigint stat helper signature

Apply Peter Steinberger's upstream call-site correction from 108185f to unblock typechecks and declaration generation.

* fix(plugins): enforce sandbox policy for native delegation

* fix(decisions): finalize accepted usage across callers

* fix(agents): bind native collector ownership to tool identity

* test: remove native spawn fixture import cycle

* fix(plugins): keep native hook admission host-owned

* fix(plugins): reject shared backing before hook cloning
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. plugin: file-transfer proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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