Skip to content

Commit 45c52b2

Browse files
headbouyJBclaude
andcommitted
fix(system-prompt): suppress relocated exec-approval line under tool_call_style override
Addresses review (clawsweeper): the exec-approval guidance lived inside the `tool_call_style` fallback, so a provider override of that section previously replaced it. Relocating it below the boundary emitted it unconditionally, which changed behaviour for providers/plugins that override `tool_call_style`. Gate the relocated line on the absence of a `tool_call_style` override, restoring the original "override replaces the whole section" contract. Extends the provider-override test to assert the default approval line is suppressed when the section is overridden. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01H6Hz9UEpxQ4W3d8XecvupH
1 parent 4be44c8 commit 45c52b2

2 files changed

Lines changed: 14 additions & 5 deletions

File tree

src/agents/system-prompt.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -976,6 +976,9 @@ describe("buildAgentSystemPrompt", () => {
976976
expect(prompt).toContain("## Provider Dynamic\n\nDynamic guidance.");
977977
expect(prompt).toContain("## Tool Call Style\nProvider-specific tool call guidance.");
978978
expect(prompt).not.toContain("Default: do not narrate routine, low-risk tool calls");
979+
// The relocated exec-approval guidance stays suppressed when tool_call_style is
980+
// provider-overridden, preserving the "override replaces the whole section" contract.
981+
expect(prompt).not.toContain("If exec returns approval-pending");
979982
});
980983

981984
it("includes inline button style guidance when runtime supports inline buttons", () => {

src/agents/system-prompt.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1288,11 +1288,17 @@ export function buildAgentSystemPrompt(params: {
12881288
// Exec-approval guidance varies by channel (CLI /approve vs native approval UI)
12891289
// and Authorized Senders varies by owner/identity (and is dropped when minimal),
12901290
// so both must sit below the boundary to keep the static prefix byte-identical.
1291-
buildExecApprovalPromptGuidance({
1292-
runtimeChannel: params.runtimeInfo?.channel,
1293-
inlineButtonsEnabled,
1294-
runtimeCapabilities,
1295-
}),
1291+
// Still suppressed when `tool_call_style` is provider-overridden, preserving the
1292+
// original contract where that override replaces the whole section (incl. this line).
1293+
...(providerSectionOverrides.tool_call_style
1294+
? []
1295+
: [
1296+
buildExecApprovalPromptGuidance({
1297+
runtimeChannel: params.runtimeInfo?.channel,
1298+
inlineButtonsEnabled,
1299+
runtimeCapabilities,
1300+
}),
1301+
]),
12961302
...buildUserIdentitySection(ownerLine, isMinimal),
12971303
...buildWebchatCanvasSection({
12981304
isMinimal,

0 commit comments

Comments
 (0)