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(tools): retired names survive the step executor, not only the registry
David6e84b2d8da04
diff --git a/src/api/agents/sub-agent.ts b/src/api/agents/sub-agent.tsindex 7d0e960e..6ed51f51 100644--- a/src/api/agents/sub-agent.ts+++ b/src/api/agents/sub-agent.ts@@ -156,10 +156,7 @@ export async function defaultSubAgentRunner(}))const registry = toolRegistryconst results = await executeParallel(requests, {- getTool: (name) => {- const td = registry.getToolByName(name)- return td ? { name: td.name, inputSchema: td.inputSchema } : undefined- },+ getTool: (name) => registry.resolveExecutable(name),execute: ((name: string, args: Record<string, any>) => registry.execute(name, args)) as any,explainError: (toolName, err) => explainToolError(toolName, err),})diff --git a/src/api/mcp/__tests__/tool-merge-redirect.test.ts b/src/api/mcp/__tests__/tool-merge-redirect.test.tsindex 06f9b917..70418ee6 100644--- a/src/api/mcp/__tests__/tool-merge-redirect.test.ts+++ b/src/api/mcp/__tests__/tool-merge-redirect.test.ts@@ -128,3 +128,49 @@ describe('shell_execute refuses by COMMAND on a read-only turn (E7 priority)', (expect(backendCalls.some((c) => c.body?.command === 'git commit -m x')).toBe(true)})})++// Live E2E 2026-08-21: the model emitted git_log on the Code surface and got+// "Unknown tool: git_log" back. The redirect lived only in registry.execute();+// the step executor's own getTool miss failed the call before execute() ran.+// These tests pin the whole executor path, not just the registry.+describe('retired names survive the step executor (executeParallel)', () => {+ const registry = new ToolRegistry()+ registerBuiltinTools(registry)+ const runtime = {+ getTool: (name: string) => registry.resolveExecutable(name),+ execute: ((name: string, args: Record<string, any>) => registry.execute(name, args)) as any,+ }++ it('resolveExecutable: registered def, retired stub, unknown undefined', () => {+ expect(registry.resolveExecutable('shell_execute')?.inputSchema).toBeTruthy()+ expect(registry.resolveExecutable('git_log')).toEqual({ name: 'git_log' })+ expect(registry.resolveExecutable('made_up_tool')).toBeUndefined()+ })++ it('git_log through executeParallel completes via the redirect', async () => {+ const { executeParallel } = await import('../../agents/tool-executor')+ const [res] = await executeParallel(+ [{ id: 'r1', toolName: 'git_log', args: {} }],+ runtime,+ )+ expect(res.status).toBe('completed')+ expect(res.result).toContain('git_log is retired')+ expect(backendCalls.some((c) => c.cmd === 'shell_execute' && String(c.body.command).startsWith('git log'))).toBe(true)+ })++ it('negative control: a name that was never ours still fails as Unknown tool', async () => {+ const { executeParallel } = await import('../../agents/tool-executor')+ const [res] = await executeParallel(+ [{ id: 'r2', toolName: 'made_up_tool', args: {} }],+ runtime,+ )+ expect(res.status).toBe('failed')+ expect(res.error).toContain('Unknown tool')+ })++ it('drift guard: the lib list and the executor map name the same tools', async () => {+ const { RETIRED_EXECUTOR_NAMES } = await import('../builtin-tools')+ const { RETIRED_TOOL_NAMES: libNames } = await import('../../../lib/retired-tools')+ expect([...libNames].sort()).toEqual([...RETIRED_EXECUTOR_NAMES].sort())+ })+})diff --git a/src/api/mcp/builtin-tools.ts b/src/api/mcp/builtin-tools.tsindex aeee03f6..6d0ac6fa 100644--- a/src/api/mcp/builtin-tools.ts+++ b/src/api/mcp/builtin-tools.ts@@ -1405,8 +1405,14 @@ const RETIRED_MUTATING = new Set(['code_execute', 'shell_execute_background', 'shell_task_kill',])-/** Names that still resolve through the redirect, for override migration. */-export const RETIRED_TOOL_NAMES: ReadonlySet<string> = new Set(Object.keys(RETIRED_EXECUTORS))+/**+ * Names that still resolve through the redirect. The canonical list lives in+ * lib/retired-tools.ts (tool-registry needs it without importing this module);+ * re-exported here for the executors' callers. A test pins both to+ * RETIRED_EXECUTORS' keys.+ */+export { RETIRED_TOOL_NAMES } from '../../lib/retired-tools'+export const RETIRED_EXECUTOR_NAMES: ReadonlySet<string> = new Set(Object.keys(RETIRED_EXECUTORS))/*** Run a retired tool under its old name, or return null when the name wasdiff --git a/src/api/mcp/tool-registry.ts b/src/api/mcp/tool-registry.tsindex 392b0a6f..d6afe0f5 100644--- a/src/api/mcp/tool-registry.ts+++ b/src/api/mcp/tool-registry.ts@@ -4,6 +4,7 @@ import type { MCPToolDefinition, PermissionMap, PermissionLevel } from './types'import type { OllamaTool } from '../../types/agent-mode'import type { ToolDefinition } from '../providers/types'import { MUTATING_TOOLS } from '../../lib/mutating-tools'+import { RETIRED_TOOL_NAMES } from '../../lib/retired-tools'type ToolExecutor = (args: Record<string, any>) => Promise<string>/**@@ -78,6 +79,20 @@ export class ToolRegistry {return this.tools.get(name)?.definition}+ /**+ * Resolve a name to something the step executor may run: registered tools+ * by their definition, retired names (2.6.6 merge) as a schema-less stub so+ * the executor reaches execute(), where runRetiredTool redirects them.+ * Without this, the executor's own getTool miss fails the call as+ * "Unknown tool" before the redirect ever runs.+ */+ resolveExecutable(name: string): { name: string; inputSchema?: MCPToolDefinition['inputSchema'] } | undefined {+ const td = this.tools.get(name)?.definition+ if (td) return { name: td.name, inputSchema: td.inputSchema }+ if (RETIRED_TOOL_NAMES.has(name)) return { name }+ return undefined+ }+getPermissionLevel(toolName: string, permissions: PermissionMap): PermissionLevel {const tool = this.tools.get(toolName)?.definitionif (!tool) return 'confirm'diff --git a/src/hooks/useAgentChat.ts b/src/hooks/useAgentChat.tsindex a1cee7cd..01b2011a 100644--- a/src/hooks/useAgentChat.ts+++ b/src/hooks/useAgentChat.ts@@ -1448,10 +1448,7 @@ export function useAgentChat() {const auditIds = new Map<string, string>()const results = await executeParallel(requests, {- getTool: (name) => {- const td = toolRegistry.getToolByName(name)- return td ? { name: td.name, inputSchema: td.inputSchema } : undefined- },+ getTool: (name) => toolRegistry.resolveExecutable(name),// Timeout backstop shared with Codex (audit B9): before this the// Agent loop had NO ceiling around a tool call, so one hung tool// wedged the whole run with no way out but a restart.diff --git a/src/hooks/useCodex.ts b/src/hooks/useCodex.tsindex b857f986..578f3142 100644--- a/src/hooks/useCodex.ts+++ b/src/hooks/useCodex.ts@@ -1711,10 +1711,7 @@ export function useCodex() {}const results = await executeParallel(requests, {- getTool: (name) => {- const td = toolRegistry.getToolByName(name)- return td ? { name: td.name, inputSchema: td.inputSchema } : undefined- },+ getTool: (name) => toolRegistry.resolveExecutable(name),execute: (name: string, args: Record<string, any>) => {// A create tool the gate had closed still reaches the registry, so// the run self-heals: this call runs, and the next step offers thediff --git a/src/lib/retired-tools.ts b/src/lib/retired-tools.tsnew file mode 100644index 00000000..3fc67281--- /dev/null+++ b/src/lib/retired-tools.ts@@ -0,0 +1,27 @@+/**+ * 2.6.6 tool merge: names that no longer exist in the catalog but still+ * execute via the registry redirect (builtin-tools RETIRED_EXECUTORS).+ *+ * Standalone module on purpose: tool-registry needs this set synchronously+ * in resolveExecutable(), and importing builtin-tools there would close the+ * cycle tool-registry -> builtin-tools -> sub-agent -> tool-registry.+ * A unit test asserts this list equals the executor map's keys.+ */+export const RETIRED_TOOL_NAMES: ReadonlySet<string> = new Set([+ 'git_status',+ 'git_log',+ 'git_diff',+ 'git_commit',+ 'git_push',+ 'run_tests',+ 'gh_pr_create',+ 'project_init',+ 'code_execute',+ 'system_info',+ 'process_list',+ 'get_current_time',+ 'shell_execute_background',+ 'shell_task_status',+ 'shell_task_kill',+ 'shell_task_list',+])