{"draft":null,"from":179,"to":318,"files":[{"path":"server/src/project-object.ts","added":64,"removed":6,"diff":"--- a/server/src/project-object.ts\n+++ b/server/src/project-object.ts\n@@ -13,6 +13,8 @@\n import { EngineProject, SqliteLog } from \"./engine-project.ts\";\n import { artifactsOf, type Env } from \"./env.ts\";\n import { GitDiskIntake } from \"./git-disk-intake.ts\";\n+import { GitFileContents } from \"./git-file-contents.ts\";\n+import { GitIntakeLimitError } from \"./git-intake-limit.ts\";\n import { GitIntakeTrees } from \"./git-intake-trees.ts\";\n import { pushedSince, remoteHead } from \"./ingest.ts\";\n import {\n@@ -47,6 +49,7 @@\n \t\"file\",\n \t\"files\",\n \t\"compare\",\n+\t\"without\",\n \t\"where\",\n \t\"feed\",\n \t\"drafts\",\n@@ -65,6 +68,7 @@\n const GIT_PACK_MAX_BYTES = 128 * 1024 * 1024;\n const GIT_OBJECT_MAX_BYTES = 64 * 1024 * 1024;\n const GIT_DECODED_MAX_BYTES = 256 * 1024 * 1024;\n+const GIT_LIMIT_POLICY = `expanded-v2:${GIT_PACK_MAX_BYTES}:${GIT_OBJECT_MAX_BYTES}:${GIT_DECODED_MAX_BYTES}`;\n \n /**\n  * The load guard (platform issue 46): an estimate of a loaded project's memory from its log entries, lines and claim\n@@ -127,6 +131,7 @@\n \t\tthis.blobs = new BlobStore(ctx.storage);\n \t\tif (env.ABSO_DISK_FIRST === \"on\") {\n \t\t\tGitDiskIntake.recover(ctx.storage);\n+\t\t\tGitFileContents.recover(ctx.storage);\n \t\t\tGitIntakeTrees.recover(ctx.storage);\n \t\t}\n \t}\n@@ -541,6 +546,22 @@\n \t\tconst seen = await this.ctx.storage.get<string>(\"git:head\");\n \t\tconst pushed = await this.ctx.storage.get<PushResult>(\"pushed\");\n \t\tconst head = await remoteHead(artifacts, name);\n+\t\tconst refusal = this.diskRuntime()\n+\t\t\t? await this.ctx.storage.get<{ head: string; policy: string; kind: GitIntakeLimitError[\"kind\"]; error: string }>(\n+\t\t\t\t\t\"git:size-refusal\",\n+\t\t\t\t)\n+\t\t\t: undefined;\n+\t\tif (refusal) {\n+\t\t\tif (\n+\t\t\t\thead &&\n+\t\t\t\thead !== seen &&\n+\t\t\t\thead !== pushed?.commit &&\n+\t\t\t\trefusal.head === head &&\n+\t\t\t\trefusal.policy === GIT_LIMIT_POLICY\n+\t\t\t)\n+\t\t\t\tthrow new GitIntakeLimitError(refusal.kind, refusal.error);\n+\t\t\tawait this.ctx.storage.delete(\"git:size-refusal\");\n+\t\t}\n \t\tif (!head || head === seen || head === pushed?.commit) return null;\n \t\tconst sharedBlobs = this.useProject((p) => p.shared().blobs ?? {});\n \t\tusing trees = this.diskRuntime() ? new GitIntakeTrees(this.ctx.storage) : undefined;\n@@ -557,10 +578,23 @@\n \t\t\t\t\t\tmaxPackBytes: GIT_PACK_MAX_BYTES,\n \t\t\t\t\t\tmaxObjectBytes: GIT_OBJECT_MAX_BYTES,\n \t\t\t\t\t\tmaxDecodedBytes: GIT_DECODED_MAX_BYTES,\n+\t\t\t\t\t\tmaxBinaryBytes: BLOB_MAX,\n \t\t\t\t\t\tretainFileChunks: (files, path, chunks, oid) => trees.retainChunks(files, path, chunks, oid),\n \t\t\t\t\t}\n \t\t\t\t: undefined,\n-\t\t);\n+\t\t).catch(async (error: unknown) => {\n+\t\t\tif (trees && error instanceof GitIntakeLimitError) {\n+\t\t\t\tconst refusal = {\n+\t\t\t\t\thead,\n+\t\t\t\t\tpolicy: GIT_LIMIT_POLICY,\n+\t\t\t\t\tkind: error.kind,\n+\t\t\t\t\terror: error.message,\n+\t\t\t\t\tat: new Date().toISOString(),\n+\t\t\t\t};\n+\t\t\t\tawait this.ctx.storage.put({ \"git:size-refusal\": refusal, \"git:error\": refusal });\n+\t\t\t}\n+\t\t\tthrow error;\n+\t\t});\n \t\tif (!found || found.commits.length === 0) {\n \t\t\tif (found) await this.ctx.storage.put(\"git:head\", found.head);\n \t\t\treturn null;\n@@ -619,14 +653,25 @@\n \t\tif (!artifacts) return;\n \t\tconst name = await this.ctx.storage.get<string>(\"name\");\n \t\tif (!name || !this.useProject((p) => p.exists())) return;\n+\t\tlet intakeFailed = false;\n \t\tawait this.gitSync().then(\n-\t\t\t() => this.ctx.storage.delete(\"git:error\"),\n-\t\t\t(e) =>\n-\t\t\t\tthis.ctx.storage.put(\"git:error\", {\n+\t\t\tasync () => {\n+\t\t\t\tawait this.ctx.storage.delete(\"git:error\");\n+\t\t\t\tawait this.ctx.storage.delete(\"git:retry-attempts\");\n+\t\t\t},\n+\t\t\tasync (e) => {\n+\t\t\t\tintakeFailed = true;\n+\t\t\t\tconst attempts = ((await this.ctx.storage.get<number>(\"git:retry-attempts\")) ?? 0) + 1;\n+\t\t\t\tawait this.ctx.storage.put(\"git:retry-attempts\", attempts);\n+\t\t\t\tawait this.ctx.storage.put(\"git:error\", {\n \t\t\t\t\tat: new Date().toISOString(),\n \t\t\t\t\terror: e instanceof Error ? e.message : String(e),\n-\t\t\t\t}),\n+\t\t\t\t});\n+\t\t\t\tawait this.soon(Date.now() + (attempts === 1 ? 1 : attempts === 2 ? 5 : 15) * 60_000);\n+\t\t\t},\n \t\t);\n+\t\t// Never export over a remote head whose changes could not be taken in.\n+\t\tif (intakeFailed) return;\n \t\tconst shared = pushSnapshot(\n \t\t\tthis.useProject((p) => p.sharedPushMetadata()),\n \t\t\t(version, path) => this.useProject((current) => current.fileTextAt(version, path)),\n@@ -641,7 +686,20 @@\n \t\t}\n \t\tlet result: PushResult;\n \t\ttry {\n-\t\t\tresult = await pushShared(artifacts, name, shared, (sha) => this.blobs.read(sha));\n+\t\t\tresult = await pushShared(\n+\t\t\t\tartifacts,\n+\t\t\t\tname,\n+\t\t\t\tshared,\n+\t\t\t\t(sha) => this.blobs.read(sha),\n+\t\t\t\tthis.env.ABSO_DISK_FIRST === \"on\"\n+\t\t\t\t\t? {\n+\t\t\t\t\t\t\tstorage: this.ctx.storage,\n+\t\t\t\t\t\t\tmaxPackBytes: GIT_PACK_MAX_BYTES,\n+\t\t\t\t\t\t\tmaxObjectBytes: GIT_OBJECT_MAX_BYTES,\n+\t\t\t\t\t\t\tmaxDecodedBytes: GIT_DECODED_MAX_BYTES,\n+\t\t\t\t\t\t}\n+\t\t\t\t\t: undefined,\n+\t\t\t);\n \t\t} catch (e) {\n \t\t\t// Kept for /out, and tried again with a backoff of our own (a thrown alarm is retried only six times).\n \t\t\tconst was = await this.ctx.storage.get<{ attempts?: number }>(\"pushError\");"}],"unmatched":[]}