Repository navigation
fix(agents): refuse unsupported managed mode and unlisted tool actions at save - #3810
Conversation
…s at save Gateway managed mode: a new Agent defaults to on only when the selected Compute Driver declares support; on SSH, Kubernetes without a Gateway runtime and plugin Drivers without the declaration it defaults to off, so the Agent is deployable. An explicit gatewayManagedMode=true on such a Driver is refused at Agent create, create preflight and update with deploy's message instead of at the next deploy. Kubernetes declares support only when its Gateway runtime is configured. Existing Agents and migration 0064 are unchanged. Gateway tool policy: Agent save refuses a core OpenClaw tool that declares a top-level action field (dashboard, screen, computer, github_publish and others in the pinned source) when the policy allows it without tools.gatewayPolicy.actions.<tool>. The pinned OpenClaw throws while assembling such a tool, so every model turn failed after a clean deploy.
|
🦞👀 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 real behavior proof before merge. What this changesThis PR defaults new Agents to supported Gateway managed mode and rejects unsupported managed mode or missing core-tool action lists during admission. Example: Create an SSH Agent named Runtime Agent without specifying gatewayManagedMode.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 5 items remain Keep this maintainer-authored PR open: it addresses source-confirmed admission failures still present on main, with authorization and upgrade verification remaining before merge. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherOCC authorizes and saves Agent drafts, snapshots them into deployment revisions, and delegates runtime enforcement to the selected Compute Driver and packaged OpenClaw Gateway. flowchart TD
A[Agent create or update] --> B[OCC authorization]
B --> C[Compute capability and policy validation]
C --> D[Saved Agent draft]
D --> E[Deployment revision]
E --> F[Compute runtime launcher]
F --> G[OpenClaw Gateway]
Technical reviewBest possible solution: Keep the repair in the existing OCC admission and shared Gateway policy owners, with documented lifecycle decisions and verified authorization and upgrade behavior. Do we have a high-confidence way to reproduce the issue? Current-main admission accepts the unsupported default, and the pinned OpenClaw implementation explicitly throws for missing action lists; no target code was executed during this read-only review. Is this the best way to solve the issue? The focused checks use the existing capability contract and shared policy parser, avoiding a new configuration option or parallel enforcement path. Full review comments:
Overall correctness: patch is correct AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against afc47d3cdeb7. Merge-risk optionsMaintainer options:
Provenance checked
TestingProof path: in-process harness. SecurityNeeds attention: The persisted managed-mode default changes an administration boundary whose final deployment effect still needs verification. EvidenceWhat I checked:
LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
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 Reviewed October 26, 2026, 9:51 PM ET / October 27, 2026, 01:51 UTC. |
…fusals # Conflicts: # tests/conformance/configuration-occ.test.mjs
Problem
Follow-up to #2982 and #2633 (post-land review findings 2676 and 2679). Both are settings that Agent save accepted and that then failed later, against the fail-early rule (refuse at save or preflight, not at deploy or at run time).
gatewayManagedMode: true. On a Compute Driver that cannot apply managed mode (SSH, Kubernetes without a configured Gateway runtime, plugin Drivers that do not declaresupportsGatewayManagedMode), the Agent saved fine and its first deploy was refused. The only fix was an Installation administrator turning the setting off.actionfield (for exampledashboard) withouttools.gatewayPolicy.actions.<tool>was accepted at save and at Gateway start. The pinned OpenClaw (cee236c9,src/agents/gateway-tool-policy.tsapplyGatewayToolPolicy) then throwsGateway tool policy requires tools.gatewayPolicy.actions.<tool>on every tool assembly, so every model turn failed.Change
Managed mode (
packages/occ/src/index.ts, Kubernetes Compute):gatewayManagedMode.supportsGatewayManagedMode, and to off otherwise. With no Compute Driver selected it stays on.gatewayManagedMode: falsestill needs it, as before.gatewayManagedMode: trueon a Driver without support is now refused at Agent create, at the create preflight (/agents/validate) and at update. The 400 uses deploy's existing message:Agent setting gatewayManagedMode is not supported by the selected Compute Driver.(now one constant).KubernetesComputeDriverdeclaressupportsGatewayManagedModeonly whenruntimeis configured, matching its existingvalidateGatewayManagedMode. This uses the existing optional contract member; no Driver contract change.trueis still refused at deploy until an administrator turns it off; the test now covers that path explicitly), and the guided provisioning default (only Kubernetes with a runtime provisions today).Tool policy (
apps/controller/src/drivers/compute/gateway-tool-policy.ts):GATEWAY_ACTION_TOOLSlists the core tools in the pinned OpenClawsrc/agents/toolsthat declare a top-levelactionfield and are outside the baseline and the administrative list: computer, dashboard, github_publish, image_generate, mobile_ui, music_generate, personal_instructions, portal, screen, skill_workshop, theme, transcripts, video_generate.Configuration setting tools.gatewayPolicy.actions.<tool> must list the permitted actions.The same function runs in the Gateway wrappers, so a revision admitted earlier now holds the Gateway unready with the tool-policy error instead of failing every turn.diffs, the documented example, could not be allowed. The docs say plugin tools still need actions when they declare an action field.Docs: the managed-mode reference, native admin and Configuration tool-policy pages, plus the
gatewayManagedModeAPI description (OpenAPI anddocs/reference/api.mdregenerated).Verification
configuration-occ.test.mjs"a new Agent's Gateway managed mode defaults to what the selected Compute Driver enforces": Kubernetes without a runtime defaults off for a member without Installation administer; explicittrueis refused at create, preflight and update; Kubernetes with a runtime defaults on.occ-api.test.mjsSSH test: over HTTP, create defaults off; POST,/validateand PATCH withtrueget 400 with the message; an Agent stored withtrue(the 0064 upgrade state) is still refused at deploy and recovers after PATCHfalse.kubernetes-compute.test.mjsadmission test:allow: ["dashboard"]is refused andactions.dashboard: ["read"]is accepted, for both Harnesses.configuration-occ,kubernetes-compute,occ-api.04168cd67a: CI Required and First Agent Smoke green.f6ba89c67e: 19/22 jobs passed, including First Agent Smoke, every checks-baseline, checks-browser, postgres and k3d-fixture lane, and images-runtime-startup and -3. The three failures:04168cd67a(GitHub Static Checks green);runtime-image-gateway-unclean-restart: fails the same way on that VM on main and is green on GitHub here;Risks
kubernetes/index.tschange is two lines; Move OpenShell attachment status and withdrawal to the paired Sandbox #3808 also edits that file elsewhere.