Skip to content

abso-core

Public

abso is version control for agents: the client, the engine and a server you can run on your own Cloudflare account.

Check passed

Versions 179 to 180

Compare

+62 −6 in 7 places
Lines 13–20 at 180 (were 13–18 at 179)
1313import { EngineProject, SqliteLog } from "./engine-project.ts";
1414import { artifactsOf, type Env } from "./env.ts";
1515import { GitDiskIntake } from "./git-disk-intake.ts";
16+import { GitFileContents } from "./git-file-contents.ts";
17+import { GitIntakeLimitError } from "./git-intake-limit.ts";
1618import { GitIntakeTrees } from "./git-intake-trees.ts";
1719import { pushedSince, remoteHead } from "./ingest.ts";
1820import {
Lines 67–73 at 180 (were 65–70 at 179)
6567const GIT_PACK_MAX_BYTES = 128 * 1024 * 1024;
6668const GIT_OBJECT_MAX_BYTES = 64 * 1024 * 1024;
6769const GIT_DECODED_MAX_BYTES = 256 * 1024 * 1024;
70+const GIT_LIMIT_POLICY = `expanded-v2:${GIT_PACK_MAX_BYTES}:${GIT_OBJECT_MAX_BYTES}:${GIT_DECODED_MAX_BYTES}`;
6871
6972/**
7073 * The load guard (platform issue 46): an estimate of a loaded project's memory from its log entries, lines and claim
Lines 130–136 at 180 (were 127–132 at 179)
127130 this.blobs = new BlobStore(ctx.storage);
128131 if (env.ABSO_DISK_FIRST === "on") {
129132 GitDiskIntake.recover(ctx.storage);
133+ GitFileContents.recover(ctx.storage);
130134 GitIntakeTrees.recover(ctx.storage);
131135 }
132136 }
Lines 545–566 at 180 (were 541–546 at 179)
541545 const seen = await this.ctx.storage.get<string>("git:head");
542546 const pushed = await this.ctx.storage.get<PushResult>("pushed");
543547 const head = await remoteHead(artifacts, name);
548+ const refusal = this.diskRuntime()
549+ ? await this.ctx.storage.get<{ head: string; policy: string; kind: GitIntakeLimitError["kind"]; error: string }>(
550+ "git:size-refusal",
551+ )
552+ : undefined;
553+ if (refusal) {
554+ if (
555+ head &&
556+ head !== seen &&
557+ head !== pushed?.commit &&
558+ refusal.head === head &&
559+ refusal.policy === GIT_LIMIT_POLICY
560+ )
561+ throw new GitIntakeLimitError(refusal.kind, refusal.error);
562+ await this.ctx.storage.delete("git:size-refusal");
563+ }
544564 if (!head || head === seen || head === pushed?.commit) return null;
545565 const sharedBlobs = this.useProject((p) => p.shared().blobs ?? {});
546566 using trees = this.diskRuntime() ? new GitIntakeTrees(this.ctx.storage) : undefined;
Lines 580–598 at 180 (were 560–566 at 179)
560580 retainFileChunks: (files, path, chunks, oid) => trees.retainChunks(files, path, chunks, oid),
561581 }
562582 : undefined,
563− );
583+ ).catch(async (error: unknown) => {
584+ if (trees && error instanceof GitIntakeLimitError) {
585+ const refusal = {
586+ head,
587+ policy: GIT_LIMIT_POLICY,
588+ kind: error.kind,
589+ error: error.message,
590+ at: new Date().toISOString(),
591+ };
592+ await this.ctx.storage.put({ "git:size-refusal": refusal, "git:error": refusal });
593+ }
594+ throw error;
595+ });
564596 if (!found || found.commits.length === 0) {
565597 if (found) await this.ctx.storage.put("git:head", found.head);
566598 return null;
Lines 651–675 at 180 (were 619–632 at 179)
619651 if (!artifacts) return;
620652 const name = await this.ctx.storage.get<string>("name");
621653 if (!name || !this.useProject((p) => p.exists())) return;
654+ let intakeFailed = false;
622655 await this.gitSync().then(
623− () => this.ctx.storage.delete("git:error"),
624− (e) =>
625− this.ctx.storage.put("git:error", {
656+ async () => {
657+ await this.ctx.storage.delete("git:error");
658+ await this.ctx.storage.delete("git:retry-attempts");
659+ },
660+ async (e) => {
661+ intakeFailed = true;
662+ const attempts = ((await this.ctx.storage.get<number>("git:retry-attempts")) ?? 0) + 1;
663+ await this.ctx.storage.put("git:retry-attempts", attempts);
664+ await this.ctx.storage.put("git:error", {
626665 at: new Date().toISOString(),
627666 error: e instanceof Error ? e.message : String(e),
628− }),
667+ });
668+ await this.soon(Date.now() + (attempts === 1 ? 1 : attempts === 2 ? 5 : 15) * 60_000);
669+ },
629670 );
671+ // Never export over a remote head whose changes could not be taken in.
672+ if (intakeFailed) return;
630673 const shared = pushSnapshot(
631674 this.useProject((p) => p.sharedPushMetadata()),
632675 (version, path) => this.useProject((current) => current.fileTextAt(version, path)),
Lines 684–703 at 180 (were 641–647 at 179)
641684 }
642685 let result: PushResult;
643686 try {
644− result = await pushShared(artifacts, name, shared, (sha) => this.blobs.read(sha));
687+ result = await pushShared(
688+ artifacts,
689+ name,
690+ shared,
691+ (sha) => this.blobs.read(sha),
692+ this.env.ABSO_DISK_FIRST === "on"
693+ ? {
694+ storage: this.ctx.storage,
695+ maxPackBytes: GIT_PACK_MAX_BYTES,
696+ maxObjectBytes: GIT_OBJECT_MAX_BYTES,
697+ maxDecodedBytes: GIT_DECODED_MAX_BYTES,
698+ }
699+ : undefined,
700+ );
645701 } catch (e) {
646702 // Kept for /out, and tried again with a backoff of our own (a thrown alarm is retried only six times).
647703 const was = await this.ctx.storage.get<{ attempts?: number }>("pushError");
MCP
compare on this site's /mcp
CLI
abso diff 179 180 server/src/project-object.ts --json
JSON
/christopher/abso-core/compare/179..180?file=server%2Fsrc%2Fproject-object.ts&format=json