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
This commit is contained in:
YeonGyu-Kim
2025-12-05 20:01:47 +09:00
parent 36169c83fb
commit 143dd8aaa9
2 changed files with 13 additions and 2 deletions

View File

@@ -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"
}

View File

@@ -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) {