fix(opencode): respect disabled auto compaction on overflow (#30749)

This commit is contained in:
Shoubhit Dash
2026-06-04 19:47:49 +05:30
committed by GitHub
parent 6d4f3b4ab2
commit 7e09660c3b
2 changed files with 37 additions and 0 deletions

View File

@@ -909,6 +909,13 @@ export const layer = Layer.effect(
const error = parse(e)
yield* flushV2Fragments()
if (SessionV1.ContextOverflowError.isInstance(error)) {
if ((yield* config.get()).compaction?.auto === false && !ctx.assistantMessage.summary) {
ctx.assistantMessage.error = error
ctx.assistantMessage.finish = "error"
yield* events.publish(Session.Event.Error, { sessionID: ctx.sessionID, error })
yield* status.set(ctx.sessionID, { type: "idle" })
return
}
ctx.needsCompaction = true
yield* events.publish(Session.Event.Error, { sessionID: ctx.sessionID, error })
return