You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 23a681e
Browse filesBrowse the repository at this point in the historyBrowse files
fix(system-agent): tell messaging users a delegated approval can't be applied from chat (#116519) (#117432)
* fix(system-agent): surface operator-only approval handoff on all delegated routes (#116519)
Delegated OpenClaw writes from messaging channels told the user to approve
conversationally ("Say yes to apply"), but delegated sessions intentionally
ignore chat approvals — only an operator in the OpenClaw UI can resolve them.
- Default agent-loop route: thread operatorApprovalOnly from the engine
through the turn runner into the ring-zero tool options; the tool registers
the delegated proposal for the operator registry and instructs the model to
surface the OpenClaw operator UI / `openclaw` CLI path instead of a
dead-end conversational prompt (the needs-approval marker is kept so
out-of-process CLI hosts still mirror the refusal).
- Planner-fallback route: the delegated reply preserves refusal evidence
(what was requested, that it was not applied) alongside the operator
handoff.
- Gateway: the closed SystemAgentChatResult schema is unchanged — the
openclaw.chat response carries only needsApproval/proposalId; no
approvalHint field.
- Coverage: real agent-loop turn through the real ring-zero tool, tool-boundary
delegated refusal + marker transition, engine default-route passthrough, and
direct-session "Say yes to apply" preserved.
- Plugin SDK: regenerate plugin-sdk-api-baseline.jsonl — the new optional
operatorApprovalOnly field on SystemAgentToolOptions flows into the
createOpenClawCodingTools options closure, changing its closureHash; the
export declaration is unchanged.
* fix(system-agent): preserve validation in delegated approval handoffs
Keep executor preapproval validation before staging delegated proposals, share actionable operator handoff text, and align the system prompt. Cover real tool and transport behavior while retaining direct approvals.
Co-authored-by: SunnyShu0925 <[email protected]>
* test(system-agent): restore scoped CLI fixture and reuse suites
Keep delegated approval coverage inside existing suites without increasing shard or file-size limits. Restore the CLI backend fixture dropped when chat-engine tests were split, avoiding real plugin setup loading in routing and continuity tests.
---------
Co-authored-by: Peter Steinberger <[email protected]>
/** Where setup side effects run; the gateway surface never manages its own daemon. */
22
23
surface: "cli"|"gateway";
24
+
/** Delegated proposals require operator UI approval, never a chat reply. */
25
+
operatorApprovalOnly?: boolean;
23
26
/**
24
27
* Host-verified consent for THIS turn: true only when the host judged the
25
28
* user's actual message to be an explicit approval. The model-supplied
@@ -487,8 +490,11 @@ export function createSystemAgentTool(options: SystemAgentToolOptions): AnyAgent
487
490
options.proposalRef.current=operationHash;
488
491
options.proposalRef.operation=operation;
489
492
}
493
+
constapprovalHint=options.operatorApprovalOnly
494
+
? `The proposal is registered for operator approval. Do not request conversational approval. ${SYSTEM_AGENT_OPERATOR_APPROVAL_HANDOFF}`
495
+
: "The proposal is registered; describe this exact change and ask the user to reply yes (their approval unlocks THIS action only — then retry the exact registered operation with approved=true).";
490
496
returntextResult(
491
-
`${SYSTEM_AGENT_NEEDS_APPROVAL_PREFIX}${operationHash}\nThis action changes state. The proposal is registered; describe this exact change and ask the user to reply yes (their approval unlocks THIS action only — then retry the exact registered operation with approved=true).`,
"You are talking to someone setting up or repairing OpenClaw. A real inference turn has already passed before this session can start. Goals, in order: a workspace, a running gateway, then channels (Discord, Slack, Telegram, WhatsApp, ...) and handing off to their agent.",
138
138
"You act ONLY through the `openclaw` tool. Read actions run freely: status, models, agents, channels, config_get, config_schema, gateway_status, plugin_search, validate_config, doctor, audit.",
139
-
"Mutating actions (setup, set_default_model, config_set, config_set_ref, create_agent, gateway_start/stop/restart, plugin_install, plugin_uninstall) change the user's machine. Protocol: when you decide a mutation is needed, call the tool with the exact action right away (without approved) — it is safely denied and registers the proposal — then describe the change and ask the user to confirm. Once they clearly agree in their own words, retry the identical call with approved=true. The host independently verifies their consent; never set approved=true without it.",
139
+
"Mutating actions (setup, set_default_model, config_set, config_set_ref, create_agent, gateway_start/stop/restart, plugin_install, plugin_uninstall) change the user's machine. Protocol: when you decide a mutation is needed, call the tool with the exact action right away (without approved) — it is safely denied and registers the proposal — then describe the change and follow the approval instructions in the tool result. Delegated changes need operator UI approval; never ask for a chat yes for those. For direct conversational approval, once the user clearly agrees in their own words, retry the identical call with approved=true. The host independently verifies their consent; never set approved=true without it.",
140
140
"The config file is ~/.openclaw/openclaw.json (JSON5). Before writing a path you are not certain about, call config_schema for it first — the schema is the source of truth, not memory. Secrets go through config_set_ref with an env var; never write or echo secret values. Never use config_set or config_set_ref to change inference-provider credentials, top-level auth (`auth.*`), model catalogs (`models.*`), `env.*`, `secrets.*`, `$include`, plugin install/load policy, or the default agent's model route/params — those use typed workflows (`set_default_model`, `openclaw onboard`) or a trusted shell. Approved config_set may change `tools.*`, `plugins.entries.<id>.*` for plugins off the active route, and routing fields of non-default agents. Use set_default_model with agentId to live-test and change another agent's model. plugin_uninstall works for plugins that do not back the active inference route; the tool refuses otherwise and the user must exit and run `openclaw plugins uninstall <id>`.",
141
141
"If a tool result reports CONFIG INVALID, fix it immediately before anything else.",
142
142
"Inference is a prerequisite. Never call configure_model_provider: tell the user to exit OpenClaw and run `openclaw onboard`, which live-tests a candidate before saving it. Never run doctor repairs inside OpenClaw; tell the user to exit and run `openclaw doctor --fix` because repairs can change the active inference route. To connect a chat channel, call connect_channel with the channel id (for example telegram). To inspect and install trusted bundled-skill dependencies, call configure_skills. To configure web search, call configure_search and let the hosted flow own provider and credential input. To configure the local Gateway's port, bind, auth, or Tailscale exposure, call configure_gateway. To import memory files detected in local agent homes into the default agent's existing workspace, call import_memory; it is copy-only and does not import config, credentials, or skills. Never ask for or repeat a credential yourself. These guided setups run here in chat. To hand the user off to their normal agent, call open_agent.",
0 commit comments