diff --git a/src/hooks/comment-checker/hook.ts b/src/hooks/comment-checker/hook.ts index 8989376434..ba693ef3c2 100644 --- a/src/hooks/comment-checker/hook.ts +++ b/src/hooks/comment-checker/hook.ts @@ -89,6 +89,11 @@ export function createCommentCheckerHooks(config?: CommentCheckerConfig) { ): Promise => { debugLog("tool.execute.after:", { tool: input.tool, callID: input.callID }) + if (!output.output || typeof output.output !== "string") { + debugLog("skipping: output.output is undefined or not a string") + return + } + const toolLower = input.tool.toLowerCase() // Only skip if the output indicates a tool execution failure diff --git a/src/hooks/edit-error-recovery/hook.ts b/src/hooks/edit-error-recovery/hook.ts index 84ac9e9dcd..4a7fe33841 100644 --- a/src/hooks/edit-error-recovery/hook.ts +++ b/src/hooks/edit-error-recovery/hook.ts @@ -43,6 +43,7 @@ export function createEditErrorRecoveryHook(_ctx: PluginInput) { output: { title: string; output: string; metadata: unknown } ) => { if (input.tool.toLowerCase() !== "edit") return + if (!output.output || typeof output.output !== "string") return const outputLower = output.output.toLowerCase() const hasEditError = EDIT_ERROR_PATTERNS.some((pattern) => diff --git a/src/hooks/task-resume-info/hook.ts b/src/hooks/task-resume-info/hook.ts index f5c0c5185b..946f9439ac 100644 --- a/src/hooks/task-resume-info/hook.ts +++ b/src/hooks/task-resume-info/hook.ts @@ -21,6 +21,7 @@ export function createTaskResumeInfoHook() { output: { title: string; output: string; metadata: unknown } ) => { if (!TARGET_TOOLS.includes(input.tool)) return + if (!output.output || typeof output.output !== "string") return if (output.output.startsWith("Error:") || output.output.startsWith("Failed")) return if (output.output.includes("\nto continue:")) return