Skip to content

Commit 7ddc22c

Browse files
committed
limit retrying
1 parent c6110f2 commit 7ddc22c

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

packages/opencode/src/session/processor.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ export namespace SessionProcessor {
4646
log.info("process")
4747
needsCompaction = false
4848
const shouldBreak = (await Config.get()).experimental?.continue_loop_on_deny !== true
49+
const retryLimit = streamInput.user.format?.type === "json_schema" ? streamInput.user.format.retryCount : 2
4950
while (true) {
5051
try {
5152
let currentText: MessageV2.TextPart | undefined
@@ -346,7 +347,7 @@ export namespace SessionProcessor {
346347
// TODO: Handle context overflow error
347348
}
348349
const retry = SessionRetry.retryable(error)
349-
if (retry !== undefined) {
350+
if (retry !== undefined && attempt < retryLimit) {
350351
attempt++
351352
const delay = SessionRetry.delay(attempt, error.name === "APIError" ? error : undefined)
352353
SessionStatus.set(input.sessionID, {

0 commit comments

Comments
 (0)