From df478a82927479346ad4d7b5890f1d2220bdce81 Mon Sep 17 00:00:00 2001 From: Kevin Lin Date: Fri, 1 May 2026 13:43:00 -0700 Subject: [PATCH] fix: allow subagent thinking config patch (#75802) --- CHANGELOG.md | 1 + .../tools/gateway-tool-guard-coverage.test.ts | 73 +++++++++++++++++++ src/agents/tools/gateway-tool.ts | 2 + 3 files changed, 76 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 798f767d517..75ba4f822a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ Docs: https://docs.openclaw.ai - Agents/Codex: stop prompting message-tool-only source turns to finish with `NO_REPLY`, so quiet turns are represented by not calling the visible message tool instead of conflicting final-text instructions. Thanks @pashpashpash. - Gateway/config: report failed backup restores as failed in logs and config observe audit records instead of marking them valid. (#70515) Thanks @davidangularme. - Compaction: use the active session model fallback chain for implicit summarization failures without persisting fallback model selection, so Azure content-filter 400s can recover. Fixes #64960. (#74470) Thanks @jalehman and @OpenCodeEngineer. +- Gateway/config: allow `gateway config.patch` to update documented subagent thinking defaults. Fixes #75764. (#75802) Thanks @kAIborg24. ## 2026.4.30 diff --git a/src/agents/tools/gateway-tool-guard-coverage.test.ts b/src/agents/tools/gateway-tool-guard-coverage.test.ts index bf3003b3b61..19ae284af63 100644 --- a/src/agents/tools/gateway-tool-guard-coverage.test.ts +++ b/src/agents/tools/gateway-tool-guard-coverage.test.ts @@ -62,8 +62,10 @@ describe("gateway config mutation guard coverage", () => { expect.arrayContaining([ "agents.defaults.systemPromptOverride", "agents.defaults.model", + "agents.defaults.subagents.thinking", "agents.list[].id", "agents.list[].model", + "agents.list[].subagents.thinking", "channels.*.requireMention", "messages.visibleReplies", "messages.groupChat.visibleReplies", @@ -71,6 +73,77 @@ describe("gateway config mutation guard coverage", () => { ); }); + it("allows documented subagent thinking default edits via config.patch", () => { + expectAllowed( + {}, + { + agents: { + defaults: { + subagents: { thinking: "medium" }, + }, + }, + }, + ); + expectAllowed( + { + agents: { + defaults: { + subagents: { thinking: "low" }, + }, + }, + }, + { + agents: { + defaults: { + subagents: { thinking: "high" }, + }, + }, + }, + ); + }); + + it("allows documented per-agent subagent thinking edits via config.patch", () => { + expectAllowed( + { + agents: { + list: [{ id: "worker", subagents: { thinking: "low" } }], + }, + }, + { + agents: { + list: [{ id: "worker", subagents: { thinking: "medium" } }], + }, + }, + ); + expectAllowed( + { agents: { list: [] as Array> } }, + { + agents: { + list: [{ id: "helper", subagents: { thinking: "medium" } }], + }, + }, + ); + }); + + it("keeps neighboring subagent policy fields protected via config.patch", () => { + expectBlocked( + { agents: { defaults: { subagents: { allowAgents: ["worker"] } } } }, + { agents: { defaults: { subagents: { allowAgents: ["*"] } } } }, + ); + expectBlocked( + { + agents: { + list: [{ id: "worker", subagents: { requireAgentId: true } }], + }, + }, + { + agents: { + list: [{ id: "worker", subagents: { requireAgentId: false } }], + }, + }, + ); + }); + it("allows visible reply delivery mode edits via config.patch", () => { expectAllowed( {}, diff --git a/src/agents/tools/gateway-tool.ts b/src/agents/tools/gateway-tool.ts index 60f80383403..e4415cd3833 100644 --- a/src/agents/tools/gateway-tool.ts +++ b/src/agents/tools/gateway-tool.ts @@ -34,12 +34,14 @@ const ALLOWED_GATEWAY_CONFIG_PATHS = [ "agents.defaults.promptOverlays", "agents.defaults.model", "agents.defaults.thinkingDefault", + "agents.defaults.subagents.thinking", "agents.defaults.reasoningDefault", "agents.defaults.fastModeDefault", "agents.list[].id", "agents.list[].systemPromptOverride", "agents.list[].model", "agents.list[].thinkingDefault", + "agents.list[].subagents.thinking", "agents.list[].reasoningDefault", "agents.list[].fastModeDefault", // Mention gating is an agent-facing scope knob across channel adapters.