pullfrog 0.1.6 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -107744,7 +107744,8 @@ var providers = {
107744
107744
  displayName: "Claude Opus",
107745
107745
  resolve: "anthropic/claude-opus-4-7",
107746
107746
  openRouterResolve: "openrouter/anthropic/claude-opus-4.7",
107747
- preferred: true
107747
+ preferred: true,
107748
+ subagentModel: "claude-sonnet"
107748
107749
  },
107749
107750
  "claude-sonnet": {
107750
107751
  displayName: "Claude Sonnet",
@@ -107766,12 +107767,23 @@ var providers = {
107766
107767
  displayName: "GPT",
107767
107768
  resolve: "openai/gpt-5.5",
107768
107769
  openRouterResolve: "openrouter/openai/gpt-5.5",
107769
- preferred: true
107770
+ preferred: true,
107771
+ subagentModel: "gpt-5.4"
107770
107772
  },
107771
107773
  "gpt-pro": {
107772
107774
  displayName: "GPT Pro",
107773
107775
  resolve: "openai/gpt-5.5-pro",
107774
- openRouterResolve: "openrouter/openai/gpt-5.5-pro"
107776
+ openRouterResolve: "openrouter/openai/gpt-5.5-pro",
107777
+ subagentModel: "gpt"
107778
+ },
107779
+ // hidden subagent target — `gpt` lenses run against this. surfacing
107780
+ // it in the picker would just confuse users (it's the prior-flagship,
107781
+ // and they already have `gpt` and `gpt-mini` to choose from).
107782
+ "gpt-5.4": {
107783
+ displayName: "GPT 5.4",
107784
+ resolve: "openai/gpt-5.4",
107785
+ openRouterResolve: "openrouter/openai/gpt-5.4",
107786
+ hidden: true
107775
107787
  },
107776
107788
  "gpt-mini": {
107777
107789
  displayName: "GPT Mini",
@@ -107809,7 +107821,8 @@ var providers = {
107809
107821
  displayName: "Gemini Pro",
107810
107822
  resolve: "google/gemini-3.1-pro-preview",
107811
107823
  openRouterResolve: "openrouter/google/gemini-3.1-pro-preview",
107812
- preferred: true
107824
+ preferred: true,
107825
+ subagentModel: "gemini-flash"
107813
107826
  },
107814
107827
  "gemini-flash": {
107815
107828
  displayName: "Gemini Flash",
@@ -107897,7 +107910,8 @@ var providers = {
107897
107910
  "claude-opus": {
107898
107911
  displayName: "Claude Opus",
107899
107912
  resolve: "opencode/claude-opus-4-7",
107900
- openRouterResolve: "openrouter/anthropic/claude-opus-4.7"
107913
+ openRouterResolve: "openrouter/anthropic/claude-opus-4.7",
107914
+ subagentModel: "claude-sonnet"
107901
107915
  },
107902
107916
  "claude-sonnet": {
107903
107917
  displayName: "Claude Sonnet",
@@ -107912,12 +107926,21 @@ var providers = {
107912
107926
  gpt: {
107913
107927
  displayName: "GPT",
107914
107928
  resolve: "opencode/gpt-5.5",
107915
- openRouterResolve: "openrouter/openai/gpt-5.5"
107929
+ openRouterResolve: "openrouter/openai/gpt-5.5",
107930
+ subagentModel: "gpt-5.4"
107916
107931
  },
107917
107932
  "gpt-pro": {
107918
107933
  displayName: "GPT Pro",
107919
107934
  resolve: "opencode/gpt-5.5-pro",
107920
- openRouterResolve: "openrouter/openai/gpt-5.5-pro"
107935
+ openRouterResolve: "openrouter/openai/gpt-5.5-pro",
107936
+ subagentModel: "gpt"
107937
+ },
107938
+ // hidden subagent target — see openai provider above for context.
107939
+ "gpt-5.4": {
107940
+ displayName: "GPT 5.4",
107941
+ resolve: "opencode/gpt-5.4",
107942
+ openRouterResolve: "openrouter/openai/gpt-5.4",
107943
+ hidden: true
107921
107944
  },
107922
107945
  "gpt-mini": {
107923
107946
  displayName: "GPT Mini",
@@ -107940,7 +107963,8 @@ var providers = {
107940
107963
  "gemini-pro": {
107941
107964
  displayName: "Gemini Pro",
107942
107965
  resolve: "opencode/gemini-3.1-pro",
107943
- openRouterResolve: "openrouter/google/gemini-3.1-pro-preview"
107966
+ openRouterResolve: "openrouter/google/gemini-3.1-pro-preview",
107967
+ subagentModel: "gemini-flash"
107944
107968
  },
107945
107969
  "gemini-flash": {
107946
107970
  displayName: "Gemini Flash",
@@ -107972,6 +107996,20 @@ var providers = {
107972
107996
  }
107973
107997
  }
107974
107998
  }),
107999
+ bedrock: provider({
108000
+ displayName: "Amazon Bedrock",
108001
+ envVars: ["AWS_BEARER_TOKEN_BEDROCK", "AWS_REGION", "BEDROCK_MODEL_ID"],
108002
+ models: {
108003
+ // single routing entry — the actual Bedrock model ID is read from
108004
+ // BEDROCK_MODEL_ID at run time. see ModelRouting docs for why we
108005
+ // don't catalog individual Bedrock models.
108006
+ byok: {
108007
+ displayName: "Amazon Bedrock",
108008
+ resolve: "bedrock",
108009
+ routing: "bedrock"
108010
+ }
108011
+ }
108012
+ }),
107975
108013
  openrouter: provider({
107976
108014
  displayName: "OpenRouter",
107977
108015
  envVars: ["OPENROUTER_API_KEY"],
@@ -107980,7 +108018,8 @@ var providers = {
107980
108018
  displayName: "Claude Opus",
107981
108019
  resolve: "openrouter/anthropic/claude-opus-4.7",
107982
108020
  openRouterResolve: "openrouter/anthropic/claude-opus-4.7",
107983
- preferred: true
108021
+ preferred: true,
108022
+ subagentModel: "claude-sonnet"
107984
108023
  },
107985
108024
  "claude-sonnet": {
107986
108025
  displayName: "Claude Sonnet",
@@ -107995,12 +108034,21 @@ var providers = {
107995
108034
  gpt: {
107996
108035
  displayName: "GPT",
107997
108036
  resolve: "openrouter/openai/gpt-5.5",
107998
- openRouterResolve: "openrouter/openai/gpt-5.5"
108037
+ openRouterResolve: "openrouter/openai/gpt-5.5",
108038
+ subagentModel: "gpt-5.4"
107999
108039
  },
108000
108040
  "gpt-pro": {
108001
108041
  displayName: "GPT Pro",
108002
108042
  resolve: "openrouter/openai/gpt-5.5-pro",
108003
- openRouterResolve: "openrouter/openai/gpt-5.5-pro"
108043
+ openRouterResolve: "openrouter/openai/gpt-5.5-pro",
108044
+ subagentModel: "gpt"
108045
+ },
108046
+ // hidden subagent target — see openai provider above for context.
108047
+ "gpt-5.4": {
108048
+ displayName: "GPT 5.4",
108049
+ resolve: "openrouter/openai/gpt-5.4",
108050
+ openRouterResolve: "openrouter/openai/gpt-5.4",
108051
+ hidden: true
108004
108052
  },
108005
108053
  "gpt-mini": {
108006
108054
  displayName: "GPT Mini",
@@ -108028,7 +108076,8 @@ var providers = {
108028
108076
  "gemini-pro": {
108029
108077
  displayName: "Gemini Pro",
108030
108078
  resolve: "openrouter/google/gemini-3.1-pro-preview",
108031
- openRouterResolve: "openrouter/google/gemini-3.1-pro-preview"
108079
+ openRouterResolve: "openrouter/google/gemini-3.1-pro-preview",
108080
+ subagentModel: "gemini-flash"
108032
108081
  },
108033
108082
  "gemini-flash": {
108034
108083
  displayName: "Gemini Flash",
@@ -108097,7 +108146,13 @@ var modelAliases = Object.entries(providers).flatMap(
108097
108146
  openRouterResolve: def.openRouterResolve,
108098
108147
  preferred: def.preferred ?? false,
108099
108148
  isFree: def.isFree ?? false,
108100
- fallback: def.fallback
108149
+ fallback: def.fallback,
108150
+ routing: def.routing,
108151
+ // subagentModel is stored as an alias key local to the provider; expand
108152
+ // here to a fully-qualified slug so callers can look up the target alias
108153
+ // directly without re-deriving the provider.
108154
+ subagentModel: def.subagentModel ? `${providerKey}/${def.subagentModel}` : void 0,
108155
+ hidden: def.hidden ?? false
108101
108156
  }))
108102
108157
  );
108103
108158
  var MAX_FALLBACK_DEPTH = 10;
@@ -108117,6 +108172,10 @@ function resolveDisplayAlias(slug2) {
108117
108172
  function resolveCliModel(slug2) {
108118
108173
  return resolveDisplayAlias(slug2)?.resolve;
108119
108174
  }
108175
+ var BEDROCK_MODEL_ID_ENV = "BEDROCK_MODEL_ID";
108176
+ function isBedrockAnthropicId(bedrockModelId) {
108177
+ return bedrockModelId.toLowerCase().split(/[./:]/).includes("anthropic");
108178
+ }
108120
108179
 
108121
108180
  // utils/buildPullfrogFooter.ts
108122
108181
  var PULLFROG_DIVIDER = "<!-- PULLFROG_DIVIDER_DO_NOT_REMOVE_PLZ -->";
@@ -108964,7 +109023,7 @@ var Comment = type({
108964
109023
  function CreateCommentTool(ctx) {
108965
109024
  return tool({
108966
109025
  name: "create_issue_comment",
108967
- description: "Create a comment on a GitHub issue or PR. For progress/plan updates on the current run use report_progress instead. Use type: 'Plan' for plan comments.",
109026
+ description: "Create a comment on a GitHub issue or PR. Example: `create_issue_comment({ issueNumber: 1234, body: \"Thanks for the report.\" })`. For progress/plan updates on the current run use report_progress instead. Use type: 'Plan' for plan comments.",
108968
109027
  parameters: Comment,
108969
109028
  execute: execute(async ({ issueNumber, body, type: commentType }) => {
108970
109029
  const bodyWithFooter = addFooter(ctx, body);
@@ -109132,7 +109191,7 @@ async function reportProgress(ctx, params) {
109132
109191
  function ReportProgressTool(ctx) {
109133
109192
  return tool({
109134
109193
  name: "report_progress",
109135
- description: "Share progress on the associated GitHub issue/PR. The first call creates a comment; subsequent calls update it in place. Call this at the end of every run with a brief final summary (1-3 sentences) unless the mode guidance instructs otherwise. The current task list is automatically appended in a collapsible section \u2014 do not restate individual steps.",
109194
+ description: 'Share progress on the associated GitHub issue/PR. The first call creates a comment; subsequent calls update it in place. Example: `report_progress({ body: "Implemented the auth check and added tests." })`. Call this at the end of every run with a brief final summary (1-3 sentences) unless the mode guidance instructs otherwise. The current task list is automatically appended in a collapsible section \u2014 do not restate individual steps.',
109136
109195
  parameters: ReportProgress,
109137
109196
  execute: execute(async (params) => {
109138
109197
  let body = params.body;
@@ -109212,7 +109271,7 @@ function duplicateReplyDecision(params) {
109212
109271
  function ReplyToReviewCommentTool(ctx) {
109213
109272
  return tool({
109214
109273
  name: "reply_to_review_comment",
109215
- description: "Reply to a PR review comment thread (NOT issue comments \u2014 this only works for inline review comments on PR diffs). Call exactly ONCE per parent comment you address in AddressReviews mode \u2014 duplicate calls with the same body are a no-op. Keep replies extremely brief (1 sentence max).",
109274
+ description: 'Reply to a PR review comment thread (NOT issue comments \u2014 this only works for inline review comments on PR diffs). Example: `reply_to_review_comment({ pull_number: 1234, comment_id: 567890, body: "Fixed by adding a null check." })`. Call exactly ONCE per parent comment you address in AddressReviews mode \u2014 duplicate calls with the same body are a no-op. Keep replies extremely brief (1 sentence max).',
109216
109275
  parameters: ReplyToReviewComment,
109217
109276
  execute: execute(async ({ pull_number, comment_id, body }) => {
109218
109277
  const bodyWithFooter = addFooter(ctx, body);
@@ -142355,7 +142414,7 @@ var import_semver = __toESM(require_semver2(), 1);
142355
142414
  // package.json
142356
142415
  var package_default = {
142357
142416
  name: "pullfrog",
142358
- version: "0.1.6",
142417
+ version: "0.1.7",
142359
142418
  type: "module",
142360
142419
  bin: {
142361
142420
  pullfrog: "dist/cli.mjs",
@@ -143211,7 +143270,7 @@ function PushBranchTool(ctx) {
143211
143270
  const pushPermission = ctx.payload.push;
143212
143271
  return tool({
143213
143272
  name: "push_branch",
143214
- description: "Push the current branch to the remote repository. Omit branchName to push the current branch (recommended). If specifying branchName, use the LOCAL branch name (e.g., 'pr-1'), not the remote branch name. The correct remote and remote branch are determined automatically from branch config set by checkout_pr. Requires a clean working tree. Runs the repository prepush hook (if configured) before the network push \u2014 hook failure means tests/lint or similar in that script failed, not necessarily a Pullfrog timeout. Never force push unless explicitly requested. Pushes to the default branch are blocked in restricted mode.",
143273
+ description: "Push the current branch to the remote repository. Omit branchName to push the current branch (recommended). Example: `push_branch({})` to push the current branch. Example: `push_branch({ branchName: \"pr-1\" })` to push a specific local branch. If specifying branchName, use the LOCAL branch name (e.g., 'pr-1'), not the remote branch name. The correct remote and remote branch are determined automatically from branch config set by checkout_pr. Requires a clean working tree. Runs the repository prepush hook (if configured) before the network push \u2014 hook failure means tests/lint or similar in that script failed, not necessarily a Pullfrog timeout. Never force push unless explicitly requested. Pushes to the default branch are blocked in restricted mode. If the response reports a timeout, the underlying push may have actually succeeded \u2014 verify with `git log origin/<branch>` (or this tool with command 'log') before retrying, otherwise you'll push a duplicate.",
143215
143274
  parameters: PushBranch,
143216
143275
  execute: execute(async ({ branchName, force }) => {
143217
143276
  if (pushPermission === "disabled") {
@@ -143350,7 +143409,7 @@ var Git = type({
143350
143409
  function GitTool(ctx) {
143351
143410
  return tool({
143352
143411
  name: "git",
143353
- description: "Run git commands. For push/fetch, use the dedicated MCP tools (push_branch, git_fetch). git pull is not available \u2014 use git_fetch then this tool with command 'merge'.",
143412
+ description: 'Run a git subcommand. `command` is a single subcommand; flags and positional args go in `args`. Example: `git({ command: "log", args: ["--oneline", "-n", "20"] })`. Example: `git({ command: "diff", args: ["origin/main..HEAD"] })`. For push/fetch, use the dedicated MCP tools (push_branch, git_fetch). git pull is not available \u2014 use git_fetch then this tool with command \'merge\'.',
143354
143413
  parameters: Git,
143355
143414
  execute: execute(async (params) => {
143356
143415
  const command = params.command;
@@ -143400,7 +143459,7 @@ var DEEPEN_RETRY_DEPTH = 1e3;
143400
143459
  function GitFetchTool(ctx) {
143401
143460
  return tool({
143402
143461
  name: "git_fetch",
143403
- description: "Fetch refs from remote repository. Use this instead of git fetch directly.",
143462
+ description: 'Fetch refs from remote repository. Use this instead of git fetch directly. Example: `git_fetch({ ref: "main" })`. With depth: `git_fetch({ ref: "pull/1234/head", depth: 1 })`.',
143404
143463
  parameters: GitFetch,
143405
143464
  execute: execute(async (params) => {
143406
143465
  rejectIfLeadingDash(params.ref, "ref");
@@ -143634,13 +143693,15 @@ var CreatePullRequestReview = type({
143634
143693
  approved: type.boolean.describe(
143635
143694
  "Set to true to submit as an approval. Use for both 'no issues found' and informational `> [!NOTE]` reviews where the PR is mergeable as-is and nothing in the body warrants code changes \u2014 approving also suppresses the Fix-button footer affordance so users don't dispatch a fix run on non-actionable feedback. Reserve approved: false for `> [!IMPORTANT]` (recommended changes) and `> [!CAUTION]` (critical) reviews. Defaults to false (comment-only review). Rejections are not supported."
143636
143695
  ).optional(),
143637
- commit_id: type.string.describe("Optional SHA of the commit being reviewed. Defaults to latest.").optional(),
143696
+ commit_id: type.string.describe(
143697
+ "Optional SHA of the commit being reviewed. Defaults to latest. Must be the FULL 40-character SHA \u2014 abbreviated SHAs are rejected by GitHub with `422 Unprocessable Entity`. The PR-synchronize event payload's `head_sha` is already full-length."
143698
+ ).optional(),
143638
143699
  comments: type({
143639
143700
  path: type.string.describe(
143640
143701
  "The file path to comment on (relative to repo root). Must be a file that appears in the PR diff."
143641
143702
  ),
143642
143703
  line: type.number.describe(
143643
- "Line number to comment on. For multi-line ranges, this is the end line. Use NEW column from diff format."
143704
+ "Line number to comment on. For multi-line ranges, this is the end line. Use NEW column from diff format. Must sit inside a `@@` hunk in the PR diff \u2014 anchors on context-only or untouched lines are dropped silently (the rest of the review still posts; dropped entries are reported under `droppedComments` in the response)."
143644
143705
  ),
143645
143706
  side: type.enumerated("LEFT", "RIGHT").describe(
143646
143707
  "Side of the diff: LEFT (old code, lines starting with -) or RIGHT (new code, lines starting with + or unchanged). Defaults to RIGHT."
@@ -143650,7 +143711,7 @@ var CreatePullRequestReview = type({
143650
143711
  "Full replacement code for the line range [start_line, line]. MUST preserve the exact indentation of the original code."
143651
143712
  ).optional(),
143652
143713
  start_line: type.number.describe(
143653
- "Start line for multi-line comment ranges. Omit for single-line comments. The range [start_line, line] defines which lines a suggestion replaces."
143714
+ "Start line for multi-line comment ranges. Omit for single-line comments. The range [start_line, line] defines which lines a suggestion replaces. Both `start_line` and `line` must sit inside the same `@@` hunk \u2014 a `start_line` outside the hunk causes the whole comment to be dropped even when `line` is valid. If you need to comment on context just above/below a hunk, shrink the range to a single line that is provably modified."
143654
143715
  ).optional()
143655
143716
  }).array().describe(
143656
143717
  "Inline comments on lines within diff hunks. Feedback about code outside the diff goes in 'body' instead."
@@ -143659,7 +143720,7 @@ var CreatePullRequestReview = type({
143659
143720
  function CreatePullRequestReviewTool(ctx) {
143660
143721
  return tool({
143661
143722
  name: "create_pull_request_review",
143662
- description: `Submit a review for an existing pull request. Each call creates a permanent, visible review on the PR \u2014 NEVER submit test or diagnostic reviews. Reviews with no body AND no comments are silently skipped (nothing to post). IMPORTANT: 95%+ of feedback should be in 'comments' array with file paths and line numbers. Only use 'body' for a 1-2 sentence summary with urgency and critical callouts. Use 'suggestion' to propose replacement code - MUST preserve exact indentation of original code. The first submission may error once with a one-time diff-coverage nudge listing unread TOC regions \u2014 retry with the same arguments and the pre-flight will not block again. Example replacing lines 42-44 (3 lines) with 5 lines: { path: 'src/api.ts', start_line: 42, line: 44, suggestion: ' const result = await fetch(url);\\n if (!result.ok) {\\n log.error(result.status);\\n throw new Error("request failed");\\n }' } CONSTRAINT: Inline comments can ONLY target files and lines that appear in the PR diff. Comments anchored outside a diff hunk are dropped automatically (with a note appended to the review body) \u2014 the rest of the review still posts.`,
143723
+ description: `Submit a review for an existing pull request. Example: \`create_pull_request_review({ pull_number: 1234, body: "LGTM", approved: true, comments: [{ path: "src/api.ts", line: 42, body: "nit: rename" }] })\`. Each call creates a permanent, visible review on the PR \u2014 NEVER submit test or diagnostic reviews. Reviews with no body AND no comments are silently skipped (nothing to post). IMPORTANT: 95%+ of feedback should be in 'comments' array with file paths and line numbers. Only use 'body' for a 1-2 sentence summary with urgency and critical callouts. Use 'suggestion' to propose replacement code - MUST preserve exact indentation of original code. The first submission may error once with a one-time diff-coverage nudge listing unread TOC regions \u2014 retry with the same arguments and the pre-flight will not block again. Example replacing lines 42-44 (3 lines) with 5 lines: { path: 'src/api.ts', start_line: 42, line: 44, suggestion: ' const result = await fetch(url);\\n if (!result.ok) {\\n log.error(result.status);\\n throw new Error("request failed");\\n }' } CONSTRAINT: Inline comments can ONLY target files and lines that appear in the PR diff. Comments anchored outside a diff hunk are dropped automatically (with a note appended to the review body) \u2014 the rest of the review still posts.`,
143663
143724
  parameters: CreatePullRequestReview,
143664
143725
  execute: execute(async ({ pull_number, body, approved, commit_id, comments = [] }) => {
143665
143726
  if (body) body = fixDoubleEscapedString(body);
@@ -143888,7 +143949,7 @@ function runDiffCoveragePreflight(params) {
143888
143949
  );
143889
143950
  const unreadText = unread.map((entry) => `- ${entry.path} (${entry.unreadLines} lines, ${entry.ranges})`).join("\n");
143890
143951
  throw new Error(
143891
- `diff coverage pre-flight: some TOC regions were not read before review submission. this is a one-time nudge \u2014 optionally read the ranges below from ${coverageState.diffPath}, then call create_pull_request_review again with the same arguments. this pre-flight will not block again in this review session.
143952
+ `diff coverage pre-flight: some TOC regions were not read before review submission. this is a one-time nudge \u2014 read the ranges below from ${coverageState.diffPath} on a best-effort basis, then call create_pull_request_review again. you are NOT obligated to read generated artifacts (lockfiles like pnpm-lock.yaml / package-lock.json / yarn.lock / Cargo.lock; codegen output like *.gen.*, *.pb.go, *.generated.*; snapshot/fixture dirs like __snapshots__/; migration metadata like drizzle/meta/, prisma migration SQL). if every unread region is generated, retry immediately without reading. this pre-flight will not block again in this review session.
143892
143953
 
143893
143954
  unread TOC regions:
143894
143955
  ${unreadText}
@@ -144335,7 +144396,7 @@ async function checkoutPrBranch(pr, params) {
144335
144396
  function CheckoutPrTool(ctx) {
144336
144397
  return tool({
144337
144398
  name: "checkout_pr",
144338
- description: "Checkout a pull request branch locally. This fetches the PR branch and sets up push configuration for fork PRs. Returns diffPath pointing to the formatted diff file.",
144399
+ description: "Checkout a pull request branch locally. This fetches the PR branch and sets up push configuration for fork PRs. Returns diffPath pointing to the formatted diff file. Example: `checkout_pr({ pull_number: 1234 })`. Transient fetch timeouts are common \u2014 retry the same call up to a few times before treating the failure as terminal. If the error mentions `.git/shallow.lock: File exists` or `.git/index.lock: File exists`, that's a stale lock from a prior timed-out fetch \u2014 remove it via the shell tool (`rm -f .git/shallow.lock .git/index.lock`) and retry.",
144339
144400
  parameters: CheckoutPr,
144340
144401
  execute: execute(async ({ pull_number }) => {
144341
144402
  const prResponse = await ctx.octokit.rest.pulls.get({
@@ -144646,7 +144707,7 @@ var CommitInfo = type({
144646
144707
  function CommitInfoTool(ctx) {
144647
144708
  return tool({
144648
144709
  name: "get_commit_info",
144649
- description: "Retrieve commit metadata and diff via GitHub API. Use this instead of git show for reviewing commits - it works with shallow clones and shows the actual changes in the commit. Returns diffPath pointing to formatted diff file.",
144710
+ description: 'Retrieve commit metadata and diff via GitHub API. Use this instead of git show for reviewing commits - it works with shallow clones and shows the actual changes in the commit. Returns diffPath pointing to formatted diff file. Example: `get_commit_info({ sha: "2a6ab5d" })`.',
144650
144711
  parameters: CommitInfo,
144651
144712
  execute: execute(async ({ sha }) => {
144652
144713
  const response = await ctx.octokit.rest.repos.getCommit({
@@ -144737,7 +144798,7 @@ var GetIssueComments = type({
144737
144798
  function GetIssueCommentsTool(ctx) {
144738
144799
  return tool({
144739
144800
  name: "get_issue_comments",
144740
- description: "Get all comments for a GitHub issue. Returns all comments including the issue body and all subsequent discussion comments.",
144801
+ description: "Get all comments for a GitHub issue. Returns all comments including the issue body and all subsequent discussion comments. Example: `get_issue_comments({ issue_number: 1234 })`.",
144741
144802
  parameters: GetIssueComments,
144742
144803
  execute: execute(async ({ issue_number }) => {
144743
144804
  ctx.toolState.issueNumber = issue_number;
@@ -144838,7 +144899,7 @@ var IssueInfo = type({
144838
144899
  function IssueInfoTool(ctx) {
144839
144900
  return tool({
144840
144901
  name: "get_issue",
144841
- description: "Retrieve GitHub issue information by issue number",
144902
+ description: "Retrieve GitHub issue information by issue number. Example: `get_issue({ issue_number: 1234 })`.",
144842
144903
  parameters: IssueInfo,
144843
144904
  execute: execute(async ({ issue_number }) => {
144844
144905
  const issue3 = await ctx.octokit.rest.issues.get({
@@ -145080,7 +145141,7 @@ var PullRequestInfo = type({
145080
145141
  function PullRequestInfoTool(ctx) {
145081
145142
  return tool({
145082
145143
  name: "get_pull_request",
145083
- description: "Retrieve PR metadata (title, body, state, branches, author, labels, linked issues). To checkout a PR branch locally, use checkout_pr instead.",
145144
+ description: "Retrieve PR metadata (title, body, state, branches, author, labels, linked issues). Example: `get_pull_request({ pull_number: 1234 })`. To checkout a PR branch locally, use checkout_pr instead.",
145084
145145
  parameters: PullRequestInfo,
145085
145146
  execute: execute(async ({ pull_number }) => {
145086
145147
  const [restResponse, graphqlResponse] = await Promise.all([
@@ -145484,7 +145545,7 @@ async function getReviewData(input) {
145484
145545
  function GetReviewCommentsTool(ctx) {
145485
145546
  return tool({
145486
145547
  name: "get_review_comments",
145487
- description: "Get review comments for a pull request review with full thread context. Automatically filters to approved comments when applicable. Returns a TOC and commentsPath pointing to a markdown file with full comment details.",
145548
+ description: "Get review comments for a pull request review with full thread context. Example: `get_review_comments({ pull_number: 1234, review_id: 567890 })`. Automatically filters to approved comments when applicable. Returns a TOC and commentsPath pointing to a markdown file with full comment details.",
145488
145549
  parameters: GetReviewComments,
145489
145550
  execute: execute(async (params) => {
145490
145551
  const approvedBy = ctx.payload.event.trigger === "fix_review" && ctx.payload.event.approved_only ? ctx.payload.triggerer : void 0;
@@ -145534,7 +145595,7 @@ var ListPullRequestReviews = type({
145534
145595
  function ListPullRequestReviewsTool(ctx) {
145535
145596
  return tool({
145536
145597
  name: "list_pull_request_reviews",
145537
- description: "List all reviews for a pull request. Returns all reviews including approvals, request changes, and comments.",
145598
+ description: "List all reviews for a pull request. Returns all reviews including approvals, request changes, and comments. Example: `list_pull_request_reviews({ pull_number: 1234 })`.",
145538
145599
  parameters: ListPullRequestReviews,
145539
145600
  execute: execute(async (params) => {
145540
145601
  const reviews = await ctx.octokit.paginate(ctx.octokit.rest.pulls.listReviews, {
@@ -145684,7 +145745,7 @@ function SelectModeTool(ctx) {
145684
145745
  const overrides = buildModeOverrides(t);
145685
145746
  return tool({
145686
145747
  name: "select_mode",
145687
- description: "Select a mode and receive step-by-step guidance on how to handle the task. Call this to understand the best workflow for the current mode.",
145748
+ description: 'Select a mode and receive step-by-step guidance on how to handle the task. Call this to understand the best workflow for the current mode. Example: `select_mode({ mode: "Review" })` or `select_mode({ mode: "Plan", issue_number: 1234 })`.',
145688
145749
  parameters: SelectModeParams,
145689
145750
  execute: execute(async (params) => {
145690
145751
  if (ctx.toolState.selectedMode) {
@@ -145745,7 +145806,9 @@ import { setTimeout as sleep2 } from "node:timers/promises";
145745
145806
  var ShellParams = type({
145746
145807
  command: "string",
145747
145808
  description: "string",
145748
- "timeout?": "number",
145809
+ "timeout?": type.number.describe(
145810
+ "Timeout in MILLISECONDS (not seconds). Default 30000 (30s), max 120000 (2m). e.g. timeout: 180000 for 3 minutes; timeout: 180 means 180ms and will kill the process almost immediately."
145811
+ ),
145749
145812
  "working_directory?": "string",
145750
145813
  "background?": "boolean"
145751
145814
  });
@@ -145864,6 +145927,8 @@ function ShellTool(ctx) {
145864
145927
  name: "shell",
145865
145928
  description: `Execute shell commands securely. Environment is filtered to remove API keys and secrets.
145866
145929
 
145930
+ Example: \`shell({ command: "pnpm test", description: "run the test suite" })\`.
145931
+
145867
145932
  Use this tool to:
145868
145933
  - Run shell commands (ls, cat, grep, find, etc.)
145869
145934
  - Execute build tools (npm, pnpm, cargo, make, etc.)
@@ -146381,18 +146446,24 @@ For simple, well-defined tasks, skip the plan phase and go straight to build.`
146381
146446
  - resolve addressed threads via \`${t("resolve_review_thread")}\`
146382
146447
  - call \`${t("report_progress")}\` with a brief summary (or the exact push error if push failed)`
146383
146448
  },
146384
- // Review and IncrementalReview use the multi-lens orchestrator pattern
146385
- // (canonical source: .claude/commands/anneal.md). The orchestrator does
146386
- // triage parallel read-only subagent fan-out aggregate → draft comments
146387
- // submit. For someone else's PR, parallel lenses (correctness, security,
146388
- // research-validated claims, user-journey, etc.) provide breadth across
146389
- // angles that a single subagent can't carry coherently. Build mode keeps
146390
- // a single fresh-eyes subagent (different problem shape — orchestrator
146391
- // wrote the code and bias-mitigation comes from delegating to one
146392
- // subagent that doesn't share the implementation context).
146393
- // Deliberate omission vs canonical /anneal: severity categorization in the
146394
- // final message (the review body has its own CAUTION/IMPORTANT framing
146395
- // instead of a severity table).
146449
+ // Review and IncrementalReview use a 0-or-2+ lens pattern. The default is
146450
+ // 0 lenses (orchestrator handles the review solo). Multi-lens (2+
146451
+ // reviewfrog subagents in parallel) only fires for substantive PRs or
146452
+ // high-stakes-subsystem touches and when it fires, ALL lenses must
146453
+ // dispatch in a single assistant turn or the parallelism win disappears.
146454
+ // We never dispatch exactly one lens: a single lens is just a worse,
146455
+ // slower version of doing the work yourself.
146456
+ //
146457
+ // Build mode self-review is a different problem shape: the orchestrator
146458
+ // wrote the code, so bias-mitigation comes from delegating to one
146459
+ // fresh-eyes subagent that doesn't share the implementation context. A
146460
+ // single subagent there is appropriate; the 0-or-2+ rule applies only to
146461
+ // the Review/IncrementalReview lens fan-out where independence between
146462
+ // perspectives is what's being purchased.
146463
+ //
146464
+ // Deliberate omission vs canonical /anneal: severity categorization in
146465
+ // the final message (the review body has its own CAUTION/IMPORTANT
146466
+ // framing instead of a severity table).
146396
146467
  {
146397
146468
  name: "Review",
146398
146469
  description: "Review code, PRs, or implementations; provide feedback or suggestions; identify issues; or check code quality, style, and correctness",
@@ -146402,9 +146473,9 @@ For simple, well-defined tasks, skip the plan phase and go straight to build.`
146402
146473
 
146403
146474
  2. **checkout**: call \`${t("checkout_pr")}\` \u2014 this returns PR metadata and a \`diffPath\`. read the diff TOC end-to-end and treat its file line ranges as your coverage checklist.
146404
146475
 
146405
- 3. **triage**: orient yourself on the PR \u2014 identify *what kind of thing this is* (domain it touches, seams it crosses, external contracts it depends on, user-facing surfaces it changes). orientation only \u2014 defer specific defect-hunting to the subagents; pre-reviewing biases the lenses you pick. use \`${t("get_pull_request")}\` and other read-only GitHub tools for additional context if needed.
146476
+ 3. **triage**: orient yourself on the PR \u2014 identify *what kind of thing this is* (domain it touches, seams it crosses, external contracts it depends on, user-facing surfaces it changes). pull as much context as you need to render a confident, well-grounded review: read related files, grep for callers of changed symbols, check tests that exercise the touched paths, fetch related GitHub state. **you are the synthesizer** \u2014 never delegate understanding to subagents.
146406
146477
 
146407
- if the PR is **genuinely trivial**, skip steps 4\u20135 entirely and submit a \`No new issues found.\` review per step 6. there's no value in dispatching even one lens for a typo.
146478
+ if the PR is **genuinely trivial**, skip the fan-out entirely and submit a \`No new issues found.\` review per step 7.
146408
146479
 
146409
146480
  "Genuinely trivial" (skip):
146410
146481
  - single-word doc typo, whitespace/format-only, comment-only across any number of files
@@ -146423,25 +146494,25 @@ For simple, well-defined tasks, skip the plan phase and go straight to build.`
146423
146494
  - any "typo fix" in user-facing copy that changes meaning ("approved" \u2192 "denied")
146424
146495
  - mixed diffs where a semantic 1-liner is buried in whitespace/formatting changes
146425
146496
 
146426
- When unsure, treat as non-trivial. The cost of one extra subagent is cents; the cost of a missed billing/auth/data bug is much more.
146497
+ 4. **lens decision \u2014 0 or 2+, NEVER 1**.
146427
146498
 
146428
- otherwise pick lenses by where the PR concentrates risk \u2014 **there's no fixed count**. lens count is judgment, not a formula. concrete shapes to anchor against:
146499
+ The default is **0 lenses**: handle the review yourself end-to-end. Most PRs land here.
146429
146500
 
146430
- - **1 lens** \u2014 pure refactor / mechanical rename across many files (impact); new test file with no source change (test-integrity); small isolated bug fix (correctness); doc-only PR with non-trivial technical content (research-validated or holistic)
146431
- - **2\u20133 lenses (most PRs land here)** \u2014 new CRUD endpoint (correctness + security + test-integrity); new UI flow (user-journey + correctness); a single bug fix in a non-critical subsystem (correctness + test-integrity); design doc covering one domain (research-validated + correctness or holistic)
146432
- - **4\u20135 lenses (high-stakes subsystem touches)** \u2014 any billing/payments change (billing-subsystem + correctness + security + operational-readiness); new auth flow (auth-subsystem + correctness + security + test-integrity); schema migration (schema-migration-subsystem + correctness + operational-readiness + impact); cross-subsystem PR that touches billing AND auth AND schema (one subsystem lens per domain + correctness)
146433
- - **6+ lenses** \u2014 almost always a smell; you're either covering overlapping ground or this PR should have been split. push back via the review body rather than expanding lens count.
146501
+ Dispatch **2+ \`${REVIEWER_AGENT_NAME}\` lenses in parallel** ONLY when ALL of the following are true:
146502
+ - the PR is substantive (>5 files changed AND >200 net lines), OR touches a high-stakes subsystem (auth, billing, payments, schema migration, webhooks, secrets, RBAC, multi-tenant isolation, cron/scheduling)
146503
+ - you can name 2+ distinct concrete failure modes that warrant independent lenses (one lens per failure mode; orthogonal, not overlapping)
146504
+ - parallel-orchestrated independent perspectives meaningfully outperform what you'd find solo
146434
146505
 
146435
- **lens-add discipline.** Each lens needs to clear a specific bar before you dispatch it: name the concrete failure mode this lens would catch *that the diff plausibly introduces*, in one sentence. "Could apply", "good to have", "for completeness" do not qualify. If you can't name what the lens is going to find, drop it. The "when unsure, treat as non-trivial" rule above is for the trivial-vs-non-trivial gate at step 3 \u2014 it does not license expanding lens count without articulated risk. Every extra lens adds wall-time, log noise, and pulls subagent attention onto speculative angles, which biases the final review toward bloat-shaped findings.
146506
+ **NEVER dispatch exactly one lens.** A single lens is just a more expensive version of doing the work yourself with a worse model \u2014 it adds wall time and a context-handoff for no orthogonality benefit. Either you have at least two genuinely independent failure-mode hypotheses (dispatch all in one turn), or you don't (do the review yourself).
146436
146507
 
146437
- lenses come in two flavors, and you can mix them:
146508
+ When you do go multi-lens, lens framings come in two flavors:
146438
146509
  - **themed lenses** \u2014 a perspective applied across the whole diff (correctness, security, user-journey, performance, etc.).
146439
- - **subsystem lenses** \u2014 a domain-scoped frame for high-stakes subsystems the PR touches (e.g. "the auth lens", "the billing lens", "the schema-migration lens"). a subsystem lens is "review the PR specifically for what could go wrong in this subsystem" and naturally combines theme + scope. **for high-stakes domains, lead with the subsystem lens rather than the generic themed equivalent** \u2014 "billing-subsystem" outperforms "correctness on billing code" because the framing primes the subagent to remember domain-specific failure modes (double-charges, refund races, currency rounding, dispute flows) the generic lens misses.
146510
+ - **subsystem lenses** \u2014 a domain-scoped frame for high-stakes subsystems the PR touches (e.g. "the auth lens", "the billing lens", "the schema-migration lens"). **for high-stakes domains, lead with the subsystem lens rather than the generic themed equivalent** \u2014 "billing-subsystem" outperforms "correctness on billing code" because the framing primes the subagent to remember domain-specific failure modes (double-charges, refund races, currency rounding, dispute flows) the generic lens misses.
146440
146511
 
146441
146512
  starter menu (combine, omit, or invent your own):
146442
146513
  - **correctness & invariants** \u2014 bugs, races, error handling, edge cases, state-machine boundaries
146443
- - **impact** \u2014 when the PR removes features, deletes exports, renames identifiers, or changes architectural patterns: stale references in code, tests, docs (\`docs/\`, \`wiki/\`), comments, configs, UI
146444
- - **research-validated assumptions** \u2014 third-party API contracts, SDK semantics, framework directives, version-gated behavior. **only pick when the PR's correctness depends on the contract behaving a specific way** \u2014 not when the API is merely used. An idempotency key as a backstop, a timeout as a hint, a retry as belt-and-suspenders: not load-bearing, skip this lens. The bar is "if the third-party contract differs from what the diff assumes, the PR is incorrect." When dispatched, the subagent must verify load-bearing claims via web search and quote source URLs.
146514
+ - **impact** \u2014 stale references in code/tests/docs/configs/UI after rename/remove
146515
+ - **research-validated assumptions** \u2014 third-party API contracts, SDK semantics, framework directives, version-gated behavior. **only pick when the PR's correctness depends on the contract behaving a specific way** \u2014 not when the API is merely used. The bar is "if the third-party contract differs from what the diff assumes, the PR is incorrect." When dispatched, the subagent must verify load-bearing claims via web search and quote source URLs.
146445
146516
  - **security** \u2014 new endpoints, authZ, input validation, secrets handling, replay/CSRF/injection, cross-tenant isolation
146446
146517
  - **user-journey** \u2014 UX-touching flows: walk through happy path and failure modes as a user
146447
146518
  - **operational readiness** \u2014 observability, alerting, migrations (forward + rollback), feature flags, on-call burden
@@ -146451,26 +146522,36 @@ For simple, well-defined tasks, skip the plan phase and go straight to build.`
146451
146522
  - **holistic** \u2014 does the PR make sense as a whole? symmetric flows (delete for every create, rollback for every migration)?
146452
146523
  - **subsystem lenses** (invent as the PR demands) \u2014 auth, billing, payments, schema migration, webhooks, secrets, RBAC, multi-tenant isolation, cron/scheduling, etc.
146453
146524
 
146454
- 4. **fan out**: dispatch one \`${REVIEWER_AGENT_NAME}\` subagent per lens \u2014 its baked-in system prompt enforces the non-mutative + non-recursive contract (read-only file/search/web tools and read-only MCP queries; no writes, shell side effects, state-changing MCP calls, or nested subagent dispatch). when picking 2+ lenses, dispatch them in a **single assistant turn with multiple parallel subagent calls**; issuing one and awaiting reply before the next collapses the fan-out into a serial review. if a subagent errors out, times out, or returns nothing usable, retry once with the same lens; if it still fails, proceed with partial coverage and note the missing lens in the review body \u2014 do not skip step 4 entirely on a single subagent failure. each subagent gets:
146525
+ The only subagent type is \`${REVIEWER_AGENT_NAME}\` \u2014 used for lens judgment work ("is this safe / correct / well-tested?"), runs on a mid-tier model.
146526
+
146527
+ 5. **fan out (only if step 4 said 2+ lenses)**: dispatch every \`${REVIEWER_AGENT_NAME}\` subagent for this run **IN A SINGLE ASSISTANT TURN, AS MULTIPLE PARALLEL TASK TOOL_USE BLOCKS IN ONE MESSAGE.**
146528
+
146529
+ \u26A0\uFE0F CRITICAL \u2014 PARALLELISM IS THE ONLY REASON LENSES EXIST. \u26A0\uFE0F
146530
+ The default tool-call behavior of Claude Code (and most agent runtimes) is **serial dispatch**: emit one Task call, await result, emit next, await, etc. This collapses your fan-out into a sequential review where each lens adds N \xD7 (orchestrator-think-time + lens-execution-time) to wall time. **YOU MUST OVERRIDE THIS DEFAULT.** Emit ALL of your Task tool_use blocks in the SAME assistant message, BEFORE you read ANY result from ANY of them. If you find yourself emitting one Task call, then thinking about the result, then emitting another \u2014 STOP and re-issue them all together. The whole point of going multi-lens is the wall-clock speedup from parallel execution; serial dispatch defeats it entirely.
146531
+
146532
+ \u2705 Right pattern: one assistant turn with N Task tool_use blocks \u2192 wait \u2192 N results arrive together \u2192 aggregate.
146533
+ \u274C Wrong pattern: turn 1 = Task(lens A) \u2192 turn 2 (after A's result) = Task(lens B) \u2192 turn 3 (after B's result) = Task(lens C). This is the failure mode. Do not do this.
146534
+
146535
+ You can also include your own \`read\` / \`grep\` / \`webfetch\` calls in the SAME turn as the parallel \`${REVIEWER_AGENT_NAME}\` dispatches \u2014 concurrent context-pulling on the orchestrator side runs in parallel with the lens fan-out and costs zero extra wall time.
146536
+
146537
+ if a subagent errors out, times out, or returns nothing usable, retry once with the same lens; if it still fails, proceed with partial coverage and note the missing lens in the review body \u2014 do not skip the fan-out entirely on a single subagent failure. each subagent gets:
146455
146538
  - the diff path / target \u2014 reading the diff and the codebase is its job
146456
146539
  - **only one lens** \u2014 never a multi-section "review for X, Y, and Z" prompt
146457
146540
  - **a Task \`description\` set to the lens name** (e.g. \`"security"\`, \`"correctness"\`, \`"billing-subsystem"\`) \u2014 the harness reads this field to label the subagent's log lines so parallel runs can be told apart in CI output. without it, every subagent shows up as \`subagent#N\`.
146458
- - the read-only contract restated in your dispatch instructions so the rule is present twice (the subagent's system prompt also enforces it). The test: would this call still be a no-op if reverted? If not (PR comments, branch pushes, issue updates, set_output, label changes, dependency installs, etc.), don't make it.
146459
146541
  - if the lens touches external contracts, instruct the subagent to verify load-bearing claims via web search rather than trust training data, and to quote source URLs in its reasoning. action runs are non-interactive \u2014 there's no human in the loop to catch "I'm pretty sure Stripe does X."
146460
146542
  - ask the subagent to report findings with file paths and NEW line numbers from the diff so you can anchor inline comments without re-reading the entire diff.
146461
146543
 
146462
146544
  delegation discipline:
146463
- - do NOT lens-review the diff yourself in parallel with the subagents (your job is dispatch + comment-drafting; doing the lens work yourself reintroduces the bias the fan-out avoids)
146464
146545
  - do NOT summarize the PR for them (biases toward a validation frame)
146465
146546
  - do NOT hand them a curated reading list (let them discover scope)
146466
146547
  - do NOT pre-shape their output with a finding schema
146467
146548
  - do NOT mention the other lenses (independence is the point \u2014 overlapping findings are a strong signal)
146468
146549
 
146469
- 5. **aggregate & draft**: merge findings; de-dup overlaps (two lenses catching the same issue = higher-confidence signal); trace each finding yourself before accepting it. drop praise, style preferences, speculative/unverified claims, findings about pre-existing code unrelated to the PR (heuristic: if the finding's root cause lives in lines this PR added or modified, it's in scope; otherwise drop unless the PR plausibly introduced or amplified the regression), and anything not actionable. also drop **bloat-shaped findings** \u2014 proposed fixes that would add defensive checks for cases that can't happen, abstractions used once, comments restating obvious code, tests asserting tautologies, or "just-in-case" guards. subagents are fallible and bias toward recommending changes; the bar for an actionable inline comment is sound + correct + elegant. recommending a change that improves only one of the three (or worse, degrades elegance to nominally improve correctness) makes the codebase worse, not better.
146550
+ 6. **aggregate & draft**: when the fan-out lands, merge findings; de-dup overlaps (two lenses catching the same issue = higher-confidence signal); trace each finding yourself before accepting it. drop praise, style preferences, speculative/unverified claims, findings about pre-existing code unrelated to the PR (heuristic: if the finding's root cause lives in lines this PR added or modified, it's in scope; otherwise drop unless the PR plausibly introduced or amplified the regression), and anything not actionable. also drop **bloat-shaped findings** \u2014 proposed fixes that would add defensive checks for cases that can't happen, abstractions used once, comments restating obvious code, tests asserting tautologies, or "just-in-case" guards. subagents are fallible and bias toward recommending changes; the bar for an actionable inline comment is sound + correct + elegant. recommending a change that improves only one of the three (or worse, degrades elegance to nominally improve correctness) makes the codebase worse, not better.
146470
146551
 
146471
146552
  for surviving findings, draft inline comments with NEW line numbers from the diff. every comment must be actionable, 2-3 sentences max. use GitHub permalink format for code references. for impact-analysis findings (stale references after rename/remove), report them in the review body ordered by severity (runtime breakage > incorrect docs > stale comments) rather than as inline comments unless they're anchored to a specific line.
146472
146553
 
146473
- 6. **submit**: ALWAYS submit exactly one review via \`${t("create_pull_request_review")}\`. Do NOT call \`report_progress\` \u2014 the review is the final record and the progress comment will be cleaned up automatically.
146554
+ 7. **submit**: ALWAYS submit exactly one review via \`${t("create_pull_request_review")}\`. Do NOT call \`report_progress\` \u2014 the review is the final record and the progress comment will be cleaned up automatically.
146474
146555
 
146475
146556
  note: the first create_pull_request_review submission may error with a one-time diff-coverage nudge listing unread TOC regions. retry the same call to proceed \u2014 optionally after reading the listed ranges. the pre-flight will not block again this session.
146476
146557
 
@@ -146498,10 +146579,10 @@ For simple, well-defined tasks, skip the plan phase and go straight to build.`
146498
146579
 
146499
146580
  ${PR_SUMMARY_FORMAT}`
146500
146581
  },
146501
- // IncrementalReview shares Review's multi-lens orchestrator pattern but
146502
- // scopes the target to the incremental diff. The "issues must be NEW
146503
- // since the last Pullfrog review" filter lives at aggregation time
146504
- // (step 6), NOT in the subagent prompt — pushing the filter into
146582
+ // IncrementalReview shares Review's 0-or-2+ lens pattern but scopes the
146583
+ // target to the incremental diff. The "issues must be NEW since the last
146584
+ // Pullfrog review" filter lives at aggregation time (step 8), NOT in the
146585
+ // subagent prompt — pushing the filter into
146505
146586
  // subagents matches the canonical anneal anti-pattern of "list known
146506
146587
  // pre-existing failures — don't flag these" and suppresses signal on
146507
146588
  // regressions the new commits amplified. The review body is just
@@ -146520,38 +146601,57 @@ ${PR_SUMMARY_FORMAT}`
146520
146601
 
146521
146602
  3. **incremental scope**: if \`incrementalDiffPath\` is present, read it to see what changed since the last review. this is a range-diff that isolates the net changes, filtering out base branch noise. if not present, fall back to reviewing the full PR diff and determine what changed since Pullfrog's most recent review.
146522
146603
 
146523
- 4. **prior feedback**: fetch previous reviews via \`${t("list_pull_request_reviews")}\`. for the most recent Pullfrog review, call \`${t("get_review_comments")}\` with the review ID to retrieve specific prior line-level feedback. you'll use this to filter your aggregation in step 6 \u2014 anything already flagged in a prior review and not changed by the new commits should not be re-raised. you do NOT need to render this in the review body; the rolling PR summary snapshot is the durable record of what's been addressed.
146604
+ 4. **prior feedback**: fetch previous reviews via \`${t("list_pull_request_reviews")}\`. for the most recent Pullfrog review, call \`${t("get_review_comments")}\` with the review ID to retrieve specific prior line-level feedback. you'll use this to filter your aggregation in step 8 \u2014 anything already flagged in a prior review and not changed by the new commits should not be re-raised. you do NOT need to render this in the review body; the rolling PR summary snapshot is the durable record of what's been addressed.
146524
146605
 
146525
- 5. **triage & fan out**: orient on the *incremental* changes \u2014 domain, seams, external contracts, user-facing surfaces.
146606
+ 5. **triage**: orient on the *incremental* changes \u2014 domain, seams, external contracts, user-facing surfaces. pull as much context as you need to render a confident review: read related files, grep for callers of changed symbols, check tests that exercise the touched paths. **you are the synthesizer.**
146526
146607
 
146527
- if the incremental changes are **genuinely trivial**, skip the fan-out entirely and jump to step 8's non-substantive path (do NOT submit a review).
146608
+ if the incremental changes are **genuinely trivial**, skip the fan-out entirely and jump to step 10's non-substantive path (do NOT submit a review).
146528
146609
 
146529
146610
  "Genuinely trivial" (skip): formatting/comment tweaks, import reordering, lockfile regen, mechanical rename of import paths, whitespace-only.
146530
146611
  "Looks trivial but isn't" (do NOT skip \u2014 same anti-patterns as Review mode): 1-line changes to SQL/regex/auth/billing/permissions/signature-verification code; flipping feature-flag defaults or retry/timeout constants; money/tax/HTTP-method/redirect changes; tightening or loosening a comparison operator; mixed diffs with a semantic line buried in formatting.
146531
146612
  When unsure, treat as non-trivial.
146532
146613
 
146533
- otherwise pick lenses by where the new commits concentrate risk \u2014 **there's no fixed count**, same calibration as Review mode (1 lens for pure refactor / isolated fix; 2\u20133 for typical features; 4\u20135 for high-stakes subsystem touches; 6+ is a smell). same **lens-add discipline** as Review mode applies: each lens needs to name the concrete failure mode it would catch *that the new commits plausibly introduce* \u2014 "could apply" doesn't qualify, drop it. **research-validated assumptions** specifically: only pick when the new commits' correctness depends on a third-party contract behaving a specific way; merely using an API doesn't qualify. lens framing follows Review mode: themed lenses (correctness & invariants, impact when new commits remove/rename/deprecate things, research-validated assumptions, security, user-journey, operational readiness, integration & cross-cutting, test integrity, performance, holistic) and subsystem lenses (auth, billing, schema migration, etc.) \u2014 for high-stakes domains lead with the subsystem lens rather than the generic themed equivalent.
146614
+ 6. **lens decision \u2014 0 or 2+, NEVER 1**.
146615
+
146616
+ The default is **0 lenses**: handle the re-review yourself end-to-end. Most incremental reviews land here \u2014 especially thread-reply re-reviews where the user is asking "did you address X?" rather than "review the diff again."
146617
+
146618
+ Dispatch **2+ \`${REVIEWER_AGENT_NAME}\` lenses in parallel** ONLY when ALL of the following are true:
146619
+ - the incremental changes are substantive (>5 files changed AND >200 net new lines), OR touch a high-stakes subsystem (auth, billing, payments, schema migration, webhooks, secrets, RBAC, multi-tenant isolation, cron/scheduling)
146620
+ - you can name 2+ distinct concrete failure modes the new commits plausibly introduce that warrant independent lenses
146621
+ - parallel-orchestrated independent perspectives meaningfully outperform what you'd find solo
146622
+
146623
+ **NEVER dispatch exactly one lens.** Single-lens dispatch adds wall time and cost for no orthogonality benefit. Either go multi-lens (\u22652 in parallel) or do the re-review yourself.
146624
+
146625
+ Lens framing follows Review mode: themed lenses (correctness, security, etc.) and subsystem lenses (auth, billing, schema-migration, etc.) \u2014 for high-stakes domains lead with the subsystem lens.
146626
+
146627
+ 7. **fan out (only if step 6 said 2+ lenses)**: dispatch every \`${REVIEWER_AGENT_NAME}\` subagent for this run **IN A SINGLE ASSISTANT TURN, AS MULTIPLE PARALLEL TASK TOOL_USE BLOCKS IN ONE MESSAGE.**
146628
+
146629
+ \u26A0\uFE0F CRITICAL \u2014 PARALLELISM IS THE ONLY REASON LENSES EXIST. \u26A0\uFE0F
146630
+ Default tool-call behavior is **serial dispatch**: emit one Task call, await result, emit next, await, etc. This collapses your fan-out into a sequential review where each lens adds N \xD7 (orchestrator-think-time + lens-execution-time) to wall time. **YOU MUST OVERRIDE THIS DEFAULT.** Emit ALL of your Task tool_use blocks in the SAME assistant message, BEFORE you read ANY result from ANY of them.
146534
146631
 
146535
- dispatch one \`${REVIEWER_AGENT_NAME}\` subagent per lens \u2014 its baked-in system prompt enforces the non-mutative + non-recursive contract (read-only file/search/web tools and read-only MCP queries; no writes, shell side effects, state-changing MCP calls, or nested subagent dispatch). dispatch them in a **single assistant turn with multiple parallel subagent calls** (serial dispatch collapses the fan-out). if a subagent errors out, times out, or returns nothing usable, retry once with the same lens; if it still fails, proceed with partial coverage and note the missing lens in the review body \u2014 do not skip step 5 entirely on a single subagent failure. each subagent gets:
146536
- - the diff scope (incremental diff path if available, full diff otherwise). do NOT tell them to skip pre-existing issues \u2014 that suppresses regressions the new commits amplified; the "issues must be NEW" filter lives at aggregation time (step 6), not in the subagent prompt
146632
+ \u2705 Right pattern: one assistant turn with N Task tool_use blocks \u2192 wait \u2192 N results arrive together \u2192 aggregate.
146633
+ \u274C Wrong pattern: turn 1 = Task(lens A) \u2192 turn 2 (after A's result) = Task(lens B). This is the failure mode.
146634
+
146635
+ You can also include your own \`read\` / \`grep\` / \`webfetch\` calls in the SAME turn as the parallel \`${REVIEWER_AGENT_NAME}\` dispatches.
146636
+
146637
+ if a subagent errors out, times out, or returns nothing usable, retry once with the same lens; if it still fails, proceed with partial coverage and note the missing lens in the review body. each subagent gets:
146638
+ - the diff scope (incremental diff path if available, full diff otherwise). do NOT tell them to skip pre-existing issues \u2014 that suppresses regressions the new commits amplified; the "issues must be NEW" filter lives at aggregation time (step 8), not in the subagent prompt
146537
146639
  - **only one lens** \u2014 never a multi-section "review for X, Y, and Z" prompt
146538
- - **a Task \`description\` set to the lens name** (e.g. \`"security"\`, \`"correctness"\`, \`"billing-subsystem"\`) \u2014 the harness reads this field to label the subagent's log lines so parallel runs can be told apart in CI output. without it, every subagent shows up as \`subagent#N\`.
146539
- - the read-only contract restated in your dispatch instructions so the rule is present twice (the subagent's system prompt also enforces it). The test: would this call still be a no-op if reverted? If not (PR comments, branch pushes, issue updates, set_output, label changes, dependency installs, etc.), don't make it.
146540
- - if the lens touches external contracts, instruct the subagent to verify load-bearing claims via web search and quote source URLs. action runs are non-interactive \u2014 there's no human to catch "I'm pretty sure Stripe does X."
146640
+ - **a Task \`description\` set to the lens name** \u2014 the harness reads this field to label log lines so parallel runs can be told apart.
146641
+ - if the lens touches external contracts, instruct the subagent to verify load-bearing claims via web search and quote source URLs.
146541
146642
  - ask the subagent to report findings with file paths and NEW line numbers from the full PR diff so you can anchor inline comments.
146542
146643
 
146543
146644
  delegation discipline:
146544
- - do NOT lens-review the diff yourself in parallel with the subagents
146545
146645
  - do NOT summarize the changes for them (biases toward validation frame)
146546
146646
  - do NOT hand them a curated reading list (let them discover scope)
146547
146647
  - do NOT pre-shape their output with a finding schema
146548
146648
  - do NOT mention the other lenses (independence is the point)
146549
146649
 
146550
- 6. **aggregate, draft, self-critique**: merge findings; de-dup overlaps; trace each finding yourself. drop praise, style preferences, speculative/unverified claims, findings about pre-existing code unrelated to the new commits, anything not actionable, and anything that re-states prior review feedback (heuristic: if the finding's root cause lives in lines the *new commits* added or modified, it's in scope; otherwise drop). also drop **bloat-shaped findings** \u2014 proposed fixes that would add defensive checks for cases that can't happen, abstractions used once, comments restating obvious code, tests asserting tautologies, or "just-in-case" guards. subagents are fallible and bias toward recommending changes; the bar for an actionable inline comment is sound + correct + elegant. recommending a change that improves only one of the three (or degrades elegance to nominally improve correctness) makes the codebase worse, not better. To compute "lines the new commits added or modified": if \`incrementalDiffPath\` from step 2 is present, use it directly. Otherwise, take the prior Pullfrog review's \`commit_id\` (returned alongside each entry from \`${t("list_pull_request_reviews")}\` in step 4) and run \`git diff <prior-review-sha>..HEAD\` to isolate the lines added since that review. draft inline comments with NEW line numbers from the full PR diff \u2014 every comment must be actionable, 2-3 sentences max.
146650
+ 8. **aggregate, draft, self-critique**: merge findings (yours + any subagent output if you went multi-lens); de-dup overlaps; trace each finding yourself. drop praise, style preferences, speculative/unverified claims, findings about pre-existing code unrelated to the new commits, anything not actionable, and anything that re-states prior review feedback (heuristic: if the finding's root cause lives in lines the *new commits* added or modified, it's in scope; otherwise drop). also drop **bloat-shaped findings** \u2014 proposed fixes that would add defensive checks for cases that can't happen, abstractions used once, comments restating obvious code, tests asserting tautologies, or "just-in-case" guards. subagents are fallible and bias toward recommending changes; the bar for an actionable inline comment is sound + correct + elegant. recommending a change that improves only one of the three (or degrades elegance to nominally improve correctness) makes the codebase worse, not better. To compute "lines the new commits added or modified": if \`incrementalDiffPath\` from step 2 is present, use it directly. Otherwise, take the prior Pullfrog review's \`commit_id\` (returned alongside each entry from \`${t("list_pull_request_reviews")}\` in step 4) and run \`git diff <prior-review-sha>..HEAD\` to isolate the lines added since that review. draft inline comments with NEW line numbers from the full PR diff \u2014 every comment must be actionable, 2-3 sentences max.
146551
146651
 
146552
- 7. **build the review body** \u2014 a single "Reviewed changes" section: summarize at the logical-change level, not per-file. each bullet starts with a past-tense verb (e.g. \`- Extracted shared CLI runtime into a single module\`, \`- Renamed package to pullfrog\`). avoid file paths unless they add clarity. if the changes can be described in one sentence, use one sentence \u2014 no bullets needed. do NOT include a separate "Prior review feedback" checklist; that's tracked in the rolling PR summary snapshot for the next agent run, and surfacing it in the user-facing body is noise (changes that addressed prior feedback are already covered by the Reviewed-changes bullets). in some cases you may receive a complete diff for the whole pull request instead of an incremental one \u2014 when this happens, you will need to determine what changes have happened since Pullfrog's most recent review.
146652
+ 9. **build the review body** \u2014 a single "Reviewed changes" section: summarize at the logical-change level, not per-file. each bullet starts with a past-tense verb (e.g. \`- Extracted shared CLI runtime into a single module\`, \`- Renamed package to pullfrog\`). avoid file paths unless they add clarity. if the changes can be described in one sentence, use one sentence \u2014 no bullets needed. do NOT include a separate "Prior review feedback" checklist; that's tracked in the rolling PR summary snapshot for the next agent run, and surfacing it in the user-facing body is noise (changes that addressed prior feedback are already covered by the Reviewed-changes bullets). in some cases you may receive a complete diff for the whole pull request instead of an incremental one \u2014 when this happens, you will need to determine what changes have happened since Pullfrog's most recent review.
146553
146653
 
146554
- 8. Submit \u2014 every run must end with EXACTLY ONE of \`${t("create_pull_request_review")}\` (substantive review) or \`${t("report_progress")}\` (no-review acknowledgement). do NOT call \`create_issue_comment\` for review output.
146654
+ 10. Submit \u2014 every run must end with EXACTLY ONE of \`${t("create_pull_request_review")}\` (substantive review) or \`${t("report_progress")}\` (no-review acknowledgement). do NOT call \`create_issue_comment\` for review output.
146555
146655
 
146556
146656
  Same callout-intensity ladder as Review mode \u2014 \`[!CAUTION]\` (large red, "will break") \u2192 \`[!IMPORTANT]\` (large purple, "must address before merging") \u2192 \`[!NOTE]\` (small blue, "FYI") \u2192 no callout (plain text). And the same Fix-button lever: the footer renders a Fix button on every non-approving review, so \`approved: true\` suppresses it. Wrapping mergeable feedback in \`[!IMPORTANT]\` trains users to click Fix on reviews that don't need fixing \u2014 pick the tier the author's actual next action justifies.
146557
146657
 
@@ -146931,45 +147031,12 @@ var ThinkingTimer = class {
146931
147031
  import { readFile } from "node:fs/promises";
146932
147032
  function getUnsubmittedReview(toolState) {
146933
147033
  const mode = toolState.selectedMode;
146934
- if (mode !== "Review" && mode !== "IncrementalReview") return null;
146935
- if (toolState.review || toolState.finalSummaryWritten) return null;
146936
147034
  if (!toolState.hadProgressComment) return null;
146937
- return mode;
146938
- }
146939
- var MAX_HOOK_OUTPUT_CHARS = 4096;
146940
- function truncateHookOutput(raw2) {
146941
- if (raw2.length <= MAX_HOOK_OUTPUT_CHARS) return raw2;
146942
- return `...(truncated, showing last ${MAX_HOOK_OUTPUT_CHARS} chars)
146943
- ${raw2.slice(-MAX_HOOK_OUTPUT_CHARS)}`;
146944
- }
146945
- async function executeStopHook(script) {
146946
- log.info("\xBB executing stop hook...");
146947
- try {
146948
- const result = await spawn({
146949
- cmd: "bash",
146950
- args: ["-c", script],
146951
- env: process.env,
146952
- timeout: LIFECYCLE_HOOK_TIMEOUT_MS,
146953
- activityTimeout: 0,
146954
- onStdout: (chunk) => process.stdout.write(chunk),
146955
- onStderr: (chunk) => process.stderr.write(chunk)
146956
- });
146957
- if (result.exitCode === 0) {
146958
- log.info("\xBB stop hook passed");
146959
- return null;
146960
- }
146961
- const combined = [result.stderr.trim(), result.stdout.trim()].filter(Boolean).join("\n");
146962
- const output = truncateHookOutput(combined);
146963
- log.info(`\xBB stop hook failed with exit code ${result.exitCode}`);
146964
- return { exitCode: result.exitCode, output };
146965
- } catch (err) {
146966
- const isTimeout = err instanceof SpawnTimeoutError && (err.code === SPAWN_TIMEOUT_CODE || err.code === SPAWN_ACTIVITY_TIMEOUT_CODE);
146967
- const msg = err instanceof Error ? err.message : String(err);
146968
- log.warning(
146969
- `stop hook ${isTimeout ? "timed out" : "failed to spawn"}: ${msg} \u2014 skipping retry`
146970
- );
146971
- return null;
147035
+ if (mode === "Review") return toolState.review ? null : "Review";
147036
+ if (mode === "IncrementalReview") {
147037
+ return toolState.review || toolState.finalSummaryWritten ? null : "IncrementalReview";
146972
147038
  }
147039
+ return null;
146973
147040
  }
146974
147041
  function buildStopHookPrompt(failure) {
146975
147042
  return [
@@ -147019,10 +147086,6 @@ function buildUnsubmittedReviewPrompt(mode) {
147019
147086
  }
147020
147087
  async function collectPostRunIssues(ctx, options = {}) {
147021
147088
  const issues = {};
147022
- if (ctx.stopScript) {
147023
- const failure = await executeStopHook(ctx.stopScript);
147024
- if (failure) issues.stopHook = failure;
147025
- }
147026
147089
  const status = getGitStatus();
147027
147090
  const mode = ctx.toolState.selectedMode;
147028
147091
  if (status) {
@@ -147058,11 +147121,25 @@ function buildLearningsReflectionPrompt(filePath) {
147058
147121
  "",
147059
147122
  `the rolling learnings file is at \`${filePath}\`. read it first if you haven't already, then edit it in place using your native file tools. the server reads this file at end-of-run and persists any changes \u2014 there is no tool to call.`,
147060
147123
  "",
147061
- `keep the file healthy:`,
147062
- `- only add bullets when the finding is high-confidence AND broadly useful. skip speculative, one-off, or "maybe" findings.`,
147063
- `- prune bullets that are clearly wrong, no longer relevant, or low-signal (rarely useful). a focused, accurate file beats a long stale one.`,
147064
- `- format: flat bullet list, one fact per line starting with \`- \`. deduplicate against existing entries \u2014 if a bullet covers the same fact, update it in place instead of adding a duplicate.`,
147065
- `- leave the file alone if you have nothing substantively new to add and the existing entries still look healthy. silence is a valid outcome \u2014 just reply "done" and stop.`
147124
+ `structure:`,
147125
+ `- markdown hierarchy: \`## \` for top-level themes, \`### \` and deeper for sub-themes when a section grows. there is no fixed taxonomy \u2014 choose headings that fit THIS repo (e.g. for one repo \`## Migrations\` / \`## Local dev\` may make sense; for another, \`## API quirks\` / \`## Failure modes\`).`,
147126
+ `- **no section over ~300 lines.** when a section is approaching that, split it: introduce \`### \` subsections grouping related bullets, or hoist a coherent group into a new top-level \`## \` section. granular sections mean future runs read targeted line ranges instead of slurping the whole file. this is the most important hygiene rule on long-lived repos.`,
147127
+ `- if you find a flat unstructured list (legacy content from before this format), restructure it: read it, group related bullets, rewrite the file with \`## \` / \`### \` headings around them. don't preserve bad structure \u2014 fix it.`,
147128
+ "",
147129
+ `bullet hygiene:`,
147130
+ `- one fact per line starting with \`- \`. each bullet is ONE specific durable fact, not a paragraph or essay.`,
147131
+ `- aim for \u2264 240 chars per bullet. longer bullets are almost always mixing multiple facts that should be split, or burying the durable claim under PR-specific context that should be cut.`,
147132
+ `- only add bullets when the finding is high-confidence AND broadly useful AND will still be true in 3+ months. skip speculative, one-off, or "maybe" findings.`,
147133
+ `- prune bullets that are clearly wrong, no longer relevant, or low-signal. a focused, accurate file beats a long stale one. compressing two overlapping bullets into one tighter bullet counts as progress.`,
147134
+ `- deduplicate against existing entries (in any section) \u2014 if a bullet covers the same fact, update it in place instead of adding a duplicate.`,
147135
+ "",
147136
+ `do NOT add bullets for:`,
147137
+ `- pullfrog tool quirks (e.g. "\`shell\` timeout is in milliseconds", "\`git\` args must be a JSON array", "\`create_pull_request_review\` drops out-of-hunk comments", "\`push_branch\` may report timeout when push succeeded"). these are universal across repos and belong in the tool descriptions \u2014 flag the gap rather than hoarding the workaround per-repo.`,
147138
+ `- references to specific PR numbers, review IDs, commit SHAs, branch names, or person handles ("PR #595 introduced X", "flagged in review 12345", "as of commit abc123"). repo state changes; these decay into noise within weeks.`,
147139
+ `- dated assertions ("as of May 2026", "currently...", "for now..."). if a fact needs a date to be true, it isn't durable enough to belong here.`,
147140
+ `- play-by-play of what THIS run did. learnings are for the NEXT run, not a retrospective.`,
147141
+ "",
147142
+ `if you have nothing substantively new to add AND the existing entries still look healthy and well-structured, leave the file alone \u2014 just reply "done" and stop. silence is a valid outcome.`
147066
147143
  ].join("\n");
147067
147144
  }
147068
147145
  async function runPostRunRetryLoop(params) {
@@ -147266,8 +147343,9 @@ function writeMcpConfig(ctx) {
147266
147343
  function buildAgentsJson() {
147267
147344
  const agents2 = {
147268
147345
  [REVIEWER_AGENT_NAME]: {
147269
- description: "Read-only review subagent for self-review and lens-based code review. Reads only \u2014 no writes, no state-changing shell or MCP calls, no nested subagent dispatch.",
147270
- prompt: REVIEWER_SYSTEM_PROMPT
147346
+ description: "Read-only review subagent for lens-based code review (correctness, security, billing-subsystem, etc.). Reads only \u2014 no writes, no state-changing shell or MCP calls, no nested subagent dispatch.",
147347
+ prompt: REVIEWER_SYSTEM_PROMPT,
147348
+ model: "claude-sonnet-4-6"
147271
147349
  }
147272
147350
  };
147273
147351
  return JSON.stringify(agents2);
@@ -147463,6 +147541,7 @@ async function runClaude(params) {
147463
147541
  }
147464
147542
  };
147465
147543
  const recentStderr = [];
147544
+ const recentNonJsonStdout = [];
147466
147545
  let lastProviderError = null;
147467
147546
  const output = new TailBuffer(DEFAULT_MAX_RETAINED_BYTES);
147468
147547
  let stdoutBuffer = "";
@@ -147501,6 +147580,8 @@ async function runClaude(params) {
147501
147580
  event = JSON.parse(trimmed);
147502
147581
  } catch {
147503
147582
  log.debug(`\xBB non-JSON stdout line: ${trimmed.substring(0, 200)}`);
147583
+ recentNonJsonStdout.push(trimmed);
147584
+ if (recentNonJsonStdout.length > MAX_STDERR_LINES) recentNonJsonStdout.shift();
147504
147585
  continue;
147505
147586
  }
147506
147587
  eventCount++;
@@ -147566,7 +147647,8 @@ ${stderrContext}`);
147566
147647
  const stdoutSnapshot = output.toString();
147567
147648
  const stderrSnapshot = recentStderr.join("\n");
147568
147649
  const truncatedStdout = stdoutSnapshot ? tailLines(stdoutSnapshot, 2048) : "";
147569
- const errorMessage = lastResultError || stderrSnapshot || truncatedStdout || `unknown error - no output from Claude CLI${errorContext}`;
147650
+ const nonJsonStdoutSnapshot = recentNonJsonStdout.join("\n");
147651
+ const errorMessage = lastResultError || stderrSnapshot || nonJsonStdoutSnapshot || truncatedStdout || `unknown error - no output from Claude CLI${errorContext}`;
147570
147652
  log.error(
147571
147653
  `${params.label} exited with code ${result.exitCode}${errorContext}: ${errorMessage}`
147572
147654
  );
@@ -147667,7 +147749,9 @@ var claude = agent({
147667
147749
  run: async (ctx) => {
147668
147750
  const cliPath = await installClaudeCli();
147669
147751
  const specifier = ctx.payload.proxyModel ?? ctx.resolvedModel;
147670
- const model = specifier ? stripProviderPrefix(specifier) : void 0;
147752
+ const bedrockModelId = process.env[BEDROCK_MODEL_ID_ENV]?.trim();
147753
+ const isBedrockRoute = specifier !== void 0 && bedrockModelId !== void 0 && bedrockModelId === specifier && isBedrockAnthropicId(specifier);
147754
+ const model = !specifier ? void 0 : isBedrockRoute ? specifier : stripProviderPrefix(specifier);
147671
147755
  const homeEnv = {
147672
147756
  HOME: ctx.tmpdir,
147673
147757
  XDG_CONFIG_HOME: join10(ctx.tmpdir, ".config")
@@ -147706,6 +147790,9 @@ var claude = agent({
147706
147790
  ...process.env,
147707
147791
  ...homeEnv
147708
147792
  };
147793
+ if (isBedrockRoute) {
147794
+ env2.CLAUDE_CODE_USE_BEDROCK = "1";
147795
+ }
147709
147796
  const repoDir = process.cwd();
147710
147797
  log.info(`\xBB effort: ${effort}`);
147711
147798
  log.debug(`\xBB starting Pullfrog (Claude Code): node ${baseArgs.join(" ")}`);
@@ -147827,6 +147914,22 @@ export default async function pullfrogEventsPlugin() {
147827
147914
  }
147828
147915
  `;
147829
147916
 
147917
+ // agents/subagentModels.ts
147918
+ function deriveSubagentModels(orchestratorSpec) {
147919
+ if (!orchestratorSpec) return { reviewer: void 0 };
147920
+ for (const source of modelAliases) {
147921
+ const matchedDirect = source.resolve === orchestratorSpec;
147922
+ const matchedOR = source.openRouterResolve === orchestratorSpec;
147923
+ if (!matchedDirect && !matchedOR) continue;
147924
+ if (!source.subagentModel) return { reviewer: void 0 };
147925
+ const target = modelAliases.find((a) => a.slug === source.subagentModel);
147926
+ if (!target) return { reviewer: void 0 };
147927
+ const reviewer = matchedOR ? target.openRouterResolve : target.resolve;
147928
+ return { reviewer };
147929
+ }
147930
+ return { reviewer: void 0 };
147931
+ }
147932
+
147830
147933
  // agents/opencode.ts
147831
147934
  async function installOpencodeCli() {
147832
147935
  return await installFromNpmTarball({
@@ -147836,7 +147939,6 @@ async function installOpencodeCli() {
147836
147939
  installDependencies: true
147837
147940
  });
147838
147941
  }
147839
- var PULLFROG_OPENCODE_OUTPUT_LIMIT = 5e3;
147840
147942
  var GEMINI_3_DIRECT_THINKING_LEVEL = "medium";
147841
147943
  var GEMINI_3_DIRECT_API_IDS = ["gemini-3.1-pro-preview", "gemini-3-flash-preview"];
147842
147944
  function buildSecurityConfig(ctx, model) {
@@ -147852,7 +147954,12 @@ function buildSecurityConfig(ctx, model) {
147852
147954
  mcp: {
147853
147955
  [pullfrogMcpName]: { type: "remote", url: ctx.mcpServerUrl }
147854
147956
  },
147855
- agent: buildReviewerAgentConfig(),
147957
+ agent: (() => {
147958
+ const cfg = buildReviewerAgentConfig(model);
147959
+ const reviewerModel = cfg[REVIEWER_AGENT_NAME]?.model ?? "(inherit)";
147960
+ log.info(`\xBB subagent models: reviewfrog=${reviewerModel}`);
147961
+ return cfg;
147962
+ })(),
147856
147963
  // opt into opencode's experimental `batch` tool (added in
147857
147964
  // anomalyco/opencode PR #2983, opt-in via `experimental.batch_tool`). it
147858
147965
  // exposes a single `batch` tool that runs 1-25 independent tool calls
@@ -147886,12 +147993,14 @@ function buildSecurityConfig(ctx, model) {
147886
147993
  }
147887
147994
  return JSON.stringify(config3);
147888
147995
  }
147889
- function buildReviewerAgentConfig() {
147996
+ function buildReviewerAgentConfig(orchestratorModel) {
147997
+ const overrides = deriveSubagentModels(orchestratorModel);
147890
147998
  return {
147891
147999
  [REVIEWER_AGENT_NAME]: {
147892
- description: "Read-only review subagent for self-review and lens-based code review. Reads only \u2014 no writes, no state-changing shell or MCP calls, no nested subagent dispatch.",
148000
+ description: "Read-only review subagent for lens-based code review (correctness, security, billing-subsystem, etc.). Reads only \u2014 no writes, no state-changing shell or MCP calls, no nested subagent dispatch.",
147893
148001
  mode: "subagent",
147894
- prompt: REVIEWER_SYSTEM_PROMPT
148002
+ prompt: REVIEWER_SYSTEM_PROMPT,
148003
+ ...overrides.reviewer !== void 0 ? { model: overrides.reviewer } : {}
147895
148004
  }
147896
148005
  };
147897
148006
  }
@@ -147916,7 +148025,7 @@ function autoSelectModel(cliPath) {
147916
148025
  const availableSet = new Set(availableModels);
147917
148026
  if (availableSet.size > 0) {
147918
148027
  log.debug(`\xBB opencode models (${availableSet.size}): ${availableModels.join(", ")}`);
147919
- const match3 = modelAliases.find((a) => a.preferred && availableSet.has(a.resolve)) ?? modelAliases.find((a) => availableSet.has(a.resolve));
148028
+ const match3 = modelAliases.find((a) => !a.hidden && a.preferred && availableSet.has(a.resolve)) ?? modelAliases.find((a) => !a.hidden && availableSet.has(a.resolve));
147920
148029
  if (match3) {
147921
148030
  log.info(
147922
148031
  `\xBB model: ${match3.resolve} (auto-selected${match3.preferred ? " \u2014 preferred" : ""} curated match)`
@@ -148442,7 +148551,10 @@ var opencode = agent({
148442
148551
  install: installOpencodeCli,
148443
148552
  run: async (ctx) => {
148444
148553
  const cliPath = await installOpencodeCli();
148445
- const model = ctx.payload.proxyModel ?? ctx.resolvedModel ?? autoSelectModel(cliPath);
148554
+ const rawModel = ctx.payload.proxyModel ?? ctx.resolvedModel ?? autoSelectModel(cliPath);
148555
+ const bedrockModelId = process.env[BEDROCK_MODEL_ID_ENV]?.trim();
148556
+ const isBedrockRoute = rawModel !== void 0 && bedrockModelId !== void 0 && bedrockModelId === rawModel;
148557
+ const model = isBedrockRoute ? `amazon-bedrock/${rawModel}` : rawModel;
148446
148558
  const homeEnv = {
148447
148559
  HOME: ctx.tmpdir,
148448
148560
  XDG_CONFIG_HOME: join11(ctx.tmpdir, ".config")
@@ -148471,7 +148583,6 @@ var opencode = agent({
148471
148583
  ...homeEnv,
148472
148584
  OPENCODE_CONFIG_CONTENT: buildSecurityConfig(ctx, model),
148473
148585
  OPENCODE_PERMISSION: permissionOverride,
148474
- OPENCODE_EXPERIMENTAL_OUTPUT_TOKEN_MAX: PULLFROG_OPENCODE_OUTPUT_LIMIT.toString(),
148475
148586
  GOOGLE_GENERATIVE_AI_API_KEY: process.env.GOOGLE_GENERATIVE_AI_API_KEY || process.env.GEMINI_API_KEY
148476
148587
  };
148477
148588
  const repoDir = process.cwd();
@@ -148514,13 +148625,29 @@ function hasEnvVar(name) {
148514
148625
  function hasClaudeCodeAuth() {
148515
148626
  return hasEnvVar("CLAUDE_CODE_OAUTH_TOKEN") || hasEnvVar("ANTHROPIC_API_KEY");
148516
148627
  }
148628
+ function hasBedrockAuth() {
148629
+ return hasEnvVar("AWS_BEARER_TOKEN_BEDROCK") || hasEnvVar("AWS_ACCESS_KEY_ID") && hasEnvVar("AWS_SECRET_ACCESS_KEY");
148630
+ }
148631
+ function resolveSlug(slug2) {
148632
+ const alias = resolveDisplayAlias(slug2);
148633
+ if (alias?.routing === "bedrock") {
148634
+ const bedrockId = process.env[BEDROCK_MODEL_ID_ENV]?.trim();
148635
+ if (!bedrockId) {
148636
+ throw new Error(
148637
+ `${BEDROCK_MODEL_ID_ENV} env var is required when the model is set to "${slug2}". set it to an AWS Bedrock model ID (e.g. "us.anthropic.claude-opus-4-7", "amazon.nova-pro-v1:0"). see https://docs.pullfrog.com/bedrock for setup.`
148638
+ );
148639
+ }
148640
+ return bedrockId;
148641
+ }
148642
+ return resolveCliModel(slug2);
148643
+ }
148517
148644
  function resolveModel(ctx) {
148518
148645
  const envModel = process.env.PULLFROG_MODEL?.trim();
148519
148646
  if (envModel) {
148520
- return resolveCliModel(envModel) ?? envModel;
148647
+ return resolveSlug(envModel) ?? envModel;
148521
148648
  }
148522
148649
  if (ctx.slug) {
148523
- const resolved = resolveCliModel(ctx.slug);
148650
+ const resolved = resolveSlug(ctx.slug);
148524
148651
  if (resolved) {
148525
148652
  return resolved;
148526
148653
  }
@@ -148536,6 +148663,9 @@ function resolveAgent(ctx) {
148536
148663
  }
148537
148664
  log.warning(`\xBB unknown PULLFROG_AGENT="${envAgent}" \u2014 falling through to auto-select`);
148538
148665
  }
148666
+ if (ctx.model && hasBedrockAuth() && process.env[BEDROCK_MODEL_ID_ENV]?.trim() === ctx.model) {
148667
+ return isBedrockAnthropicId(ctx.model) ? agents.claude : agents.opencode;
148668
+ }
148539
148669
  if (ctx.model) {
148540
148670
  try {
148541
148671
  const provider2 = getModelProvider(ctx.model);
@@ -148550,31 +148680,56 @@ function resolveAgent(ctx) {
148550
148680
 
148551
148681
  // utils/apiKeys.ts
148552
148682
  var knownApiKeys = new Set(Object.values(providers).flatMap((p) => [...p.envVars]));
148683
+ var MISSING_KEY_MARKER = "no API key found";
148553
148684
  function buildMissingApiKeyError(params) {
148554
- const apiUrl = getApiUrl();
148555
- const settingsUrl = `${apiUrl}/console/${params.owner}/${params.name}`;
148556
- const githubRepoUrl = `https://github.com/${params.owner}/${params.name}`;
148557
- const githubSecretsUrl = `${githubRepoUrl}/settings/secrets/actions`;
148558
- return `no API key found. Pullfrog requires at least one LLM provider API key.
148685
+ const githubSecretsUrl = `https://github.com/${params.owner}/${params.name}/settings/secrets/actions`;
148686
+ const settingsUrl = `${getApiUrl()}/console/${params.owner}/${params.name}`;
148687
+ return [
148688
+ `**${MISSING_KEY_MARKER}** \u2014 Pullfrog needs at least one LLM provider API key (e.g. \`ANTHROPIC_API_KEY\`, \`OPENAI_API_KEY\`, \`GEMINI_API_KEY\`) configured as a GitHub Actions secret.`,
148689
+ "",
148690
+ `[Open repo secrets \u2192](${githubSecretsUrl}) \xB7 [Configure model \u2192](${settingsUrl}) \xB7 [Setup docs \u2192](https://docs.pullfrog.com/keys) \xB7 [Ask in Discord \u2192](https://discord.gg/8y96raFg8e)`
148691
+ ].join("\n");
148692
+ }
148693
+ function buildBedrockSetupError(params) {
148694
+ const githubSecretsUrl = `https://github.com/${params.owner}/${params.name}/settings/secrets/actions`;
148695
+ return `Bedrock model selected but required configuration is missing: ${params.missing.join(", ")}.
148559
148696
 
148560
- to fix this, add the required secret to your GitHub repository:
148697
+ add the missing secret(s) to your GitHub repository at ${githubSecretsUrl}, then reference them in your workflow's \`env:\` block:
148561
148698
 
148562
- 1. go to: ${githubSecretsUrl}
148563
- 2. click "New repository secret"
148564
- 3. set the name to your provider's key (e.g., \`ANTHROPIC_API_KEY\`, \`OPENAI_API_KEY\`, \`GEMINI_API_KEY\`)
148565
- 4. set the value to your API key
148566
- 5. click "Add secret"
148699
+ AWS_BEARER_TOKEN_BEDROCK: \${{ secrets.AWS_BEARER_TOKEN_BEDROCK }}
148700
+ AWS_REGION: \${{ secrets.AWS_REGION }}
148701
+ ${BEDROCK_MODEL_ID_ENV}: \${{ secrets.${BEDROCK_MODEL_ID_ENV} }}
148567
148702
 
148568
- configure your model at ${settingsUrl}
148703
+ \`AWS_BEARER_TOKEN_BEDROCK\` may be substituted with \`AWS_ACCESS_KEY_ID\` + \`AWS_SECRET_ACCESS_KEY\` (and optional \`AWS_SESSION_TOKEN\`) if you prefer access keys.
148569
148704
 
148570
- for full setup instructions, see https://docs.pullfrog.com/keys`;
148705
+ for full setup instructions, see https://docs.pullfrog.com/bedrock`;
148571
148706
  }
148572
148707
  function hasEnvVar2(name) {
148573
148708
  const value2 = process.env[name];
148574
148709
  return typeof value2 === "string" && value2.length > 0;
148575
148710
  }
148711
+ function validateBedrockSetup(params) {
148712
+ const hasAuth = hasEnvVar2("AWS_BEARER_TOKEN_BEDROCK") || hasEnvVar2("AWS_ACCESS_KEY_ID") && hasEnvVar2("AWS_SECRET_ACCESS_KEY");
148713
+ const missing = [];
148714
+ if (!hasAuth)
148715
+ missing.push("AWS_BEARER_TOKEN_BEDROCK (or AWS_ACCESS_KEY_ID + AWS_SECRET_ACCESS_KEY)");
148716
+ if (!hasEnvVar2("AWS_REGION")) missing.push("AWS_REGION");
148717
+ if (!hasEnvVar2(BEDROCK_MODEL_ID_ENV)) missing.push(BEDROCK_MODEL_ID_ENV);
148718
+ if (missing.length > 0) {
148719
+ throw new Error(buildBedrockSetupError({ owner: params.owner, name: params.name, missing }));
148720
+ }
148721
+ }
148576
148722
  function validateAgentApiKey(params) {
148577
148723
  if (params.model) {
148724
+ const alias = resolveDisplayAlias(params.model);
148725
+ if (alias?.routing === "bedrock") {
148726
+ validateBedrockSetup({ owner: params.owner, name: params.name });
148727
+ return;
148728
+ }
148729
+ if (!params.model.includes("/")) {
148730
+ validateBedrockSetup({ owner: params.owner, name: params.name });
148731
+ return;
148732
+ }
148578
148733
  const requiredVars = getModelEnvVars(params.model);
148579
148734
  if (requiredVars.length === 0) return;
148580
148735
  if (requiredVars.some((v) => hasEnvVar2(v))) return;
@@ -148585,6 +148740,22 @@ function validateAgentApiKey(params) {
148585
148740
  throw new Error(buildMissingApiKeyError({ owner: params.owner, name: params.name }));
148586
148741
  }
148587
148742
  }
148743
+ function isApiKeyAuthError(text) {
148744
+ if (!text) return false;
148745
+ return text.includes(MISSING_KEY_MARKER) || /Invalid API key/i.test(text) || /\bUser not found\b/i.test(text) || /\bInvalid authentication\b/i.test(text);
148746
+ }
148747
+ function formatApiKeyErrorSummary(params) {
148748
+ if (params.raw.includes(MISSING_KEY_MARKER)) {
148749
+ return buildMissingApiKeyError({ owner: params.owner, name: params.name });
148750
+ }
148751
+ const githubSecretsUrl = `https://github.com/${params.owner}/${params.name}/settings/secrets/actions`;
148752
+ const settingsUrl = `${getApiUrl()}/console/${params.owner}/${params.name}`;
148753
+ return [
148754
+ `**Your LLM provider API key was rejected (401).** Rotate the key in your provider dashboard, then update the matching GitHub Actions secret.`,
148755
+ "",
148756
+ `[Update repo secret \u2192](${githubSecretsUrl}) \xB7 [Model settings \u2192](${settingsUrl}) \xB7 [Setup docs \u2192](https://docs.pullfrog.com/keys) \xB7 [Ask in Discord \u2192](https://discord.gg/8y96raFg8e)`
148757
+ ].join("\n");
148758
+ }
148588
148759
 
148589
148760
  // utils/body.ts
148590
148761
  var import_turndown = __toESM(require_turndown_cjs(), 1);
@@ -153109,10 +153280,31 @@ function buildPromptContext(ctx) {
153109
153280
  userQuoted: user ? user.split("\n").map((line) => `> ${line}`).join("\n") : ""
153110
153281
  };
153111
153282
  }
153112
- function assembleFullPrompt(ctx) {
153113
- const learningsSection = ctx.learningsFilePath ? `************* LEARNINGS *************
153283
+ function renderLearningsToc(headings) {
153284
+ if (headings.length === 0) return "";
153285
+ const rootDepth = Math.min(...headings.map((h) => h.depth));
153286
+ return headings.map((h) => {
153287
+ const indent2 = " ".repeat((h.depth - rootDepth) * 2);
153288
+ return `${indent2}- ${h.title} (L${h.startLine}-L${h.endLine})`;
153289
+ }).join("\n");
153290
+ }
153291
+ function buildLearningsSection(ctx) {
153292
+ if (!ctx.filePath) return "";
153293
+ const intro = `Repo-level learnings accumulated by previous agent runs live at \`${ctx.filePath}\`. Use this file as durable context (test commands, conventions, gotchas, architecture notes).`;
153294
+ const tocBody = ctx.headings.length === 0 ? "(no headings yet \u2014 file is empty or a flat list. read the whole file. during the post-run reflection turn, structure it with `## ` / `### ` headings so future runs can read targeted ranges.)" : `Read targeted line ranges via your native file tool \u2014 do NOT slurp the whole file. Each range starts at the section heading line, so reading the range gives you heading + body together.
153295
+
153296
+ ${renderLearningsToc(ctx.headings)}`;
153297
+ return `************* LEARNINGS *************
153298
+
153299
+ ${intro}
153114
153300
 
153115
- Repo-level learnings accumulated by previous agent runs live at \`${ctx.learningsFilePath}\`. Read this file early and let the entries inform your approach (test commands, conventions, gotchas, etc.). The file may be empty if no learnings have been collected yet.` : "";
153301
+ ${tocBody}`;
153302
+ }
153303
+ function assembleFullPrompt(ctx) {
153304
+ const learningsSection = buildLearningsSection({
153305
+ filePath: ctx.learningsFilePath,
153306
+ headings: ctx.learningsHeadings
153307
+ });
153116
153308
  const runtimeSection = `************* RUNTIME *************
153117
153309
 
153118
153310
  ${ctx.runtime}`;
@@ -153140,7 +153332,10 @@ function resolveInstructions(ctx) {
153140
153332
  tocEntries.push({ label: "EVENT CONTEXT", description: "related PR/issue data" });
153141
153333
  tocEntries.push({ label: "SYSTEM", description: "persona, security, tools, workflow rules" });
153142
153334
  if (pctx.learningsFilePath)
153143
- tocEntries.push({ label: "LEARNINGS", description: "repo-specific knowledge file path" });
153335
+ tocEntries.push({
153336
+ label: "LEARNINGS",
153337
+ description: "repo-specific knowledge file path + heading TOC"
153338
+ });
153144
153339
  tocEntries.push({ label: "RUNTIME", description: "environment metadata" });
153145
153340
  const toc = buildToc(tocEntries);
153146
153341
  const full = assembleFullPrompt({
@@ -153150,6 +153345,7 @@ function resolveInstructions(ctx) {
153150
153345
  eventContext,
153151
153346
  system,
153152
153347
  learningsFilePath: pctx.learningsFilePath,
153348
+ learningsHeadings: pctx.learningsHeadings,
153153
153349
  runtime: pctx.runtime
153154
153350
  });
153155
153351
  const event = [pctx.eventTitle, pctx.eventMetadata].filter(Boolean).join("\n\n---\n\n");
@@ -153167,7 +153363,7 @@ function resolveInstructions(ctx) {
153167
153363
  import { mkdir, readFile as readFile2, writeFile as writeFile2 } from "node:fs/promises";
153168
153364
  import { dirname as dirname4, join as join14 } from "node:path";
153169
153365
  var LEARNINGS_FILE_NAME = "pullfrog-learnings.md";
153170
- var MAX_LEARNINGS_LENGTH = 1e4;
153366
+ var MAX_LEARNINGS_LENGTH = 1e5;
153171
153367
  function learningsFilePath(tmpdir3) {
153172
153368
  return join14(tmpdir3, LEARNINGS_FILE_NAME);
153173
153369
  }
@@ -153177,6 +153373,15 @@ async function seedLearningsFile(params) {
153177
153373
  await writeFile2(path3, params.current ?? "", "utf8");
153178
153374
  return path3;
153179
153375
  }
153376
+ var TRUNCATION_LINE_BOUNDARY_TOLERANCE = 4096;
153377
+ function truncateAtLineBoundary(body, cap) {
153378
+ if (body.length <= cap) return body;
153379
+ const head = body.slice(0, cap);
153380
+ const lastNewline = head.lastIndexOf("\n");
153381
+ if (lastNewline <= 0) return head;
153382
+ if (cap - lastNewline > TRUNCATION_LINE_BOUNDARY_TOLERANCE) return head;
153383
+ return head.slice(0, lastNewline);
153384
+ }
153180
153385
  async function readLearningsFile(path3) {
153181
153386
  let raw2;
153182
153387
  try {
@@ -153184,9 +153389,7 @@ async function readLearningsFile(path3) {
153184
153389
  } catch {
153185
153390
  return null;
153186
153391
  }
153187
- const trimmed = raw2.trim();
153188
- if (trimmed.length > MAX_LEARNINGS_LENGTH) return trimmed.slice(0, MAX_LEARNINGS_LENGTH);
153189
- return trimmed;
153392
+ return truncateAtLineBoundary(raw2.trim(), MAX_LEARNINGS_LENGTH);
153190
153393
  }
153191
153394
 
153192
153395
  // utils/normalizeEnv.ts
@@ -153533,6 +153736,7 @@ var defaultSettings = {
153533
153736
  prApproveEnabled: false,
153534
153737
  modeInstructions: {},
153535
153738
  learnings: null,
153739
+ learningsHeadings: [],
153536
153740
  envAllowlist: null
153537
153741
  };
153538
153742
  var defaultRunContext = {
@@ -153573,7 +153777,8 @@ async function fetchRunContext(params) {
153573
153777
  setupScript: data.settings?.setupScript ?? null,
153574
153778
  postCheckoutScript: data.settings?.postCheckoutScript ?? null,
153575
153779
  prepushScript: data.settings?.prepushScript ?? null,
153576
- stopScript: data.settings?.stopScript ?? null
153780
+ stopScript: data.settings?.stopScript ?? null,
153781
+ learningsHeadings: data.settings?.learningsHeadings ?? []
153577
153782
  },
153578
153783
  apiToken: data.apiToken,
153579
153784
  oss: data.oss ?? false,
@@ -154339,10 +154544,7 @@ async function main() {
154339
154544
  current: runContext.repoSettings.learnings
154340
154545
  });
154341
154546
  toolState.learningsFilePath = learningsPath;
154342
- try {
154343
- toolState.learningsSeed = await readFile4(learningsPath, "utf8");
154344
- } catch {
154345
- }
154547
+ toolState.learningsSeed = (runContext.repoSettings.learnings ?? "").trim();
154346
154548
  log.info(
154347
154549
  `\xBB learnings seeded at ${learningsPath} (existing=${runContext.repoSettings.learnings ? "yes" : "no"})`
154348
154550
  );
@@ -154382,7 +154584,8 @@ async function main() {
154382
154584
  modes: modes2,
154383
154585
  agentId,
154384
154586
  outputSchema,
154385
- learningsFilePath: toolState.learningsFilePath ?? null
154587
+ learningsFilePath: toolState.learningsFilePath ?? null,
154588
+ learningsHeadings: runContext.repoSettings.learningsHeadings
154386
154589
  });
154387
154590
  const logParts = [
154388
154591
  instructions.eventInstructions ? `EVENT-LEVEL INSTRUCTIONS:
@@ -154519,10 +154722,13 @@ ${instructions.user}` : null,
154519
154722
  await persistLearnings(toolContext);
154520
154723
  }
154521
154724
  if (!result.success && toolContext && toolState.progressComment) {
154522
- await reportErrorToComment({
154523
- toolState,
154524
- error: result.error || "agent run failed"
154525
- }).catch((error49) => {
154725
+ const rawError = result.error || "agent run failed";
154726
+ const errorBody = isApiKeyAuthError(rawError) ? formatApiKeyErrorSummary({
154727
+ owner: runContext.repo.owner,
154728
+ name: runContext.repo.name,
154729
+ raw: rawError
154730
+ }) : rawError;
154731
+ await reportErrorToComment({ toolState, error: errorBody }).catch((error49) => {
154526
154732
  log.debug(`failure error report failed: ${error49}`);
154527
154733
  });
154528
154734
  }
@@ -154558,8 +154764,13 @@ ${instructions.user}` : null,
154558
154764
  killTrackedChildren();
154559
154765
  log.error(errorMessage);
154560
154766
  const billingError = isRouterKeylimitExhaustedError(errorMessage) ? new BillingError(errorMessage, { code: "router_keylimit_exhausted" }) : null;
154767
+ const apiKeyErrorSummary = !billingError && isApiKeyAuthError(errorMessage) ? formatApiKeyErrorSummary({
154768
+ owner: runContext.repo.owner,
154769
+ name: runContext.repo.name,
154770
+ raw: errorMessage
154771
+ }) : null;
154561
154772
  try {
154562
- const errorSummary = billingError ? formatBillingErrorSummary(billingError, runContext.repo.owner) : `### \u274C Pullfrog failed
154773
+ const errorSummary = billingError ? formatBillingErrorSummary(billingError, runContext.repo.owner) : apiKeyErrorSummary ?? `### \u274C Pullfrog failed
154563
154774
 
154564
154775
  \`\`\`
154565
154776
  ${errorMessage}
@@ -154570,7 +154781,7 @@ ${errorMessage}
154570
154781
  } catch {
154571
154782
  }
154572
154783
  try {
154573
- const commentBody = billingError ? formatBillingErrorSummary(billingError, runContext.repo.owner) : errorMessage;
154784
+ const commentBody = billingError ? formatBillingErrorSummary(billingError, runContext.repo.owner) : apiKeyErrorSummary ?? errorMessage;
154574
154785
  await reportErrorToComment({ toolState, error: commentBody });
154575
154786
  } catch {
154576
154787
  }