iterate.com / kernel

git clone https://git.iterate.com/repos/kernel

A mind's birth clones a repo through the repos collection

At birth the mind asked each repo's own facet to pull from its origin.
A repo refuses that: a pull goes out through its caller's egress, which
the repos collection hands it, and a facet called directly has none. So
a mind born with origins made its first repo, failed, made its second
on the one retry, failed, and stayed with empty repos. No test caught
it: the test's stand-in for the root took the pull either way, and the
first real mind was born with no origins.

The clone now goes through `itx.builtins.repos.get(path)`, and the
test's stand-in refuses a pull asked of a repo's own facet, as a repo
does.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

Misha Kaletsky, 2026-11-24 23:39 UTC · 5caf09837ddce44acf267ae12fd0dcb8ef71b0f5 · parent 1669bdd

2 files changed

M core/mind-worker/src/mind/processor.test.ts
@@ -810,19 +810,24 @@
   // The processor asks the root for its own row and schedules alone: a publication reads the
   // repos through its publisher.
   const invoke = async (expression: ItxExpression) => {
-    // a repo is made through the mind's collection, and cloned through its own facet
+    // A repo is made, and cloned, through the mind's collection (`itx.builtins.repos`): a pull
+    // goes out through its caller's egress, which the collection hands the repo. A pull asked of
+    // the repo's own facet (`cd(path).facets.get("repo")`) is one that a real repo refuses.
     const [verb, ...args] = expression.at(-1) as [string, ...unknown[]];
     const at = expression[2];
     if (at === "repos" && verb === "create") {
       root.did.push(`create ${args[0]}`);
       return { path: args[0] };
     }
-    if (Array.isArray(at) && at[0] === "cd" && String(at[1]).startsWith("/repos/")) {
+    const got = expression[3];
+    if (at === "repos" && Array.isArray(got) && got[0] === "get") {
       root.did.push(
-        [verb, at[1], ...args.map((arg) => (typeof arg === "string" ? arg : JSON.stringify(arg)))].join(" "),
+        [verb, got[1], ...args.map((arg) => (typeof arg === "string" ? arg : JSON.stringify(arg)))].join(" "),
       );
       return {};
     }
+    if (Array.isArray(at) && at[0] === "cd" && String(at[1]).startsWith("/repos/") && verb === "pull")
+      throw new Error(`repo ${at[1]}: a pull or push goes through its caller's egress`);
     const rootsOwn = ofTheRoot(expression);
     if (rootsOwn) return rootsOwn.answer;
     throw new Error(`the test's root has no ${JSON.stringify(expression)}`);
M core/mind-worker/src/mind/processor.ts
@@ -19,7 +19,7 @@
   type WorkerManifest,
 } from "core-itx";
 import { MindContract, type MindState } from "./contract.ts";
-import { configPointer, probedConfig, repoCall, type MindPublisher } from "./publication.ts";
+import { configPointer, probedConfig, type MindPublisher } from "./publication.ts";
 import { gatheredTree, treeKeyOf, type TreeCommits } from "./tree.ts";
 
 // a publication resolves its npm dependencies from esm.sh
@@ -345,8 +345,18 @@
       }
       if (!origin || state.repoTips[path] || this.#cloneTried.has(path)) continue;
       this.#cloneTried.add(path);
-      await call(repoCall(path, "setOrigin", origin));
-      await call(repoCall(path, "pull", { remote: origin }));
+      // Through the mind's collection, as any caller reaches a repo, and never the repo's own
+      // facet: a pull goes out through its caller's egress, which is `/`'s `itx.fetch` here, and a
+      // facet that is called directly has no caller to take one from, so it refuses the pull.
+      const ofRepo = (verb: string, ...args: unknown[]): ItxExpression => [
+        "itx",
+        "builtins",
+        "repos",
+        ["get", path],
+        [verb, ...args],
+      ];
+      await call(ofRepo("setOrigin", origin));
+      await call(ofRepo("pull", { remote: origin }));
     }
   }