Repository navigation
fix: restricted intake agents cannot delegate coding work - #168085
Conversation
Preserve the full requester fallback while supporting explicit exact-target native delegation of agent-local deny policy. Keep completion snapshots and live effect authority; refuse unsupported worker and mediated handoffs. Co-authored-by: steipete <[email protected]>
Worked on by: - @steipete Co-authored-by: steipete <[email protected]> OpenClaw-Publication: 5064aef4-092a-4170-b0bf-331fbaef7511
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThis PR lets operators authorize selected coding agents to use tools denied locally to their intake agent. Example: The intake agent denies exec and write but grants delegateToolsTo: ["coder"] alongside allowAgents: ["coder"].
Review scores
ProductKind: Feature · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it provides a useful, maintainer-sponsored delegation capability absent from main, and no actionable introduced defect was found. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherAgent policy assembly combines operator configuration and persisted session lineage into child tool availability and authority checks before command or file effects. flowchart TD
A[Operator configuration] --> B[Intake policy assembly]
B --> C[Native spawn admission]
C --> D[Persisted child policy]
D --> E[Coding tool assembly]
A --> F[Live grant check]
E --> F
F --> G[Command and file effects]
Technical reviewBest possible solution: Retain the explicit target grant, existing restriction fallback, and live effect checks through the normal landing gates. Do we have a high-confidence way to reproduce the issue? Main preserves the intake's inherited deny ceiling, explaining the reported limitation; the supplied pre-fix regression corroborates it, and no target code was executed during this review. Is this the best way to solve the issue? The explicit operator grant is appropriate because changing allowAgents alone would weaken the established inheritance contract. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against bc524d890300. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +606, Tests +1490, Docs +54, Generated 0. Total +2150 across 57 files. Added test files: 4. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (3 earlier review cycles)
Reviewed October 9, 2026, 11:49 PM ET / October 10, 2026, 03:49 UTC (Revision 4). |
Regenerate the two conflicting config baseline projections and preserve the upstream memory-flush tool restriction. Integrated delegation and X composition regressions pass. Co-authored-by: steipete <[email protected]>
|
Co-authored-by: steipete <[email protected]>
Co-authored-by: steipete <[email protected]>
Retain the reviewed abort-aware settlement fixture; preserve upstream fallback diagnostics. Co-authored-by: steipete <[email protected]>
Remove the superseded retry-context workaround after integrating #168078. Retain upstream canonical projection and internal fallback continuation coverage. Co-authored-by: steipete <[email protected]>
|
Merged via squash.
|
…68085) * fix: restricted intake agents cannot delegate coding work Preserve the full requester fallback while supporting explicit exact-target native delegation of agent-local deny policy. Keep completion snapshots and live effect authority; refuse unsupported worker and mediated handoffs. Co-authored-by: steipete <[email protected]> * fix: restricted intake agents cannot delegate coding work Worked on by: - @steipete Co-authored-by: steipete <[email protected]> OpenClaw-Publication: 5064aef4-092a-4170-b0bf-331fbaef7511 * fix: complete delegated execution proof and CI fixtures Co-authored-by: steipete <[email protected]> * fix: preserve admitted prompts across model fallback Co-authored-by: steipete <[email protected]> * fix: use upstream fallback projection owner Remove the superseded retry-context workaround after integrating openclaw#168078. Retain upstream canonical projection and internal fallback continuation coverage. Co-authored-by: steipete <[email protected]> --------- Co-authored-by: steipete <[email protected]>
…turns (#183765) * fix(claude-cli): let operators keep selected native Claude Code tools on managed turns * fix(claude-cli): retire warm sessions while native descendants still run Claude Code reparents a nested Agent when its foreground parent finishes, and a subagent's background child can resume its Agent later. Neither holds the turn, so a warm process kept them alive into the next admitted turn, where native permission callbacks and the process MCP bearer resolve to that turn's authority. Close the process instead when any Agent, Workflow, or subagent-owned task is still running at turn end. * docs(claude-cli): describe warm-process retirement for running native descendants --------- Co-authored-by: VACInc <[email protected]> Release adaptation: stable has no delegated-execution tool policy (#168085), so managed native tools are dropped only for restricted senders, caller caps, and workspace-only runs (docs, manifest help, and the SDK doc comment no longer mention delegated execution); resolveCliRuntimeToolPolicy stays synchronous. The descendant-retirement hunk lands on the #170322 task-ownership port. Tests are ported into stable's structure: the delegation policy test becomes prepare-tool-policy.managed-native.test.ts, the bootstrap file-access case moves to prepare.bootstrap-file-access.test.ts, and the cli-runtime fixture harness is shared via cli-runtime.harness.test-support.ts so task-ownership cases live in cli-runtime.task-ownership.test.ts (keeps both files under the line cap). Adds a subagent-owned and a reparented nested-descendant scenario. Adds the plugins.entries.anthropic.config.managedNativeTools option (off by default). (cherry picked from commit 3eeb12b)
What Problem This Solves
Fixes: a restricted intake agent can start a coding session, but its local command/file denials leave that coding session unable to implement the requested change.
User Impact
Operators can explicitly authorize native handoffs to exact coding agents with
agents.entries.<intake>.subagents.delegateToolsTo, alongsideallowAgents, without enabling those tools on the intake agent. Existing configurations and previously created children keep their original restrictions.The initial handoff requires a deny-only Gateway-native requester and local placement. Restrictive allowlists, sender restrictions, sandbox boundaries, and target policy remain enforced. ACP is unchanged. Unsupported mediated/cloud handoffs and worker execution of an active grant refuse rather than silently start an unusable or insufficiently guarded run. No live deployment or configuration change is included.
Why This Change Was Made
Keep an explicit target grant separate from the original requester snapshot. Only the requesting agent's local deny layer can be waived; nonlocal denials survive even when they name the same tool. Same-grantee helpers retain the root-bound grant, completions retain their per-edge requester snapshot, and grant removal restores the fallback. Retained tools recheck live authority before effects, including after preparation and file-I/O waits. Already-started effects are not rolled back.
The config baseline grows by two schema nodes for this opt-in array and its item. This is intentional: changing
allowAgentsalone would silently widen existing delegation authority. There is no database schema/version change or inferred upgrade of legacy session rows.Evidence
Current repair head: 7e2c4a2. The merge conflict against main bc8f693 is resolved, retaining the reviewed abort-aware catalog-renewal fixture. The independently landed upstream fallback projection repair (#168078) supersedes our temporary workaround, which is removed rather than retained as a second owner. Historical checks below remain labeled with their tested inputs; final-head hosted CI/review remain separate gates.
exec,write,edit, andapply_patchdenials retained (8.21s wrapper time).sessions.create/SQLite, child file write and command execution, anonymous HTTP read, guest denial, and separate deferred delegation/publication revocation. Assertions: 8.195s; Vitest including compilation: 84.17s; isolated QA build: 288.5s. HTTPS/model boundaries are deterministic, not live X credentials. The fixture remains release-only (0 added ordinary unit-CI seconds); hosted CI timings are not yet available.Integration at
5aa6d54bb80db8ba29efcd670ab9c4b90c1c4029resolves the two generated config-baseline conflicts against main4ac1a8028b3. The owning generator refreshed them; the upstream memory-flush restriction is preserved. All 132 selected regressions passed (136.51s), including the memory-flush sibling, and the unchanged full X composition passed again on the integrated source (7.921s assertions, 66.03s Vitest). Core typecheck, config baseline validation, and affected lint passed.Original-base validation observations: the broad dead-export scan reports untouched
isTelegramReadOnlyControlLaneTextand the unusedmodel-selection.tsre-export ofresolveContextTokens. One isolated QA build also produced an unparseable bundled TypeBoxFromCyclicdeclaration; identical production inputs built successfully in adjacent runs. This is recorded as an unresolved build-tool failure, not claimed fixed by a passing replay.Final conflict-resolution head also passes core typechecking and the complete isolated X production-owner composition: 8.806s assertions / 86.90s Vitest, QA runtime build successful, outer exit 0 and container absence confirmed. This re-exercises the updated public entry path, actual child command/file effects, guest denial, and independent delegation/publication revocation on the merged source. Deterministic transport/model boundaries remain as disclosed.
CLI/plugin mediated final effects
The new
src/agents/harness/mediated-delegation-effects.test.tsruns both the production CLI authenticated loopback-HTTP path and generic plugin-harness dispatch against real command/file owners. The grant-dependent tools launch a real command and write a file; sender-restricted calls launch nothing; revocation during command preparation or after descriptor opening prevents the final effect. Reconstructed tools restore the deny fallback while retaining read access.Eight tests pass on
5aa6d54plus the behavior-preserving import-cycle repair and regenerated prompt snapshots:pnpm test src/agents/harness/mediated-delegation-effects.test.ts --maxWorkers=1, 21.73s wall / 17.67s Vitest / 4.229s test cases. The owning test-type graph, scoped lint, formatting and whitespace checks pass. Hosted CI seconds are not yet available for this addition. Test-file SHA-256:9838af1ba7457c396722cb9a10f0cb7f6c661e369aa2ae461797919de853f045.This is real mediated-boundary/final-effect proof, not a vendor CLI subprocess, live model-provider or Codex CLI run. Exec policy is full/off: revocation is tested during preparation and final file I/O, not an interactive approval queue. The sender-source fixture tests the persisted policy boundary; existing X composition tests cover actual ingress and spawn creation.
Sanitized traces emitted by the passing run
{"route":"cli-loopback","trace":["native=[]","supervisor:spawn-requested","supervisor:launched","exec:completed","mcp-client:exec:ok","write:completed","mcp-client:write:ok"],"launches":1,"finalFile":"write-effect","resumed":{"exec":false,"write":false,"read":true}} {"route":"cli-loopback","stage":"sender-denied","trace":["native=[]","mcp-client:exec:error","mcp-client:write:error"],"launches":0,"finalFile":"original"} {"route":"cli-loopback","stage":"command-preparation","trace":["native=[]","command-preparation:waiting","delegation:revoked","command-preparation:released","exec:failed","mcp-client:exec:error"],"launches":0,"finalFile":"original","denied":"tool invocation authority is no longer active"} {"route":"cli-loopback","stage":"file-open","trace":["native=[]","file-open:waiting-before-mutation","delegation:revoked","file-open:released","write:failed","mcp-client:write:error"],"finalFile":"original","denied":"tool invocation authority is no longer active"} {"route":"plugin-harness","trace":["supervisor:spawn-requested","supervisor:launched","exec:completed","write:completed"],"launches":1,"finalFile":"write-effect","resumed":{"exec":false,"write":false,"read":true}} {"route":"plugin-harness","stage":"sender-denied","trace":["exec:failed","write:failed"],"launches":0,"finalFile":"original"} {"route":"plugin-harness","stage":"command-preparation","trace":["command-preparation:waiting","delegation:revoked","command-preparation:released","exec:failed"],"launches":0,"finalFile":"original","denied":"Error: tool invocation authority is no longer active"} {"route":"plugin-harness","stage":"file-open","trace":["file-open:waiting-before-mutation","delegation:revoked","file-open:released","write:failed"],"finalFile":"original","denied":"Error: tool invocation authority is no longer active"}Latest-stable produced-data compatibility
A secretless, network-disabled rootless container used the actual published 2026.9.9 package (
bcfc88812a35243893585dbeca87ca41b48272ca, npm latest live-resolved and rechecked) to produce config, SQLite sessions and two native child rows. Candidate5aa6d54bb80db8ba29efcd670ab9c4b90c1c4029built successfully withpnpm build(235.9s), then its real Doctor migrated copied stores: state 19→20, both agent databases 24→25. All three candidate CLI preflights returned exact, integrity ok.Both child rows remained byte-identical, including inherited allow/deny lists, creation attribution, parent/completion links, IDs and revisions. After adding an explicit candidate grant and cold-loading in another container, neither old child acquired
delegatedToolPolicy, both resolved frompersisted-child, and exec remained excluded. All preexisting settings values stayed unchanged; the whole config file is not byte-identical because Doctor added its webhook migration stamp, four wizard metadata fields, and 31 disabled-unavailable-skill entries.Scope: real stable-produced state → candidate Doctor/admission/read/policy owners. Not a published updater-installation/service-replacement/Gateway-readiness/inference test. Stable's private native-child persistence function was exposed through an export-only loader adapter; its body and installed package bytes were unchanged. Stable does not stamp the present-day sender-source flags, so this does not prove retention of an already-present sender flag. An auxiliary parent's hand-supplied legacy webchat origin normalized under the existing migration; it is not external-sender-provenance proof.
Compatibility commands and exact row results
Pinned image:
sha256:2c1f4e0fd6450f43ddb46d60c2a6df30855a8588e165b1f2559fb0eda8d7ff35; Node 24.20.0; read-only rootfs, no network, capabilities dropped, no operator state or credentials mounted. All task containers were removed.The schema migrations are existing base changes, not delegation-specific schema additions. Doctor could not perform an optional btrfs NOCOW rewrite because the image lacked GNU mv options; those stores stayed in place and the schema/integrity/retention checks above still passed.
CI repairs and retained failures
The static import cycle is removed by relocating the unchanged deny-floor projection and sharing its narrow context contract. Both cycle guards pass. The five changed prompt snapshots were regenerated through their owner and the snapshot check passes. The catalog-renewal fixture no longer starts an extra explicit refresh while trying to join expiry renewal; this repairs the stale test contract introduced with #168050 without changing production refresh semantics.
The earlier CI run 38016450576 exposed a preexisting command-RPC fallback defect: the backup was selected, then retry decoration tried to recapture the immutable user prompt after provider dispatch. A temporary attempt-owner repair reproduced red-to-green behavior (116 tests at the earlier baseline), but main independently repaired the canonical prompt-state owner in #168078 / 22bca7d. This branch now uses that upstream owner unchanged and removes its temporary repair and representation-specific assertions.
Post-cutover validation on exact Node 24.19.0 passed all 71 cases across six files: 13 Gateway fallback cases, 11 durable projection cases, 31 requester/retained-authority cases, 8 mediated effects, and 8 visible-spawn cases. The projection tests require the canonical original plus an internal retry, exactly one persisted user row, and unchanged plain/enriched projections. Independent cutover review found no actionable issue. Vitest completed five shards in 261.68s; the outer wrapper subsequently timed out during its post-run container inspection (30s), so this is test success, not a clean wrapper exit. The task container was confirmed absent afterward. No tests were rerun merely to conceal that infrastructure failure.
Before the cutover, merged-head worker/topology/catalog proof had 73 passing cases and one assertion failure: our temporary test compared the last user-role item, which now intentionally represents the upstream internal retry. Restoring the three fallback files exactly to main removes the superseded workaround; it does not weaken the canonical projection guard or delegation authority.
Activation’s original CI early-settlement failure remains an investigated, unreproduced observation: complete baseline and candidate files pass on host Node 24.19.0, while a broader baseline host replay hit unrelated HTTP fixture failures and is not passing proof. Candidate container activation failed earlier at bind/auth admission, not the CI boundary. No activation fix is claimed from these passing replays. The integrated catalog/activation run passed 10/10 (111.75s wrapper); after the catalog listener-cleanup correction its five cases passed again (11.28s wrapper), with its owning type graph passing.
Worked on by
Work sessions
Discussion, implementation and verification
Mediated-effect implementation and verification
Stable-state compatibility verification
Fallback investigation and verification
View the OpenClaw team session