From 143dd8aaa9f0a04fdccc7a36066e9479072e3250 Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Fri, 5 Dec 2025 20:01:47 +0900 Subject: [PATCH] fix(session-recovery): improve error detection and add continue prompt - Enhance error type detection for thinking block order issues - Add continue prompt after successful session recovery - Improve error message matching logic --- src/hooks/session-recovery.ts | 5 ++++- src/index.ts | 10 +++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/hooks/session-recovery.ts b/src/hooks/session-recovery.ts index ddb19d6..32f5627 100644 --- a/src/hooks/session-recovery.ts +++ b/src/hooks/session-recovery.ts @@ -70,7 +70,10 @@ function detectErrorType(error: unknown): RecoveryErrorType { return "tool_result_missing" } - if (message.includes("thinking") && message.includes("first block")) { + if ( + message.includes("thinking") && + (message.includes("first block") || message.includes("must start with") || message.includes("preceeding")) + ) { return "thinking_block_order" } diff --git a/src/index.ts b/src/index.ts index 41ed7a1..fc97408 100644 --- a/src/index.ts +++ b/src/index.ts @@ -136,7 +136,15 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => { sessionID, error, } - await sessionRecovery.handleSessionRecovery(messageInfo) + const recovered = await sessionRecovery.handleSessionRecovery(messageInfo) + + if (recovered && sessionID && sessionID === mainSessionID) { + await ctx.client.session.prompt({ + path: { id: sessionID }, + body: { parts: [{ type: "text", text: "continue" }] }, + query: { directory: ctx.directory }, + }).catch(() => {}) + } } if (sessionID && sessionID === mainSessionID) {