- First-class LLM providers: Ollama, LM Studio, OpenRouter, NVIDIA Cloud (shared clients, config, max_tokens compat, reachability, pill parity). - llm-api: honor PRR_LLM_PROVIDER for openrouter/nvidiacloud; sync public provider in isAvailable; explicit provider fails checkStatus without key. - validateAndFilterModels: env key fallbacks for OpenRouter/NVIDIA; keep rotation when /v1/models is empty; align needs* with llm-api provider. - Local probes: classify connection failures via Error.cause chain. - GitHub: mergeable polling, fork/upstream base handling, pr-mergeable helper. - Thread working reactions; thread-replies and reporter robustness. - ElizaCloud retry policy, final-audit fallback, conflict/merge and state improvements; contributor-sheet tool; tests and catalog refresh. - README, CHANGELOG, DEVELOPMENT, AGENTS, MODELS, .env.example: WHYs for provider selection, rotation validation, and local backends.
Showing the changes to shared/git/git-commit-scan.ts (1 of 125 files). Show all
Unified · Split
| @@ -21,6 +21,9 @@ · 20 unmodified lines | |||
| 21 | import type { SimpleGit } from 'simple-git'; | 21 | import type { SimpleGit } from 'simple-git'; |
| 22 | import { debug, formatNumber, warn } from '../logger.js'; | 22 | import { debug, formatNumber, warn } from '../logger.js'; |
| 23 | 23 | ||
| 24 | /** Must match **`FORK_PR_BASE_REMOTE`** in **`git-conflicts.ts`** (fork PR base remote name). */ | ||
| 25 | const GIT_SCAN_FORK_BASE_REMOTE = 'upstream'; | ||
| 26 | |||
| 24 | /** One warning per process per workdir+reason when merge base for prr-fix scan is missing (pill-output #559). */ | 27 | /** One warning per process per workdir+reason when merge base for prr-fix scan is missing (pill-output #559). */ |
| 25 | const warnedScanBaseFallback = new Set<string>(); | 28 | const warnedScanBaseFallback = new Set<string>(); |
| 26 | /** One warning per process per workdir when git log --grep scan throws (non-fatal degrade). */ | 29 | /** One warning per process per workdir when git log --grep scan throws (non-fatal degrade). */ |
| @@ -49,10 +52,26 @@ function scanCacheKey( · 22 unmodified lines | |||
| 49 | return `${workdir}\0${branch}\0${headSha}\0${base}\0${resolvedBaseLabel}`; | 52 | return `${workdir}\0${branch}\0${headSha}\0${base}\0${resolvedBaseLabel}`; |
| 50 | } | 53 | } |
| 51 | 54 | ||
| 52 | /** Resolve `origin/<prBase>` or first existing of origin/main|master|develop for `base..branch` log range. */ | 55 | /** |
| 53 | async function resolveScanBaseBranch(git: SimpleGit, prBaseBranch?: string): Promise<string | null> { | 56 | * Resolve **`upstream/<prBase>`** then **`origin/<prBase>`** (when fork recovery), else **`origin/<prBase>`**, |
| 57 | * then first existing of **`origin/main|master|develop`** for **`base..branch`** `git log` range. | ||
| 58 | */ | ||
| 59 | async function resolveScanBaseBranch( | ||
| 60 | git: SimpleGit, | ||
| 61 | prBaseBranch?: string, | ||
| 62 | preferUpstreamForPrBase?: boolean | ||
| 63 | ): Promise<string | null> { | ||
| 54 | const prBase = prBaseBranch?.trim(); | 64 | const prBase = prBaseBranch?.trim(); |
| 55 | if (prBase) { | 65 | if (prBase) { |
| 66 | if (preferUpstreamForPrBase) { | ||
| 67 | const upRef = `${GIT_SCAN_FORK_BASE_REMOTE}/${prBase}`; | ||
| 68 | try { | ||
| 69 | await git.raw(['rev-parse', '--verify', upRef]); | ||
| 70 | return upRef; | ||
| 71 | } catch { | ||
| 72 | /* upstream missing or not fetched — try origin */ | ||
| 73 | } | ||
| 74 | } | ||
| 56 | const prRef = `origin/${prBase}`; | 75 | const prRef = `origin/${prBase}`; |
| 57 | try { | 76 | try { |
| 58 | await git.raw(['rev-parse', '--verify', prRef]); | 77 | await git.raw(['rev-parse', '--verify', prRef]); |
| @@ -98,6 +117,11 @@ export interface ScanCommittedFixesOptions { · 39 unmodified lines | |||
| 98 | * rely on `-n 100`; using the real PR base matches pill/external audits expecting a proper merge range. | 117 | * rely on `-n 100`; using the real PR base matches pill/external audits expecting a proper merge range. |
| 99 | */ | 118 | */ |
| 100 | prBaseBranch?: string; | 119 | prBaseBranch?: string; |
| 120 | /** | ||
| 121 | * When true (fork PR with **`base.repo` ≠ head**), **`resolveScanBaseBranch`** prefers **`upstream/<prBase>`** | ||
| 122 | * so **`prr-fix:`** recovery matches GitHub’s merge base. Requires **`upstream`** ref (see setup prefetch). | ||
| 123 | */ | ||
| 124 | useUpstreamPrBaseForGitRecovery?: boolean; | ||
| 101 | } | 125 | } |
| 102 | 126 | ||
| 103 | /** | 127 | /** |
| @@ -139,7 +163,7 @@ export async function scanCommittedFixes( · 35 unmodified lines | |||
| 139 | ): Promise<string[]> { | 163 | ): Promise<string[]> { |
| 140 | let resolvedBase: string | null = null; | 164 | let resolvedBase: string | null = null; |
| 141 | try { | 165 | try { |
| 142 | resolvedBase = await resolveScanBaseBranch(git, opts?.prBaseBranch); | 166 | resolvedBase = await resolveScanBaseBranch(git, opts?.prBaseBranch, opts?.useUpstreamPrBaseForGitRecovery); |
| 143 | } catch (error) { | 167 | } catch (error) { |
| 144 | debug('resolveScanBaseBranch failed', { error }); | 168 | debug('resolveScanBaseBranch failed', { error }); |
| 145 | resolvedBase = null; | 169 | resolvedBase = null; |