iterate.com / git

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

When the mind does not answer, git is told to try again (503), not that there is no repo (404)

On 27 Nov 2026 the mind's root context did not answer for about 33 s. An anonymous read of a
public repo whose itx call fails got the "no repo here" 404, which a script reads as final. Now
a failure with the platform's code UNAVAILABLE answers 503 with `retry-after: 10`, for a member
and for anyone who reads a repo that worker.ts lists as public. Anyone else still gets the answer
that names no repo.

Task: tasks/git-app-answer-503-not-404-when-itx-is-unavailable.md

Via: /agents/claude/git-inline-file-editor-mwytuzod-f63eb0
Session: claude ef590eaa-2914-4af7-9edd-b0cf7fdcb670 on beelink
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0158EjAGmZ6MMS9Lxe36YxkW

Jonas Templestein, 2026-11-27 10:41 UTC · 3e4487f4d63b2cd6e75746930d9498b5c8c3f8f1 · parent 3ed0d32

2 files changed

M app.ts
@@ -64,7 +64,7 @@
 // ISOLATES: each read that reaches a new isolate mints one. What stops a push is
 // Artifacts' own limit of 64 MiB a push, with the same words through this app as straight to
 // Artifacts.
-import { reportIssue } from "iterate/lib";
+import { errorCode, reportIssue } from "iterate/lib";
 import { type AppDescription, type IterateConfigEntrypoint, serveFiles } from "iterate/sdk";
 import { openFile } from "@repos/stdlib/open-files.ts";
 import theme from "@repos/stdlib/theme.css";
@@ -286,6 +286,16 @@
       ownToken ?? forPush ?? forRead,
     ]);
   } catch (error) {
+    // THE MIND DID NOT ANSWER (code UNAVAILABLE: an overload, a reset, a lost connection): that is
+    // no word about the repo. A member, and anyone who reads a repo that worker.ts lists as
+    // public, gets 503 and when to ask again, so that a script tries again; a 404 here said "no
+    // repo" of a repo that is there (27 Nov 2026: CI read it as final). Anyone else still gets the
+    // answer that names no repo.
+    if (errorCode(error) === "UNAVAILABLE" && (member || anonymousRead))
+      return new Response("git: the mind did not answer just now. Try again in a few seconds.\n", {
+        status: 503,
+        headers: { "retry-after": "10", "cache-control": "no-store" },
+      });
     // only a member is told that a repo is not there, or was not read
     if (!member) return refusal(request, url, presented);
     const message = error instanceof Error ? error.message : String(error);
M tests/app.test.mjs
@@ -436,6 +436,30 @@
   assert.deepEqual(mind.remotesAsked, ["/repos/kernel"]);
 });
 
+test("when the mind does not answer, a public repo's reader and a member are told to try again; that is no word about the repo", async () => {
+  await using remote = await artifactsRemote();
+  const mind = fakeMind(remote);
+  const git = gitApp({ public: ["/repos/kernel"], ...look });
+  mind.unavailable.add("/repos/kernel").add("/repos/config");
+  const read = (repo, headers = {}) =>
+    git.fetch(new Request(`https://git.example.com/repos/${repo}/info/refs?service=git-upload-pack`, { headers }), mind);
+
+  for (const answer of [await read("kernel"), await read("kernel", asMember), await read("config", asMember)]) {
+    assert.equal(answer.status, 503);
+    assert.equal(answer.headers.get("retry-after"), "10");
+    assert.equal(await answer.text(), "git: the mind did not answer just now. Try again in a few seconds.\n");
+  }
+  // anyone else is told what they are always told of a repo that is not public: nothing of it
+  const stranger = await read("config");
+  assert.equal(stranger.status, 404);
+  assert.match(await stranger.text(), /there is no repo here that you can read/);
+  assert.equal(remote.requests.length, 0);
+
+  // the mind answers again: the same reader reads
+  mind.unavailable.clear();
+  assert.equal((await read("kernel")).status, 200);
+});
+
 test("what is no git request is refused before the mind is asked anything", async () => {
   await using remote = await artifactsRemote();
   const mind = fakeMind(remote);
@@ -491,6 +515,8 @@
   const away = new Set();
   // a repo whose mint never answers
   const stuck = new Set();
+  // a repo for which the mind does not answer, as the platform says it: an error with a code
+  const unavailable = new Set();
   const repos = ["/repos/kernel", "/repos/config"];
   const itx = {
     kv: {
@@ -503,6 +529,11 @@
     cfArtifacts: {
       get: async (repo) => ({
         remote: async () => {
+          if (unavailable.has(repo))
+            throw Object.assign(new Error("Durable Object is overloaded. Requests queued for too long."), {
+              code: "UNAVAILABLE",
+              data: { kind: "overloaded", retryAfterMs: 10_000 },
+            });
           if (!repos.includes(repo)) throw new Error(`Artifacts: repo not found: ${repo}`);
           remotesAsked.push(repo);
           return `${remote.origin}/remote/${repo.split("/").at(-1)}`;
@@ -536,6 +567,7 @@
     kv,
     minted,
     stuck,
+    unavailable,
     repos,
     remotesAsked,
     announced,