summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMartijn Baay <[email protected]>2025-12-15 00:13:32 +0100
committerGitHub <[email protected]>2025-12-14 17:13:32 -0600
commit7368342bab50f1ffc71be59a54348b8246893141 (patch)
treeba1f35bb8d34eb0df7972627491447bf0853cd5f
parentc8fc9105334bdfc80b9f773e4e8ad808b20b03af (diff)
downloadopencode-7368342bab50f1ffc71be59a54348b8246893141.tar.gz
opencode-7368342bab50f1ffc71be59a54348b8246893141.zip
feat: add experimental.continue_loop_on_deny config option (#4729)
Co-authored-by: Aiden Cline <[email protected]>
-rw-r--r--packages/opencode/src/config/config.ts1
-rw-r--r--packages/opencode/src/session/processor.ts4
2 files changed, 4 insertions, 1 deletions
diff --git a/packages/opencode/src/config/config.ts b/packages/opencode/src/config/config.ts
index 42f6b11e9..333e19848 100644
--- a/packages/opencode/src/config/config.ts
+++ b/packages/opencode/src/config/config.ts
@@ -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(),
})
diff --git a/packages/opencode/src/session/processor.ts b/packages/opencode/src/session/processor.ts
index f1f7dd096..a1244d1df 100644
--- a/packages/opencode/src/session/processor.ts
+++ b/packages/opencode/src/session/processor.ts
@@ -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]
}