{"draft":null,"from":177,"to":178,"files":[{"path":"server/src/project-object.ts","added":21,"removed":0,"diff":"--- a/server/src/project-object.ts\n+++ b/server/src/project-object.ts\n@@ -12,6 +12,8 @@\n import { DiskFirstRuntime } from \"./disk-first-runtime.ts\";\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 { GitIntakeTrees } from \"./git-intake-trees.ts\";\n import { pushedSince, remoteHead } from \"./ingest.ts\";\n import {\n \tcheckKey,\n@@ -59,6 +61,10 @@\n export const PUSH_EVERY_MS = 60_000;\n /** While agents are working, how often a call looks for plain-git pushes to the repo. */\n const GIT_CHECK_MS = 15_000;\n+// Disk scratch admission limits, independent of the Worker's resident memory.\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 \n /**\n  * The load guard (platform issue 46): an estimate of a loaded project's memory from its log entries, lines and claim\n@@ -119,6 +125,10 @@\n \tconstructor(ctx: DurableObjectState, env: Env) {\n \t\tsuper(ctx, env);\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\tGitIntakeTrees.recover(ctx.storage);\n+\t\t}\n \t}\n \n \t/** Where files kept whole go: the project's blob store. */\n@@ -533,12 +543,23 @@\n \t\tconst head = await remoteHead(artifacts, name);\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 \t\tconst found = await pushedSince(\n \t\t\tartifacts,\n \t\t\tname,\n \t\t\tseen,\n \t\t\tasync (bytes) => (bytes.byteLength > BLOB_MAX ? null : this.blobs.putBytes(bytes)),\n \t\t\t(path) => sharedBlobs[path],\n+\t\t\ttrees ? (files, path, body, oid) => trees.retainFile(files, path, body, oid) : undefined,\n+\t\t\ttrees\n+\t\t\t\t? {\n+\t\t\t\t\t\tstorage: this.ctx.storage,\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\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\tif (!found || found.commits.length === 0) {\n \t\t\tif (found) await this.ctx.storage.put(\"git:head\", found.head);"}],"unmatched":[]}