fix: remove config.schema from agent gateway tool

The config.schema endpoint returns a 373KB JSON schema designed for
Control UI form rendering, not for agent consumption. When agents
called this action, it caused context explosion issues.

Changes:
- Remove config.schema from GATEWAY_ACTIONS in gateway-tool.ts
- Update system prompt to remove config.schema reference
- Add config.patch to system prompt documentation

The underlying config.schema endpoint remains available for Control UI
via the internal callGatewayTool function.

Fixes #7347
This commit is contained in:
User
2026-02-03 04:08:01 +09:00
committed by Gustavo Madeira Santana
parent 4d9134fe9c
commit f34a778069
5 changed files with 7 additions and 9 deletions

View File

@@ -180,6 +180,7 @@ Docs: https://docs.openclaw.ai
- Memory/doctor SecretRef handling: treat SecretRef-backed memory-search API keys as configured, and fail embedding setup with explicit unresolved-secret errors instead of crashing. (#36835) Thanks @joshavant.
- Memory/flush default prompt: ban timestamped variant filenames during default memory flush runs so durable notes stay in the canonical daily `memory/YYYY-MM-DD.md` file. (#34951) thanks @zerone0x.
- Agents/reply delivery timing: flush embedded Pi block replies before waiting on compaction retries so already-generated assistant replies reach channels before compaction wait completes. (#35489) thanks @Sid-Qin.
- Agents/gateway config guidance: stop exposing `config.schema` through the agent `gateway` tool, remove prompt/docs guidance that told agents to call it, and keep agents on `config.get` plus `config.patch`/`config.apply` for config changes. (#7382) thanks @kakuteki.
## 2026.3.2

View File

@@ -453,7 +453,7 @@ Restart or apply updates to the running Gateway process (in-place).
Core actions:
- `restart` (authorizes + sends `SIGUSR1` for in-process restart; `openclaw gateway` restart in-place)
- `config.get` / `config.schema`
- `config.get`
- `config.apply` (validate + write config + restart + wake)
- `config.patch` (merge partial update + restart + wake)
- `update.run` (run update + restart + wake)
@@ -461,6 +461,7 @@ Core actions:
Notes:
- Use `delayMs` (defaults to 2000) to avoid interrupting an in-flight reply.
- `config.schema` remains available to internal Control UI flows and is not exposed through the agent `gateway` tool.
- `restart` is enabled by default; set `commands.restart: false` to disable it.
### `sessions_list` / `sessions_history` / `sessions_send` / `sessions_spawn` / `session_status`

View File

@@ -444,7 +444,9 @@ describe("buildAgentSystemPrompt", () => {
expect(prompt).toContain("## OpenClaw Self-Update");
expect(prompt).toContain("config.apply");
expect(prompt).toContain("config.patch");
expect(prompt).toContain("update.run");
expect(prompt).not.toContain("config.schema");
});
it("includes skills guidance when skills prompt is present", () => {

View File

@@ -482,8 +482,7 @@ export function buildAgentSystemPrompt(params: {
? [
"Get Updates (self-update) is ONLY allowed when the user explicitly asks for it.",
"Do not run config.apply or update.run unless the user explicitly requests an update or config change; if it's not explicit, ask first.",
"Use config.schema to fetch the current JSON Schema (includes plugins/channels) before making config changes or answering config-field questions; avoid guessing field names/types.",
"Actions: config.get, config.schema, config.apply (validate + write full config, then restart), update.run (update deps or git, then restart).",
"Actions: config.get, config.apply (validate + write full config, then restart), config.patch (partial update, merges with existing), update.run (update deps or git, then restart).",
"After restart, OpenClaw pings the last active session automatically.",
].join("\n")
: "",

View File

@@ -34,7 +34,6 @@ function resolveBaseHashFromSnapshot(snapshot: unknown): string | undefined {
const GATEWAY_ACTIONS = [
"restart",
"config.get",
"config.schema",
"config.apply",
"config.patch",
"update.run",
@@ -48,7 +47,7 @@ const GatewayToolSchema = Type.Object({
// restart
delayMs: Type.Optional(Type.Number()),
reason: Type.Optional(Type.String()),
// config.get, config.schema, config.apply, update.run
// config.get, config.apply, update.run
gatewayUrl: Type.Optional(Type.String()),
gatewayToken: Type.Optional(Type.String()),
timeoutMs: Type.Optional(Type.Number()),
@@ -172,10 +171,6 @@ export function createGatewayTool(opts?: {
const result = await callGatewayTool("config.get", gatewayOpts, {});
return jsonResult({ ok: true, result });
}
if (action === "config.schema") {
const result = await callGatewayTool("config.schema", gatewayOpts, {});
return jsonResult({ ok: true, result });
}
if (action === "config.apply") {
const { raw, baseHash, sessionKey, note, restartDelayMs } =
await resolveConfigWriteParams();