fix(codemode): stop leaking undefined into tool arguments (#37652)

This commit is contained in:
Aiden Cline 2026-07-18 13:42:16 -05:00 committed by GitHub
commit 33f1b269e9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 97 additions and 20 deletions

View file

@ -89,7 +89,7 @@ const formatConsoleTable = (value: unknown, columnsArgument: unknown): string =>
const consoleTableColumns = (value: unknown): ReadonlyArray<string> | undefined => {
if (value === undefined) return undefined
if (containsRuntimeReference(value)) return undefined
const columns = copyOut(copyIn(value, "console.table columns"), true)
const columns = copyOut(copyIn(value, "console.table columns"), "nullify")
return Array.isArray(columns) ? columns.map((column) => String(column)) : undefined
}

View file

@ -18,7 +18,7 @@ export const invokeJsonMethod = (name: string, args: Array<unknown>, node: AstNo
}
const space = args[2]
const indent = typeof space === "number" || typeof space === "string" ? space : undefined
return JSON.stringify(copyOut(copyIn(args[0], "JSON.stringify value")), null, indent)
return JSON.stringify(copyOut(copyIn(args[0], "JSON.stringify value"), "json"), null, indent)
}
case "parse": {
const text = args[0]