Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

fix: pre-landing review fixes

garrytan35749b34812e
diff --git a/src/core/ai/providers/claude-cli-language-model.ts b/src/core/ai/providers/claude-cli-language-model.ts
index 28fd96ce9a..b53d95c234 100644
--- a/src/core/ai/providers/claude-cli-language-model.ts
+++ b/src/core/ai/providers/claude-cli-language-model.ts
@@ -667,7 +667,7 @@ function extractToolCalls(raw: string): {
if (firstError !== null) {
process.stderr.write(`[claude-cli] <use_tools> block failed to parse — tool call discarded: ${firstError}\n`);
}
- return { toolCalls: [], beforeText: raw.trim(), afterText: '', nativeMarkup: NATIVE_TOOL_MARKUP.test(raw) };
+ return { toolCalls: [], beforeText: raw.trim(), afterText: '', nativeMarkup: NATIVE_TOOL_MARKUP.test(raw.replace(/```[\s\S]*?```/g, '').replace(/`[^`\n]*`/g, '')) };
}
const beforeText = raw.slice(0, openIdx).trim();
diff --git a/test/claude-cli-stop-reason.test.ts b/test/claude-cli-stop-reason.test.ts
index ab662622fc..305911196d 100644
--- a/test/claude-cli-stop-reason.test.ts
+++ b/test/claude-cli-stop-reason.test.ts
@@ -105,4 +105,9 @@ describe('claude-cli native tool-call markup without a <use_tools> block (#9085)
const out = await generate('No pattern meets the evidence bar, so I am not calling put_page or writing a <use_tools> block.');
expect(out.finishReason).toBe('stop');
});
+
+ test('markup quoted in a code span or fence is an answer, not a call', async () => {
+ const out = await generate('The model wrote `<function_calls>` here. An example:\n```xml\n<invoke name="search">\n</invoke>\n```\nNothing was called.');
+ expect(out.finishReason).toBe('stop');
+ });
});