Skip to content

armgit / Ix

Public Imported from GitHub
0

Understand any codebase instantly. System intelligence for codebases, built for humans and AI.

fix(ingest): --github exits 1 when the base-rev race is never won

KageBinary002ba73a09ee
diff --git a/ix-cli/src/cli/commands/ingest.ts b/ix-cli/src/cli/commands/ingest.ts
index 1fd12858..9ed5b02b 100644
--- a/ix-cli/src/cli/commands/ingest.ts
+++ b/ix-cli/src/cli/commands/ingest.ts
@@ -3992,9 +3992,20 @@ export async function loadExistingHashes(
}
// ---------------------------------------------------------------------------
-// GitHub ingestion (unchanged)
+// GitHub ingestion
// ---------------------------------------------------------------------------
+/**
+ * Whether a GitHub ingest's commit landed. `retryOnBaseRevRace` returns the
+ * last result, and a `BaseRevMismatch` after the retries means the backend
+ * wrote nothing -- which `ix ingest --github` reported as a summary and exit 0.
+ */
+export function githubCommitFailure(result: { status?: string }): string | undefined {
+ if (result.status !== COMMIT_STATUS_BASE_REV_MISMATCH) return undefined;
+ return "The backend kept rejecting the commit because another write moved the graph revision under it " +
+ "(BaseRevMismatch), so nothing was ingested. Run the command again once other ingests have finished.";
+}
+
async function ingestGitHub(opts: {
github?: string; token?: string; since?: string;
limit: string; format: string;
@@ -4041,6 +4052,16 @@ async function ingestGitHub(opts: {
const result = await retryOnBaseRevRace(() => client.commitPatch(patch), 8);
const elapsed = ((performance.now() - start) / 1000).toFixed(2);
+ const failure = githubCommitFailure(result);
+ if (failure) {
+ process.exitCode = 1;
+ if (opts.format === 'json') {
+ printJson({ error: 'base_rev_mismatch', message: failure, source: `${repo.owner}/${repo.repo}`, status: result.status });
+ } else {
+ process.stderr.write(chalk.red('Error: ') + failure + '\n');
+ }
+ return;
+ }
if (opts.format === 'json') {
printJson({