c6a3ee0e9a
* show model name in footer, drop pullfrog.com link add model slug to buildPullfrogFooter so every Pullfrog comment displays the active model (e.g. "Using `Big Pickle` (free)" or "Using `Claude Opus`"). remove the pullfrog.com link from all footers. Made-with: Cursor * reject <br/> tags in comment bodies, add prompt guidance add runtime validation in addFooter that throws if <br/> is followed by a non-blank line (breaks GitHub heading rendering). the agent sees the error and retries with clean markdown. also update Summarize mode prompt to explicitly forbid <br/> tags. Made-with: Cursor * fix <br/> guidance: move to event instructions, clarify blank line rule the formatting rule belongs in DEFAULT_PR_SUMMARY_INSTRUCTIONS (event instructions), not the Summarize mode prompt. clarify that <br/> must always be followed by a blank line before headings. Made-with: Cursor * generalize block-level HTML rule in summary instructions add a prominent top-level rule about requiring blank lines between ALL block-level HTML elements and markdown syntax, not just <br/>. Made-with: Cursor * move model to toolState instead of threading through params model is set once at startup and read everywhere — it belongs on toolState, not threaded as a separate param through 8 call sites. postCleanup runs without toolState so it just omits the model label. Made-with: Cursor * update models.dev snapshot (openai latest changed) Made-with: Cursor * add comment to models snapshot test explaining its purpose Made-with: Cursor
52 lines
1.5 KiB
TypeScript
52 lines
1.5 KiB
TypeScript
import type { ToolState } from "../mcp/server.ts";
|
|
import { getApiUrl } from "./apiUrl.ts";
|
|
import { buildPullfrogFooter } from "./buildPullfrogFooter.ts";
|
|
import { createOctokit, parseRepoContext } from "./github.ts";
|
|
import { getGitHubInstallationToken } from "./token.ts";
|
|
|
|
interface ReportErrorParams {
|
|
toolState: ToolState;
|
|
error: string;
|
|
title?: string;
|
|
}
|
|
|
|
export async function reportErrorToComment(ctx: ReportErrorParams): Promise<void> {
|
|
const formattedError = ctx.title ? `${ctx.title}\n\n${ctx.error}` : ctx.error;
|
|
|
|
const commentId = ctx.toolState.progressCommentId;
|
|
if (!commentId) {
|
|
return;
|
|
}
|
|
|
|
const repoContext = parseRepoContext();
|
|
const octokit = createOctokit(getGitHubInstallationToken());
|
|
const runId = process.env.GITHUB_RUN_ID
|
|
? Number.parseInt(process.env.GITHUB_RUN_ID, 10)
|
|
: undefined;
|
|
|
|
const customParts: string[] = [];
|
|
if (runId) {
|
|
const apiUrl = getApiUrl();
|
|
customParts.push(
|
|
`[Rerun failed job ➔](${apiUrl}/trigger/${repoContext.owner}/${repoContext.name}/${runId}?action=rerun)`
|
|
);
|
|
}
|
|
|
|
const footer = buildPullfrogFooter({
|
|
triggeredBy: true,
|
|
workflowRun: runId ? { owner: repoContext.owner, repo: repoContext.name, runId } : undefined,
|
|
customParts,
|
|
model: ctx.toolState.model,
|
|
});
|
|
|
|
await octokit.rest.issues.updateComment({
|
|
owner: repoContext.owner,
|
|
repo: repoContext.name,
|
|
comment_id: commentId,
|
|
body: `${formattedError}${footer}`,
|
|
});
|
|
|
|
// mark as updated so exit handler doesn't try to update again
|
|
ctx.toolState.wasUpdated = true;
|
|
}
|