Skip to content

Commit bdf7230

Browse files
fix(mcp): guide writes are not idempotent, and mixed batches flag failures
A repeat call after a run finishes starts another model run, so clients must not treat the tool as safe to retry. A batch where some guides started still counts the ones that failed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent b07bd70 commit bdf7230

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

‎apps/server/src/mcp/toolkits/pullRequests/tools.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ const WritePullRequestGuidesTool = Tool.make("write_pull_request_guides", {
394394
.annotate(Tool.Title, "Write pull request guides")
395395
.annotate(Tool.Readonly, false)
396396
.annotate(Tool.Destructive, false)
397-
.annotate(Tool.Idempotent, true)
397+
.annotate(Tool.Idempotent, false)
398398
.annotate(Tool.OpenWorld, true);
399399

400400
const ReadPullRequestGuideTool = Tool.make("read_pull_request_guide", {

‎packages/client-runtime/src/t3ToolSummary.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ describe("summarizeT3ToolCalls", () => {
3535
expect(
3636
summarizeT3ToolCalls("write-pr-guides", [
3737
completed({}, guides("started", "running", "failed")),
38-
]).label,
39-
).toBe("Started 2 review guides, 1 failed");
38+
]),
39+
).toEqual({ label: "Started 2 review guides, 1 failed", failedCount: 1 });
4040
const allFailed = summarizeT3ToolCalls("write-pr-guides", [
4141
completed({}, guides("failed", "failed")),
4242
]);

‎packages/client-runtime/src/t3ToolSummary.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,9 +408,9 @@ export function summarizeT3ToolCalls(
408408
);
409409
const started = outcomes.filter((outcome) => outcome !== "failed").length;
410410
const failed = outcomes.length - started;
411+
failedCount += failed;
411412
if (outcomes.length > 0 && started === 0) {
412413
label = `Could not start ${quantity(failed, "review guide")}`;
413-
failedCount += failed;
414414
} else {
415415
label = phrase(
416416
"Started",

0 commit comments

Comments
 (0)