Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

fix(cycle): raise atom maxTokens + case-normalize atom_type for Gemini (#3211)

alexey-metaengage19c6b6ef6752
diff --git a/src/core/cycle/extract-atoms.ts b/src/core/cycle/extract-atoms.ts
index 7d9ea0ed4f..0b12b4d79e 100644
--- a/src/core/cycle/extract-atoms.ts
+++ b/src/core/cycle/extract-atoms.ts
@@ -558,7 +558,7 @@ export async function runPhaseExtractAtoms(
content: `Source: ${originLabel}\n\n---\n\n${item.content.slice(0, 50_000)}`,
},
],
- maxTokens: 2000,
+ maxTokens: 4096,
});
// Post-await yield: closes the "long LLM call past TTL" hazard
// codex flagged. The 30s throttle inside maybeYield bounds the
@@ -726,7 +726,7 @@ export function parseAtomsResponse(raw: string): ExtractedAtom[] {
if (typeof item !== 'object' || item === null) continue;
const obj = item as Record<string, unknown>;
const title = typeof obj.title === 'string' ? obj.title.slice(0, 200) : null;
- const atomType = typeof obj.atom_type === 'string' ? obj.atom_type : null;
+ const atomType = typeof obj.atom_type === 'string' ? obj.atom_type.trim().toLowerCase() : null;
const body = typeof obj.body === 'string' ? obj.body : null;
if (!title || !atomType || !body) continue;
if (!ATOM_TYPES.includes(atomType as typeof ATOM_TYPES[number])) continue;