fix(recovery): ignore empty summary-only assistant messages

This commit is contained in:
Ravi Tharuma
2026-03-28 08:56:36 +01:00
parent 4a029258a4
commit 4e214cba4e
3 changed files with 61 additions and 9 deletions
@@ -158,7 +158,7 @@ export async function getLastAssistant(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
client: any,
directory: string,
): Promise<Record<string, unknown> | null> {
): Promise<{ info: Record<string, unknown>; hasContent: boolean } | null> {
try {
const resp = await (client as Client).session.messages({
path: { id: sessionID },
@@ -175,7 +175,15 @@ export async function getLastAssistant(
return info?.role === "assistant"
})
if (!last) return null
return (last as { info?: Record<string, unknown> }).info ?? null
const message = last as SDKMessage & { info?: Record<string, unknown> }
const info = message.info
if (!info) return null
return {
info,
hasContent: messageHasContentFromSDK(message),
}
} catch {
return null
}