diff --git a/agents/ollama.ts b/agents/ollama.ts index 42b5143..cd3e259 100644 --- a/agents/ollama.ts +++ b/agents/ollama.ts @@ -169,17 +169,18 @@ async function runOllamaLoop(ctx: AgentRunContext): Promise { }); } - // After select_mode, explicitly tell the model to act on the returned guidance. - // Without this nudge, smaller models tend to treat the mode instructions as - // informational and stop rather than executing the workflow steps. - if (calledSelectMode) { + // After the FIRST select_mode call, nudge the model to act on the guidance. + // Only nudge once — repeated nudging causes a loop where the model keeps + // re-calling select_mode instead of executing the workflow. + if (calledSelectMode && !pendingModeNudge) { pendingModeNudge = true; messages.push({ role: "user", content: - "You have selected a mode and received your workflow instructions. " + - "Now execute the first step of that workflow immediately by calling the appropriate tool. " + - "Do not describe what you will do — just call the tool.", + "Good. You have selected a mode and received the workflow. " + + "Do NOT call select_mode again. " + + "Call the next tool to execute the workflow now (e.g. checkout_pr, get_issue, create_pull_request_review). " + + "Start immediately.", }); } } diff --git a/mcp/checkout.ts b/mcp/checkout.ts index 1851595..3596668 100644 --- a/mcp/checkout.ts +++ b/mcp/checkout.ts @@ -490,7 +490,10 @@ export function CheckoutPrTool(ctx: ToolContext) { `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. ` + `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 ? ` IMPORTANT: read incrementalDiffPath FIRST to understand what changed since last review, then use diffPath for full context.` : "") +