fix(coding-agent): keep ast_grep/ast_edit patterns in transcript summaries

Adding `paths` to the global PRIMARY_ARG_KEYS hid the pattern for the
structural tools: ast_grep ({pat,paths}) and ast_edit ({ops,paths})
rendered scope-only (e.g. `ast_grep(src/**/*.ts)`), dropping `pat`/`ops`
— the most decision-relevant argument. Drop the global `paths` key and
special-case `find` (mirroring `search`) so find/search still surface
scope while ast_grep/ast_edit keep showing their pattern via the
existing fallback. Adds regression tests for both structural tools.
This commit is contained in:
pr-eval
2026-06-25 18:43:58 +02:00
committed by can1357
parent 3ba39c1ec4
commit 0fb6af9354
2 changed files with 62 additions and 1 deletions
@@ -172,6 +172,64 @@ describe("formatSessionHistoryMarkdown", () => {
);
});
it("keeps the ast_grep pattern visible instead of only its paths scope", () => {
const output = formatSessionHistoryMarkdown([
{
role: "assistant",
content: [
{
type: "toolCall",
id: "tc-astgrep",
name: "ast_grep",
arguments: { pat: "console.log($$$)", paths: ["packages/coding-agent/src/**/*.ts"] },
},
],
timestamp: 1,
},
{
role: "toolResult",
toolCallId: "tc-astgrep",
toolName: "ast_grep",
content: [{ type: "text", text: "match" }],
isError: false,
timestamp: 2,
},
]);
expect(output).toContain("→ ast_grep(console.log($$$)) ⇒ ok · 1 line");
});
it("keeps the ast_edit op pattern visible instead of only its paths scope", () => {
const output = formatSessionHistoryMarkdown([
{
role: "assistant",
content: [
{
type: "toolCall",
id: "tc-astedit",
name: "ast_edit",
arguments: {
ops: [{ pat: "oldApi($$$A)", out: "newApi($$$A)" }],
paths: ["packages/coding-agent/src/**/*.ts"],
},
},
],
timestamp: 1,
},
{
role: "toolResult",
toolCallId: "tc-astedit",
toolName: "ast_edit",
content: [{ type: "text", text: "1 change" }],
isError: false,
timestamp: 2,
},
]);
expect(output).toContain("oldApi($$$A)");
expect(output).not.toContain("→ ast_edit(packages/coding-agent/src/**/*.ts)");
});
it("renders tool intent comments immediately before tool call lines when includeToolIntent is true", () => {
const messages = [
{