Understand any codebase instantly. System intelligence for codebases, built for humans and AI.
TypeScript aiai-memoryclaude-codeclicode-analysiscode-mappingcode-memorycodebase-understandingcodexdeveloper-toolsllmopenclawpersistent-memoryprogram-analysissoftware-architecturesystem-intelligencesystem-mapping
fix(ingest): let cloud ingests send an empty patch actor (IX_PATCH_ACTOR)
Tanner Kocherb55b29376c33
diff --git a/core-ingestion/src/__tests__/patchActor.test.ts b/core-ingestion/src/__tests__/patchActor.test.tsnew file mode 100644index 00000000..356dfd0b--- /dev/null+++ b/core-ingestion/src/__tests__/patchActor.test.ts@@ -0,0 +1,27 @@+// Copyright 2026 Ix Infrastructure Inc.++import { afterEach, describe, expect, it } from "vitest";+import { patchActor } from "../patch-builder.js";++describe("patchActor", () => {+ const saved = process.env.IX_PATCH_ACTOR;+ afterEach(() => {+ if (saved === undefined) delete process.env.IX_PATCH_ACTOR;+ else process.env.IX_PATCH_ACTOR = saved;+ });++ it("defaults to ix/ingestion for local/OSS backends", () => {+ delete process.env.IX_PATCH_ACTOR;+ expect(patchActor()).toBe("ix/ingestion");+ });++ it("sends an empty actor when IX_PATCH_ACTOR is set to empty, so a cloud backend stamps the verified principal", () => {+ process.env.IX_PATCH_ACTOR = "";+ expect(patchActor()).toBe("");+ });++ it("honours an explicit actor", () => {+ process.env.IX_PATCH_ACTOR = "ci/ingest";+ expect(patchActor()).toBe("ci/ingest");+ });+});diff --git a/core-ingestion/src/patch-builder.ts b/core-ingestion/src/patch-builder.tsindex b2dec2bb..8352d89b 100644--- a/core-ingestion/src/patch-builder.ts+++ b/core-ingestion/src/patch-builder.ts@@ -140,6 +140,17 @@ function deduplicateUpsertEdges(ops: PatchOp[]): PatchOp[] {* keep the old extractor's edges on them, so the ingest baseline records this* name and a run that finds a different one re-ingests every file once.*/+/**+ * Actor stamped on ingestion patches. A kOS cloud backend binds a patch's actor+ * to the verified principal and REJECTS a non-empty actor that differs from it+ * (403 "body actor ... conflicts with verified principal"), so a cloud ingest+ * must send an empty actor (IX_PATCH_ACTOR="") and let the server stamp the+ * authenticated identity. Local/OSS backends keep the historical default.+ */+export function patchActor(): string {+ return process.env.IX_PATCH_ACTOR ?? 'ix/ingestion';+}+export function extractorName(): string {return `tree-sitter/1.27`;}@@ -417,7 +428,7 @@ export function buildPatch(return {patchId,- actor: 'ix/ingestion',+ actor: patchActor(),timestamp: new Date().toISOString(),source: {uri: filePath,@@ -473,7 +484,7 @@ export function buildDeletionPatch(return {patchId: computePatchId(filePath, deletionHash, extractor),- actor: 'ix/ingestion',+ actor: patchActor(),timestamp: new Date().toISOString(),source: {uri: filePath,@@ -801,7 +812,7 @@ export function buildPatchWithResolution(return {patchId,- actor: 'ix/ingestion',+ actor: patchActor(),timestamp: new Date().toISOString(),source: {uri: filePath,