feat: add experimental.continue_loop_on_deny config option (#4729)

Co-authored-by: Aiden Cline <aidenpcline@gmail.com>
This commit is contained in:
Martijn Baay 2025-12-15 00:13:32 +01:00 committed by GitHub
parent c8fc910533
commit 7368342bab
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 1 deletions

View file

@ -783,6 +783,7 @@ export namespace Config {
.array(z.string())
.optional()
.describe("Tools that should only be available to primary agents."),
continue_loop_on_deny: z.boolean().optional().describe("Continue the agent loop when a tool call is denied"),
})
.optional(),
})

View file

@ -12,6 +12,7 @@ import { SessionRetry } from "./retry"
import { SessionStatus } from "./status"
import { Plugin } from "@/plugin"
import type { Provider } from "@/provider/provider"
import { Config } from "@/config/config"
export namespace SessionProcessor {
const DOOM_LOOP_THRESHOLD = 3
@ -49,6 +50,7 @@ export namespace SessionProcessor {
},
async process(streamInput: StreamInput) {
log.info("process")
const shouldBreak = (await Config.get()).experimental?.continue_loop_on_deny !== true
while (true) {
try {
let currentText: MessageV2.TextPart | undefined
@ -228,7 +230,7 @@ export namespace SessionProcessor {
})
if (value.error instanceof Permission.RejectedError) {
blocked = true
blocked = shouldBreak
}
delete toolcalls[value.toolCallId]
}