fix: issue properly basing diffs when tagged on pr

This commit is contained in:
2026-05-31 03:01:36 -05:00
parent 93471c9408
commit f7d59cad03
2 changed files with 12 additions and 8 deletions
+8 -7
View File
@@ -169,17 +169,18 @@ async function runOllamaLoop(ctx: AgentRunContext): Promise<AgentResult> {
}); });
} }
// After select_mode, explicitly tell the model to act on the returned guidance. // After the FIRST select_mode call, nudge the model to act on the guidance.
// Without this nudge, smaller models tend to treat the mode instructions as // Only nudge once — repeated nudging causes a loop where the model keeps
// informational and stop rather than executing the workflow steps. // re-calling select_mode instead of executing the workflow.
if (calledSelectMode) { if (calledSelectMode && !pendingModeNudge) {
pendingModeNudge = true; pendingModeNudge = true;
messages.push({ messages.push({
role: "user", role: "user",
content: content:
"You have selected a mode and received your workflow instructions. " + "Good. You have selected a mode and received the workflow. " +
"Now execute the first step of that workflow immediately by calling the appropriate tool. " + "Do NOT call select_mode again. " +
"Do not describe what you will do — just call the tool.", "Call the next tool to execute the workflow now (e.g. checkout_pr, get_issue, create_pull_request_review). " +
"Start immediately.",
}); });
} }
} }
+4 -1
View File
@@ -490,7 +490,10 @@ export function CheckoutPrTool(ctx: ToolContext) {
`use the TOC line ranges as your checklist and read specific files from the diff. ` + `use the TOC line ranges as your checklist and read specific files from the diff. ` +
`for example, if the TOC says "src/foo.ts → lines 5-42", read lines 5-42 from diffPath. ` + `for example, if the TOC says "src/foo.ts → lines 5-42", read lines 5-42 from diffPath. ` +
`review files selectively based on relevance. ` + `review files selectively based on relevance. ` +
`to inspect the PR's changed files, use diffPath — do NOT run git diff commands. ` + `IMPORTANT: to inspect the PR's changed files, read diffPath directly — ` +
`do NOT run git diff or git show. The PR base branch is '${pr.baseRef}', NOT necessarily 'main' — ` +
`if you must use git, use 'origin/${pr.baseRef}' as the base (e.g. git log origin/${pr.baseRef}..HEAD), ` +
`but prefer diffPath for all diff analysis. ` +
(incrementalDiffPath (incrementalDiffPath
? ` IMPORTANT: read incrementalDiffPath FIRST to understand what changed since last review, then use diffPath for full context.` ? ` IMPORTANT: read incrementalDiffPath FIRST to understand what changed since last review, then use diffPath for full context.`
: "") + : "") +