fix: ensure @-ing a dir uses the read tool instead of dead list tool (#13428)

This commit is contained in:
Aiden Cline 2026-02-12 23:20:33 -06:00 committed by GitHub
commit 98aeb60a7f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -26,7 +26,6 @@ import { ToolRegistry } from "../tool/registry"
import { MCP } from "../mcp" import { MCP } from "../mcp"
import { LSP } from "../lsp" import { LSP } from "../lsp"
import { ReadTool } from "../tool/read" import { ReadTool } from "../tool/read"
import { ListTool } from "../tool/ls"
import { FileTime } from "../file/time" import { FileTime } from "../file/time"
import { Flag } from "../flag/flag" import { Flag } from "../flag/flag"
import { ulid } from "ulid" import { ulid } from "ulid"
@ -1198,7 +1197,7 @@ export namespace SessionPrompt {
} }
if (part.mime === "application/x-directory") { if (part.mime === "application/x-directory") {
const args = { path: filepath } const args = { filePath: filepath }
const listCtx: Tool.Context = { const listCtx: Tool.Context = {
sessionID: input.sessionID, sessionID: input.sessionID,
abort: new AbortController().signal, abort: new AbortController().signal,
@ -1209,7 +1208,7 @@ export namespace SessionPrompt {
metadata: async () => {}, metadata: async () => {},
ask: async () => {}, ask: async () => {},
} }
const result = await ListTool.init().then((t) => t.execute(args, listCtx)) const result = await ReadTool.init().then((t) => t.execute(args, listCtx))
return [ return [
{ {
id: Identifier.ascending("part"), id: Identifier.ascending("part"),
@ -1217,7 +1216,7 @@ export namespace SessionPrompt {
sessionID: input.sessionID, sessionID: input.sessionID,
type: "text", type: "text",
synthetic: true, synthetic: true,
text: `Called the list tool with the following input: ${JSON.stringify(args)}`, text: `Called the Read tool with the following input: ${JSON.stringify(args)}`,
}, },
{ {
id: Identifier.ascending("part"), id: Identifier.ascending("part"),