fix(session-recovery): detect 'final block cannot be thinking' error pattern (#420)

This commit is contained in:
Sisyphus
2026-01-03 09:46:45 +09:00
committed by GitHub
parent 8c30974c18
commit d09c994b91
2 changed files with 206 additions and 1 deletions

View File

@@ -122,7 +122,7 @@ function extractMessageIndex(error: unknown): number | null {
return match ? parseInt(match[1], 10) : null
}
function detectErrorType(error: unknown): RecoveryErrorType {
export function detectErrorType(error: unknown): RecoveryErrorType {
const message = getErrorMessage(error)
if (message.includes("tool_use") && message.includes("tool_result")) {
@@ -134,6 +134,8 @@ function detectErrorType(error: unknown): RecoveryErrorType {
(message.includes("first block") ||
message.includes("must start with") ||
message.includes("preceeding") ||
message.includes("final block") ||
message.includes("cannot be thinking") ||
(message.includes("expected") && message.includes("found")))
) {
return "thinking_block_order"