@@ -11,7 +11,7 @@ import type {
1111 } from "../client/src/types";
1212 import { config } from "./config";
1313 import { MemoryStore } from "./memory";
14-import { OllamaAgent } from "./ollama";
14+import { OllamaAgent, OllamaTimeoutError } from "./ollama";
1515 import { buildActionPrompt, buildRegistrationPrompt } from "./prompt";
1616 import { dispatchAction, validateAction } from "./actions";
1717 import { Tui } from "./tui";
@@ -160,8 +160,15 @@ async function startActionLoop(): Promise<void> {
160160 log(`Action: ${actionLog}`);
161161 memory.appendEvent("action_sent", { action: validation.action });
162162 } catch (error) {
163- log(`Loop error: ${(error as Error).message}`);
164- memory.appendEvent("loop_error", { message: (error as Error).message });
163+ const message = (error as Error).message;
164+ if (error instanceof OllamaTimeoutError) {
165+ log(`LLM timeout: ${message}. Retrying next tick.`);
166+ memory.appendEvent("llm_timeout", { message });
167+ } else {
168+ log(`Loop error: ${message}`);
169+ memory.appendEvent("loop_error", { message });
170+ }
171+ includeHelpInPrompt = true;
165172 }
166173
167174 await sleep(config.tickDelayMs);