mcp: log artifact id after every github write (#633)

makes debugging easier by emitting a single `» <verb> <kind> <id>` line
after every successful GitHub write (and upload) the agent performs via
the Pullfrog MCP, mirroring the chevron convention used elsewhere.
This commit is contained in:
Colin McDonnell
2026-05-08 21:48:28 +00:00
committed by pullfrog[bot]
parent 17b610e1a1
commit 2e6c01670e
8 changed files with 27 additions and 1 deletions
+8
View File
@@ -78,6 +78,7 @@ export function CreateCommentTool(ctx: ToolContext) {
}); });
ctx.toolState.wasUpdated = true; ctx.toolState.wasUpdated = true;
log.info(`» created comment ${result.data.id}`);
if (commentType === "Plan") { if (commentType === "Plan") {
if (result.data.node_id) { if (result.data.node_id) {
@@ -94,6 +95,7 @@ export function CreateCommentTool(ctx: ToolContext) {
comment_id: result.data.id, comment_id: result.data.id,
body: bodyWithPlanLink, body: bodyWithPlanLink,
}); });
log.info(`» updated comment ${updateResult.data.id}`);
return { return {
success: true, success: true,
@@ -132,6 +134,7 @@ export function EditCommentTool(ctx: ToolContext) {
comment_id: commentId, comment_id: commentId,
body: bodyWithFooter, body: bodyWithFooter,
}); });
log.info(`» updated comment ${result.data.id}`);
return { return {
success: true, success: true,
@@ -339,6 +342,10 @@ export function ReportProgressTool(ctx: ToolContext) {
}; };
} }
if (result.commentId !== undefined) {
log.info(`» ${result.action} comment ${result.commentId}`);
}
if (!params.target_plan_comment) { if (!params.target_plan_comment) {
ctx.toolState.finalSummaryWritten = true; ctx.toolState.finalSummaryWritten = true;
} }
@@ -407,6 +414,7 @@ export function ReplyToReviewCommentTool(ctx: ToolContext) {
comment_id, comment_id,
body: bodyWithFooter, body: bodyWithFooter,
}); });
log.info(`» created review comment ${result.data.id} (in reply to ${comment_id})`);
// mark progress as updated so error reporting + run-result handling know // mark progress as updated so error reporting + run-result handling know
// a substantive write happened (used by reportErrorToComment / handleAgentResult) // a substantive write happened (used by reportErrorToComment / handleAgentResult)
+7
View File
@@ -351,6 +351,11 @@ export function PushBranchTool(ctx: ToolContext) {
throw lastErr instanceof Error ? lastErr : new Error(String(lastErr)); throw lastErr instanceof Error ? lastErr : new Error(String(lastErr));
} }
const pushedSha = $("git", ["rev-parse", "HEAD"], { log: false }).trim();
log.info(
`» pushed branch ${branch} to ${pushDest.remoteName}/${pushDest.remoteBranch} (sha ${pushedSha})`
);
return { return {
success: true, success: true,
branch, branch,
@@ -595,6 +600,7 @@ export function DeleteBranchTool(ctx: ToolContext) {
await $git("push", ["origin", "--delete", `refs/heads/${params.branchName}`], { await $git("push", ["origin", "--delete", `refs/heads/${params.branchName}`], {
token: ctx.gitToken, token: ctx.gitToken,
}); });
log.info(`» deleted branch ${params.branchName}`);
return { success: true, deleted: params.branchName }; return { success: true, deleted: params.branchName };
}), }),
}); });
@@ -625,6 +631,7 @@ export function PushTagsTool(ctx: ToolContext) {
await $git("push", pushArgs, { await $git("push", pushArgs, {
token: ctx.gitToken, token: ctx.gitToken,
}); });
log.info(`» pushed tag ${params.tag}`);
return { success: true, tag: params.tag }; return { success: true, tag: params.tag };
}), }),
}); });
+3
View File
@@ -1,4 +1,5 @@
import { type } from "arktype"; import { type } from "arktype";
import { log } from "../utils/cli.ts";
import { fixDoubleEscapedString } from "../utils/fixDoubleEscapedString.ts"; import { fixDoubleEscapedString } from "../utils/fixDoubleEscapedString.ts";
import { patchWorkflowRunFields } from "../utils/patchWorkflowRunFields.ts"; import { patchWorkflowRunFields } from "../utils/patchWorkflowRunFields.ts";
import type { ToolContext } from "./server.ts"; import type { ToolContext } from "./server.ts";
@@ -32,6 +33,8 @@ export function IssueTool(ctx: ToolContext) {
assignees: params.assignees ?? [], assignees: params.assignees ?? [],
}); });
log.info(`» created issue #${result.data.number} (id ${result.data.id})`);
const nodeId = result.data.node_id; const nodeId = result.data.node_id;
if (typeof nodeId === "string" && nodeId.length > 0) { if (typeof nodeId === "string" && nodeId.length > 0) {
await patchWorkflowRunFields(ctx, { await patchWorkflowRunFields(ctx, {
+2
View File
@@ -1,4 +1,5 @@
import { type } from "arktype"; import { type } from "arktype";
import { log } from "../utils/cli.ts";
import type { ToolContext } from "./server.ts"; import type { ToolContext } from "./server.ts";
import { execute, tool } from "./shared.ts"; import { execute, tool } from "./shared.ts";
@@ -20,6 +21,7 @@ export function AddLabelsTool(ctx: ToolContext) {
issue_number, issue_number,
labels, labels,
}); });
log.info(`» added labels [${labels.join(", ")}] to issue #${issue_number}`);
return { return {
success: true, success: true,
+2
View File
@@ -48,6 +48,7 @@ export function UpdatePullRequestBodyTool(ctx: ToolContext) {
pull_number: params.pull_number, pull_number: params.pull_number,
body: bodyWithFooter, body: bodyWithFooter,
}); });
log.info(`» updated pull request #${result.data.number}`);
ctx.toolState.wasUpdated = true; ctx.toolState.wasUpdated = true;
@@ -80,6 +81,7 @@ export function CreatePullRequestTool(ctx: ToolContext) {
base: params.base, base: params.base,
draft: params.draft ?? false, draft: params.draft ?? false,
}); });
log.info(`» created pull request #${result.data.number} (id ${result.data.id})`);
// best-effort: request review from the user who triggered the workflow // best-effort: request review from the user who triggered the workflow
const reviewer = ctx.payload.triggerer; const reviewer = ctx.payload.triggerer;
+1
View File
@@ -584,6 +584,7 @@ export function CreatePullRequestReviewTool(ctx: ToolContext) {
} }
const reviewId = result.data.id; const reviewId = result.data.id;
const reviewNodeId = result.data.node_id; const reviewNodeId = result.data.node_id;
log.info(`» created review ${reviewId} on pull request #${pull_number}`);
// reviewedSha = what the agent actually reviewed (checkout SHA), not the // reviewedSha = what the agent actually reviewed (checkout SHA), not the
// submission anchor (current HEAD). this ensures postReviewCleanup dispatches // submission anchor (current HEAD). this ensures postReviewCleanup dispatches
+1 -1
View File
@@ -735,7 +735,7 @@ export function ResolveReviewThreadTool(ctx: ToolContext) {
}); });
const thread = response.resolveReviewThread.thread; const thread = response.resolveReviewThread.thread;
log.debug(`resolved thread ${thread.id}, isResolved=${thread.isResolved}`); log.info(`» resolved review thread ${thread.id}`);
return { return {
thread_id: thread.id, thread_id: thread.id,
+3
View File
@@ -3,6 +3,7 @@ import * as path from "node:path";
import { type } from "arktype"; import { type } from "arktype";
import { fileTypeFromBuffer } from "file-type"; import { fileTypeFromBuffer } from "file-type";
import { apiFetch } from "../utils/apiFetch.ts"; import { apiFetch } from "../utils/apiFetch.ts";
import { log } from "../utils/cli.ts";
import type { ToolContext } from "./server.ts"; import type { ToolContext } from "./server.ts";
import { execute, tool } from "./shared.ts"; import { execute, tool } from "./shared.ts";
@@ -65,6 +66,8 @@ export function UploadFileTool(ctx: ToolContext) {
throw new Error(`failed to upload file: ${uploadResponse.statusText}`); throw new Error(`failed to upload file: ${uploadResponse.statusText}`);
} }
log.info(`» uploaded file ${publicUrl}`);
return { success: true, publicUrl, filename, contentLength, contentType }; return { success: true, publicUrl, filename, contentLength, contentType };
}), }),
}); });