The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.
TypeScript agentai-chatai-studioall-in-onecoding-agentdesktop-appfluximage-generationlinuxllmlocal-ailocal-llmopen-sourceprivacyself-hostedstable-diffusionuncensoreduncensored-aivideo-generationwindows
fix(agent): run tool calls named "function" or written as !function_call
purple51f003d2c2fb
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex e823bbf5..faf40838 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -55,6 +55,12 @@ cloud catalogue. It also fixes the bugs reported on GitHub and Discord sincebin, because LM Studio offers no way to delete a model from outside, andDetails showed nothing. Details now says to delete it in LM Studio underMy Models, and does the same for other local servers.+- **The Code agent runs calls a cloud model writes in unusual shapes.** A call+ named "function" with a to-do list came back "Unknown tool: function", and+ calls written into the answer as `!function_call:{"call": ...}` were never+ picked up on LU Cloud, so the run stopped and the model kept retrying. Both+ now reach their tool; a call that fits several tools is answered with what to+ send instead (issue 147).- **A LoRA deleted from the loras folder leaves the stack.** Its pick stayedsaved, the stack said "2 active" with nothing ticked, and every run sent ituntil ComfyUI refused with "Value not in list". Rescan and every connect nowdiff --git a/e2e/code-agent-runs-calls-named-function.spec.ts b/e2e/code-agent-runs-calls-named-function.spec.tsnew file mode 100644index 00000000..a215bd69--- /dev/null+++ b/e2e/code-agent-runs-calls-named-function.spec.ts@@ -0,0 +1,72 @@+import { test, expect, type Page } from '@playwright/test'+import { tauriMockInit, DEFAULT_MODEL_NAME } from './support/tauri-mock'+import { seedOnboardingDone } from './support/cloud-mock'+import { openNewChat } from './support/ui'+import { toolCalls } from './support/recorded'++/**+ * GH #147 (Windows, Code agent on LU Cloud, 2026-10-01), the two call shapes+ * from the reporter's screenshots, played through the real Code tab:+ * 1. a native call NAMED "function" carrying a todo list+ * 2. calls written as text: !function_call:{"call": "file_read", ...}+ * Before 3.0.4 the first came back "Unknown tool: function" and the second+ * stayed prose, so the run stopped and the model kept "correcting".+ */++type Turn = { text?: string; toolCalls?: Array<{ name: string; args: Record<string, unknown> }> }++async function boot(page: Page, agentTurns: Turn[]) {+ await page.addInitScript(tauriMockInit, {+ assistantReply: 'unused in agent specs',+ modelName: DEFAULT_MODEL_NAME,+ replyChunkDelayMs: 4,+ agentTurns,+ files: { 'verifier.py': 'def verify():\n return True\n' },+ })+ await seedOnboardingDone(page)+ await page.goto('/')+ await page.getByRole('button', { name: 'Code', exact: true }).click()+ await openNewChat(page)+}++async function instruct(page: Page, text: string) {+ const composer = page.locator('textarea').first()+ const echoed = page.getByRole('main').locator('p').filter({ hasText: text })+ await expect(composer).toBeEnabled({ timeout: 20_000 })+ await expect(page.getByRole('button', { name: 'Send message' })).toBeVisible({ timeout: 20_000 })+ await expect(async () => {+ if ((await echoed.count()) === 0) {+ await composer.fill(text)+ await composer.press('Enter')+ }+ await expect(echoed).toBeVisible({ timeout: 2_000 })+ }).toPass({ timeout: 30_000 })+}++test('a call named "function" and a !function_call text both run their tool', async ({ page }) => {+ await boot(page, [+ {+ text: 'Continuing. Gathering project files for analysis.',+ toolCalls: [{ name: 'function', args: { todos: [+ { content: 'Read the verifier', status: 'in_progress' },+ { content: 'Summarize it', status: 'pending' },+ ] } }],+ },+ { text: 'We\'ll proceed.\n\n!function_call:{"call": "file_read", "arguments": {"path": "core/verifier.py"}}' },+ { text: 'VERIFIER_READ_DONE' },+ ])++ await instruct(page, 'look at core/verifier.py')+ const main = page.getByRole('main')+ await expect(main.getByText('VERIFIER_READ_DONE')).toBeVisible({ timeout: 30_000 })++ // The todo list landed in the plan, the file was really read.+ await expect(page.getByTestId('plan-header').or(page.getByTestId('plan-panel')).first()+ .getByRole('button', { name: /^plan /i })).toBeVisible({ timeout: 15_000 })+ const reads = (await toolCalls(page)).filter((c) => c.cmd === 'fs_read')+ expect(reads.some((c) => (c.path ?? '').replace(/\\/g, '/').endsWith('core/verifier.py'))).toBe(true)++ // No dead end on screen, no raw call text in the answer.+ await expect(main.getByText(/Unknown tool: function/)).toHaveCount(0)+ await expect(main.getByText(/!function_call/)).toHaveCount(0)+})diff --git a/src/api/agents/tool-executor.ts b/src/api/agents/tool-executor.tsindex b2111220..44085c8d 100644--- a/src/api/agents/tool-executor.ts+++ b/src/api/agents/tool-executor.ts@@ -23,6 +23,7 @@ import { deriveSideEffectKey } from './side-effect-key'import { validateToolArgs, formatValidationErrors, type JsonSchema } from './args-validator'import { stableArgsHash } from './block-helpers'import type { ToolArgs } from '../mcp/types'+import { isGenericCallName } from '../../lib/loose-tool-parse'export interface ExecutorToolDef {name: string@@ -276,7 +277,9 @@ async function runSingle(id: req.id,toolName: req.toolName,status: 'failed',- error: `Unknown tool: ${req.toolName}`,+ error: isGenericCallName(req.toolName)+ ? `Unknown tool: ${req.toolName}. "${req.toolName}" is not a tool name. Send the call again with the tool's own name, for example file_list or file_read, in the name field.`+ : `Unknown tool: ${req.toolName}`,dispatchedArgs: req.args,argsHash,sideEffectKey,diff --git a/src/hooks/__tests__/useCodex-tool-permissions.test.ts b/src/hooks/__tests__/useCodex-tool-permissions.test.tsindex 29db25fb..9092df55 100644--- a/src/hooks/__tests__/useCodex-tool-permissions.test.ts+++ b/src/hooks/__tests__/useCodex-tool-permissions.test.ts@@ -131,7 +131,7 @@ describe('the name repair runs before both gates', () => {// 2026-07-24) is not in MUTATING_TOOLS and is not registered, so a read-only// turn passed it, and canonicalToolName then turned it into `file_write`// on the way to the executor.- const repairAt = src.indexOf('const knownToolNames = toolRegistry.getAll()')+ const repairAt = src.indexOf('const fixed = repairToolCall(raw, args, tools)')const readOnlyGateAt = src.indexOf('const blocked = toolCalls.filter((tc) => !allowedInReadOnlyTurn')const permissionGateAt = src.indexOf('const refused = toolCalls.filter(isBlocked)')diff --git a/src/hooks/codex/tool-call-recovery.ts b/src/hooks/codex/tool-call-recovery.tsindex c17ea185..de7f23cd 100644--- a/src/hooks/codex/tool-call-recovery.ts+++ b/src/hooks/codex/tool-call-recovery.ts@@ -65,7 +65,7 @@ export function recoverToolCallsFromContent(toolCalls: ToolCall[], content: stri// tool-call JSON alongside native tool_calls — native was parsed// already, but the same JSON still sits in the content. Strip// those too so the chat bubble stays readable.- if (calls.length > 0 && turnContent && /\{\s*"(?:name|tool|function)"\s*:/.test(turnContent)) {+ if (calls.length > 0 && turnContent && /\{\s*"(?:name|tool|function|call)"\s*:/.test(turnContent)) {const { ranges } = extractToolCallsWithRanges(turnContent)if (ranges.length > 0) {turnContent = stripRanges(turnContent, ranges)@@ -82,6 +82,8 @@ export function recoverToolCallsFromContent(toolCalls: ToolCall[], content: stri// darf nicht sein"). Older answers auto-collapse in the UI, so the// old "stack of duplicated I'm-about-to paragraphs" problem is gone.// Only drop it when nothing but punctuation/whitespace remains.+ // The marker some models put in front of each call (GH #147) is no prose.+ if (extractedFromContent) turnContent = turnContent.replace(/!function_call:\s*/g, '').trim()if (extractedFromContent && !/[A-Za-z0-9]/.test(turnContent)) turnContent = ''return { toolCalls: calls, content: turnContent, extractedFromContent }}diff --git a/src/hooks/useAgentChat.ts b/src/hooks/useAgentChat.tsindex 18f4deb9..e20e661c 100644--- a/src/hooks/useAgentChat.ts+++ b/src/hooks/useAgentChat.ts@@ -42,7 +42,7 @@ import { stripVisionFeedbackMessages, reportMultimodalRefusal } from '../lib/visimport { log } from '../lib/logger'import { gatePlanTool, planToolAllowed } from '../lib/plan-gate'import { buildHermesToolPrompt, buildHermesToolResult, buildHermesToolCall, parseHermesToolCalls, stripToolCallTags, hasToolCallTags } from '../api/hermes-tool-calling'-import { parseLooseToolCalls, stripMatchedCalls, stripToolCallText, canonicalToolName } from '../lib/loose-tool-parse'+import { parseLooseToolCalls, stripMatchedCalls, stripToolCallText, repairToolCall } from '../lib/loose-tool-parse'import { mediaCallSucceeded } from '../lib/media-result'import { summarizeTurn } from '../lib/turn-summary'import { buildVisionFeedback } from '../api/vision-feedback'@@ -114,7 +114,7 @@ import { capHiddenToolHistory } from './codex/hidden-history'// derselbe, und zwei Wortlaute fuer einen abgeschnittenen Zug waeren zwei// Stellen, von denen eine gepflegt wird.import { codexCutoffNote, dropCutOffCall } from './codex/turn-cutoff'-import { asString, errorText, prop } from '../types/json-guards'+import { asString, errorText, isRecord, prop } from '../types/json-guards'import type { ToolArgs } from '../api/mcp/types'import { CREDITS_EXHAUSTED_MESSAGE } from '../lib/credits-exhausted'import { buildChatSystemPrompt } from '../lib/system-prompt'@@ -1938,10 +1938,11 @@ export function useAgentChat() {// NATIVE call to `video_generation` (not `video_generate`) → "Unknown// tool" → it gave up. Map such close misses to the registered name.if (toolCalls.length > 0) {- toolCalls = toolCalls.map((tc) => ({- ...tc,- function: { ...tc.function, name: canonicalToolName(tc.function.name, knownToolNames) },- }))+ const tools = toolRegistry.getAll()+ toolCalls = toolCalls.map((tc) => {+ const fixed = repairToolCall(tc.function.name, isRecord(tc.function.arguments) ? tc.function.arguments : {}, tools)+ return fixed.name === tc.function.name ? tc : { ...tc, function: { ...tc.function, name: fixed.name, arguments: fixed.arguments } }+ })}// Loose tool-call fallback (David 2026-06-03): weak local models oftendiff --git a/src/hooks/useCodex.ts b/src/hooks/useCodex.tsindex b9c208b3..a46f30dd 100644--- a/src/hooks/useCodex.ts+++ b/src/hooks/useCodex.ts@@ -69,11 +69,11 @@ import { openPlanGap, planReconcileSteer, PLAN_RECONCILE_BUDGET } from '../lib/pimport { planResumeAnchor } from '../lib/plan-resume'import { useTodoStore } from '../stores/todoStore'import { httpStatusOf } from '../lib/http-status'-import { asString, errorText, prop } from '../types/json-guards'+import { asString, errorText, isRecord, prop } from '../types/json-guards'import type { ToolArgs } from '../api/mcp/types'import { CREDITS_EXHAUSTED_MESSAGE } from '../lib/credits-exhausted'import { streamOllamaChatWithTools } from '../lib/ollama-stream-tools'-import { canonicalToolName } from '../lib/loose-tool-parse'+import { repairToolCall } from '../lib/loose-tool-parse'import { selectRelevantTools, selectRelevantToolsAsync, SMALL_MODEL_MAX_TOOLS, gateCreateTools, wantsMediaTools, isGatedTool } from '../lib/tool-selection'import { generateEmbeddings } from '../api/rag'import { truncateToolResult } from '../lib/truncate-tool-result'@@ -1602,6 +1602,23 @@ export function useCodex() {turnContent = turn.content || ''turnFinishReason = turn.finishReasonreportTurnUsage(convId!, assistantMsg.id, turn)+ // GH #147: a model on LU Cloud wrote its calls into the text+ // (!function_call:{"call": "file_read", ...}). This path never+ // looked, so the run stopped on prose. A call from the text counts+ // only when every name in it is a tool this agent has, so example+ // JSON in an explanation is never run.+ {+ const recovered = recoverToolCallsFromContent(toolCalls, turnContent)+ const tools = toolRegistry.getAll()+ const known = new Set(tools.map((t) => t.name))+ const fromText = toolCalls.length === 0 && recovered.toolCalls.length > 0+ const allKnown = recovered.toolCalls.every((tc) =>+ known.has(repairToolCall(tc.function.name, isRecord(tc.function.arguments) ? tc.function.arguments : {}, tools).name))+ if (!fromText || allKnown) {+ toolCalls = recovered.toolCalls+ turnContent = recovered.content+ }+ }if (keepThinking && turn.thinking) {thinkingContent += (thinkingContent ? '\n\n' : '') + turn.thinkinguseChatStore.getState().updateMessageThinking(convId!, assistantMsg.id, thinkingContent)@@ -1865,11 +1882,12 @@ export function useCodex() {// turn passed it, and the repair then turned it into `file_write` on// the way to the executor. Repair first, then judge the real name.if (toolCalls.length > 0) {- const knownToolNames = toolRegistry.getAll().map((t) => t.name)+ const tools = toolRegistry.getAll()toolCalls = toolCalls.map((tc) => {const raw = tc.function?.name ?? ''- const fixed = canonicalToolName(raw, knownToolNames)- return fixed === raw ? tc : { ...tc, function: { ...tc.function, name: fixed } }+ const args = isRecord(tc.function?.arguments) ? tc.function.arguments : {}+ const fixed = repairToolCall(raw, args, tools)+ return fixed.name === raw ? tc : { ...tc, function: { ...tc.function, name: fixed.name, arguments: fixed.arguments } }})}diff --git a/src/lib/__tests__/a-call-named-function-reaches-its-tool.test.ts b/src/lib/__tests__/a-call-named-function-reaches-its-tool.test.tsnew file mode 100644index 00000000..804721f8--- /dev/null+++ b/src/lib/__tests__/a-call-named-function-reaches-its-tool.test.ts@@ -0,0 +1,69 @@+/**+ * GH #147 (LU Cloud, Windows Code agent, 2026-10-01). The screenshots show two+ * call shapes the agent could not run, so the model kept "correcting" and the+ * task never moved:+ * - text !function_call:{"call": "file_list", "arguments": {...}}+ * - native a call NAMED "function", with {"todos": [...]} or {"path": "."}+ * as arguments, answered "Unknown tool: function" every time+ *+ * Run: npx vitest run src/lib/__tests__/a-call-named-function-reaches-its-tool.test.ts+ */+import { describe, it, expect, beforeAll } from 'vitest'+import { parseLooseToolCalls, stripMatchedCalls, repairToolCall, isGenericCallName } from '../loose-tool-parse'+import { toolRegistry } from '../../api/mcp/tool-registry'+import { registerBuiltinTools } from '../../api/mcp/builtin-tools'++let tools: ReturnType<typeof toolRegistry.getAll>+beforeAll(() => {+ registerBuiltinTools(toolRegistry)+ tools = toolRegistry.getAll()+})+const names = () => tools.map((t) => t.name)++describe('the "call" spelling written as text', () => {+ const text = 'We\'ll proceed.\n\n!function_call:{"call": "file_list", "arguments": {"path": "core\\\\mesh", "pattern": "init.py"}}\n!function_call:{"call": "file_read", "arguments": {"path": "core\\\\verifier.py"}} !function_call:{"call": "file_read", "arguments": {"path": "core\\\\mesh\\\\worker.py"}}'++ it('becomes three real calls', () => {+ const r = parseLooseToolCalls(text, names())+ expect(r.calls.map((c) => c.name)).toEqual(['file_list', 'file_read', 'file_read'])+ expect(r.calls[0].arguments).toEqual({ path: 'core\\mesh', pattern: 'init.py' })+ expect(r.calls[2].arguments).toEqual({ path: 'core\\mesh\\worker.py' })+ })++ it('leaves no call text in the answer', () => {+ const r = parseLooseToolCalls(text, names())+ expect(stripMatchedCalls(text, r.matched)).toBe("We'll proceed.")+ })++ // Negative control: an unknown name in the same shape stays prose.+ it('a name that is no tool is not lifted', () => {+ expect(parseLooseToolCalls('!function_call:{"call": "delete_everything", "arguments": {}}', names()).calls).toEqual([])+ })+})++describe('a native call named "function"', () => {+ it('with a todo list goes to todo_write', () => {+ const todos = [{ content: 'List root directory', status: 'in_progress' }]+ expect(repairToolCall('function', { todos }, tools)).toEqual({ name: 'todo_write', arguments: { todos } })+ })++ it('that names its tool inside goes to that tool', () => {+ expect(repairToolCall('function', { name: 'file_read', arguments: { path: 'a.py' } }, tools))+ .toEqual({ name: 'file_read', arguments: { path: 'a.py' } })+ expect(repairToolCall('tool', { tool: 'file_list', path: '.' }, tools))+ .toEqual({ name: 'file_list', arguments: { path: '.' } })+ })++ // {"path": "."} fits more than one tool: guessing could read a file the+ // model never asked for, so the call stays and the error says what to send.+ it('that fits several tools stays as sent', () => {+ expect(repairToolCall('function', { path: '.' }, tools).name).toBe('function')+ expect(isGenericCallName('function')).toBe(true)+ })++ it('a real tool name keeps the old repair, a real unknown stays unknown', () => {+ expect(repairToolCall('read_file', { path: 'a' }, tools).name).toBe('file_read')+ expect(repairToolCall('explain_phenomenon', { topic: 'sky' }, tools).name).toBe('explain_phenomenon')+ expect(isGenericCallName('file_read')).toBe(false)+ })+})diff --git a/src/lib/loose-tool-parse.ts b/src/lib/loose-tool-parse.tsindex addc58b9..736e6deb 100644--- a/src/lib/loose-tool-parse.ts+++ b/src/lib/loose-tool-parse.ts@@ -103,16 +103,17 @@ function parseJsonObjectCalls(text: string, known: Set<string>): { call: LooseTo// closed one brace early (wrong arguments).const candidates: string[] = findBalancedObjects(text)for (const cand of candidates) {- if (!/["']?(?:name|tool|tool_name|tool_call|function)["']?\s*[:=]/.test(cand)) continue+ if (!/["']?(?:name|tool|tool_name|tool_call|function|call)["']?\s*[:=]/.test(cand)) continueconst parsed = repairJson(cand)if (!parsed) continue// Name + args may arrive in three shapes, all seen from small local models:// flat {"name":"file_list","arguments":{…}}// nested {"function":{"name":"file_list","arguments":{…}}} (OpenAI/Phi)// wrapped {"tool_call":{"name":…}} or {"tool_call":"file_list","arguments":{…}}+ // call !function_call:{"call":"file_list","arguments":{…}} (GH #147, LU Cloud)// Unwrap an object-valued name carrier so the nested forms resolve too.let nameField: unknown = parsed.name || prop(parsed, 'tool') || prop(parsed, 'tool_name')- || prop(parsed, 'tool_call') || prop(parsed, 'function')+ || prop(parsed, 'tool_call') || prop(parsed, 'function') || prop(parsed, 'call')let argsField: unknown = parsed.arguments ?? parsed.parameters ?? prop(parsed, 'args') ?? prop(parsed, 'params')if (isRecord(nameField)) {argsField = argsField ?? nameField.arguments ?? nameField.parameters ?? nameField.args@@ -297,6 +298,53 @@ export function canonicalToolName(name: string, known: string[]): string {return name}+/** Names that say "this is a call" instead of naming one. */+const GENERIC_CALL_NAMES = new Set(['function', 'functions', 'tool', 'tools', 'tool_call', 'call', 'function_call', 'invoke', 'use_tool'])++/** True for a name like "function" that names no tool at all. */+export function isGenericCallName(name: string): boolean {+ return GENERIC_CALL_NAMES.has(name.trim().toLowerCase())+}++interface ToolShape {+ name: string+ inputSchema?: { properties?: Record<string, unknown>; required?: string[] }+}++/**+ * GH #147 (LU Cloud, 2026-10-01): a model sent native calls named "function",+ * once with {"todos": [...]}, once with {"path": "."}, and every one came back+ * "Unknown tool: function" while it retried. A generic name is resolved from+ * the call itself: a tool named inside the arguments, or else the one tool+ * whose parameters the arguments fit. Two tools that fit equally leave the+ * call as it was, and the executor says what to send instead.+ */+export function repairToolCall(+ name: string,+ args: Record<string, unknown>,+ tools: ToolShape[],+): { name: string; arguments: Record<string, unknown> } {+ const known = tools.map((t) => t.name)+ if (!isGenericCallName(name)) return { name: canonicalToolName(name, known), arguments: args }+ for (const key of ['name', 'tool', 'tool_name', 'function', 'call']) {+ const inner = args[key]+ if (typeof inner !== 'string') continue+ const hit = canonicalToolName(inner, known)+ if (!known.includes(hit)) continue+ const nested = args.arguments ?? args.parameters ?? args.args+ const rest = Object.fromEntries(Object.entries(args).filter(([k]) => k !== key))+ return { name: hit, arguments: isRecord(nested) ? nested : rest }+ }+ const keys = Object.keys(args)+ if (keys.length === 0) return { name, arguments: args }+ const fits = tools.filter((t) => {+ const props = Object.keys(t.inputSchema?.properties ?? {})+ const required = t.inputSchema?.required ?? []+ return keys.every((k) => props.includes(k)) && required.every((r) => keys.includes(r))+ })+ return fits.length === 1 ? { name: fits[0].name, arguments: args } : { name, arguments: args }+}+/** Remove the matched call snippets from a prose answer (best-effort). */export function stripMatchedCalls(text: string, matched: string[]): string {let out = text@@ -304,7 +352,7 @@ export function stripMatchedCalls(text: string, matched: string[]): string {if (snip) out = out.split(snip).join('')}// Tidy leftover empty code fences / blank lines.- return out.replace(/```(?:json|python|tool_code)?\s*```/gi, '').replace(/\n{3,}/g, '\n\n').trim()+ return out.replace(/```(?:json|python|tool_code)?\s*```/gi, '').replace(/!function_call:\s*/g, '').replace(/\n{3,}/g, '\n\n').trim()}/**diff --git a/src/lib/release-notes.ts b/src/lib/release-notes.tsindex 6de70d6d..d1af0c7a 100644--- a/src/lib/release-notes.ts+++ b/src/lib/release-notes.ts@@ -156,7 +156,7 @@ export const RELEASE_NOTES: ReleaseNote[] = [},{title: 'Fixes from GitHub and Discord.',- detail: 'A group chat answers with every LU Engine model in it, also when the models sit in your Model Storage folder. Ollama models download without one already installed. A GGUF from the CivitAI search lands where ComfyUI reads it. A fresh ComfyUI install on Windows gets its own Python environment, which fixes "hipdnn_backend.dll Bad Image" on AMD cards. The window no longer disappears on Linux. A character trained on your own machine takes up to 100 photos, and Details on an LM Studio model says where to delete it. A newer image or video model with a missing encoder or VAE names that file and offers the download, instead of ending in "Value not in list". A LoRA deleted from the loras folder leaves the stack, a run only sends LoRAs ComfyUI lists, and Clear turns the stack off.',+ detail: 'A group chat answers with every LU Engine model in it, also when the models sit in your Model Storage folder. Ollama models download without one already installed. A GGUF from the CivitAI search lands where ComfyUI reads it. A fresh ComfyUI install on Windows gets its own Python environment, which fixes "hipdnn_backend.dll Bad Image" on AMD cards. The window no longer disappears on Linux. A character trained on your own machine takes up to 100 photos, and Details on an LM Studio model says where to delete it. A newer image or video model with a missing encoder or VAE names that file and offers the download, instead of ending in "Value not in list". A LoRA deleted from the loras folder leaves the stack, a run only sends LoRAs ComfyUI lists, and Clear turns the stack off. The Code agent runs tool calls a cloud model writes into its answer or sends under the name "function", instead of stopping on them.',},{title: 'Writing a long file no longer ends the run.',diff --git a/src/lib/tool-call-repair.ts b/src/lib/tool-call-repair.tsindex 6d3eaad3..98a3a510 100644--- a/src/lib/tool-call-repair.ts+++ b/src/lib/tool-call-repair.ts@@ -402,7 +402,8 @@ export function extractToolCallsWithRanges(content: string): {// emitted by qwen2.5-coder). Replace with a locate-header-then-balance// scanner: find the `"arguments":` key, then walk the character stream// respecting string escapes to find the matching `}`.- const headerRe = /"(?:name|tool|function)"\s*:\s*"([^"]+)"\s*,\s*"(?:arguments|args|parameters|input)"\s*:\s*\{/gi+ // "call" is the spelling of GH #147: !function_call:{"call": "file_read", "arguments": {...}}+ const headerRe = /"(?:name|tool|function|call)"\s*:\s*"([^"]+)"\s*,\s*"(?:arguments|args|parameters|input)"\s*:\s*\{/gilet m: RegExpExecArray | nullwhile ((m = headerRe.exec(content)) !== null) {const toolName = m[1]