fix(gates): merge-conflict copy is AI-availability-aware; resolver uses model tiers #5455
3 changed files+17−5
Modifiedsrc/lib/gate.ts+7−1View fileUnifiedSplit
@@ -18,6 +18,7 @@ import { db } from "../db";
1818import { gateRuns, repoSettings, repositories, users } from "../db/schema";
1919import { getOrCreateSettings } from "./repo-bootstrap";
2020import { scanForSecrets, aiSecurityScanSafe } from "./security-scan";
21import { isAiAvailable } from "./ai-client";
2122import type { SecretFinding, SecurityFinding } from "./security-scan";
2223import { repairSecrets, repairSecurityIssues } from "./auto-repair";
2324import { readFile } from "fs/promises";
@@ -282,11 +283,16 @@ export async function checkMergeability(
282283 await mergeTree.exited;
283284
284285 const hasConflicts = treeOut.includes("<<<<<<<");
286 // Don't promise AI conflict resolution the AI can't deliver: with no
287 // working AI (missing key / exhausted balance) the attempt is a doomed
288 // API call followed by a failed merge — say so up front instead.
285289 return {
286290 name: "Merge check",
287291 passed: !hasConflicts,
288292 details: hasConflicts
289 ? "Merge conflicts detected — auto-resolution will be attempted"
293 ? isAiAvailable()
294 ? "Merge conflicts detected — AI auto-resolution will be attempted on merge"
295 : "Merge conflicts detected — resolve manually (AI resolution unavailable right now)"
290296 : "Clean merge possible",
291297 };
292298}
Modifiedsrc/lib/merge-resolver.ts+4−2View fileUnifiedSplit
@@ -7,7 +7,7 @@
77 * 3. Applies the resolved content and completes the merge
88 */
99
10import { getAnthropic } from "./ai-client";
10import { getAnthropic, modelForTask } from "./ai-client";
1111import { getRepoPath } from "../git/repository";
1212
1313interface ConflictFile {
@@ -166,7 +166,9 @@ async function resolveConflict(
166166
167167 try {
168168 const message = await client.messages.create({
169 model: "claude-sonnet-4-6",
169 // Standard tier via the admin model selector — was hardcoded to an
170 // old Sonnet, silently bypassing /admin/flags model routing.
171 model: modelForTask("code-review"),
170172 max_tokens: 8192,
171173 messages: [
172174 {
Modifiedsrc/routes/pulls.tsx+6−2View fileUnifiedSplit
@@ -5170,7 +5170,9 @@ pulls.get("/:owner/:repo/pulls/:number", softAuth, requireRepoAccess("read"), as
51705170 : gateChecks.some(
51715171 (c) => !c.passed && c.name === "Merge check"
51725172 )
5173 ? "Conflicts detected — GlueCron AI will attempt auto-resolution on merge."
5173 ? isAiAvailable()
5174 ? "Conflicts detected — GlueCron AI will attempt auto-resolution on merge."
5175 : "Conflicts detected — AI resolution is unavailable right now; resolve manually before merging."
51745176 : "Some checks failed — resolve issues before merging."}
51755177 {aiReviewCount > 0 && (
51765178 <>
@@ -5232,7 +5234,9 @@ pulls.get("/:owner/:repo/pulls/:number", softAuth, requireRepoAccess("read"), as
52325234 : gateChecks.length > 0
52335235 ? gatesAllPassed
52345236 ? "All gates green. Merge will fast-forward into the base branch."
5235 : "Conflicts will be auto-resolved by GlueCron AI on merge."
5237 : isAiAvailable()
5238 ? "Conflicts will be auto-resolved by GlueCron AI on merge."
5239 : "Conflicts present and AI resolution is unavailable — merging now will fail; resolve manually first."
52365240 : "Run gate checks by refreshing once your branch has a recent commit."}
52375241 </p>
52385242 <Form
52395243
c comment · e edit title · m merge · a approve · r request changes · ? shortcuts