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
MCP
show on this site's /mcp
CLI
abso show 202 --json
JSON
/christopher/abso-core/versions/202?format=json

Auto-settle (#19): the client settles a held push by itself when the server advises keeping a side of every collision (Clef at 0.5 or more, or a check in code). It pulls, settles each file as advised (or takes the pull's own word-by-word merge when the file already holds the advised side), pushes again with what was kept and why in the message, and says how to check or change it. ABSO_AUTOSETTLE=off settles nothing by itself. Tried on a local open server: a timeout where theirs had yours settled to theirs by a code check; a typo both fixed settled to yours by Clef at 0.81 and pushed; a nesting limit set two ways stayed held for an agent.

of shared·autosettle··Not checked

Version 201 · Files at version 202

1 file, 90 lines added, 1 removed.

--- a/client/src/publish-commands.ts
+++ b/client/src/publish-commands.ts
@@ -293,6 +293,7 @@
293293 waitSeconds: number,
294294 skippedCheck: boolean,
295295 leftOut: LeftOut[],
296+ autoSettled = false,
296297): Promise<Output> {
297298 const recorded = await recordFolder(root, api, false, meantBinary(args));
298299 leftOut.push(...recorded.leftOut);
@@ -458,8 +459,73 @@
458459 const real = collisions.filter((c) => !isLocalOnly(c.file));
459460 const twice = real.filter((c) => c.kind === "duplicate");
460461 const newer = real.filter((c) => c.kind !== "duplicate");
461− // The server's first opinion on each collision (#19), when it runs AUTOSETTLE. Advice only: the agent settles.
462+ // The server's first opinion on each collision (#19), when it runs AUTOSETTLE.
462463 const advice = answer.advice ?? [];
464+ // When it says to keep a side of every collision, settle them here and push again (ABSO_AUTOSETTLE=off stops it).
465+ const plan = autoSettled ? null : autoPlan(collisions, advice, env);
466+ if (plan) {
467+ const pulled = await runSync({ positionals: [], flags: new Map() }, env);
468+ const done: string[] = [];
469+ for (const [file, a] of plan) {
470+ const path = absolute(root, file);
471+ const text = readText(path);
472+ const settled =
473+ text === null || text === undefined ? null : settleText(text, a.pick as "yours" | "theirs" | "both");
474+ if (!settled) continue;
475+ if (settled.blocks > 0) {
476+ writeFileAtomic(path, settled.text);
477+ done.push(file);
478+ continue;
479+ }
480+ // No marker block: the pull merged the lines itself. That counts when the file already holds the
481+ // advised side's lines (keep both: both sides').
482+ const lines = new Set(text!.split(/\r?\n/).map((l) => l.trim()));
483+ const sides = collisions
484+ .filter((c) => c.file === file)
485+ .flatMap((c) => [
486+ ...(a.pick !== "theirs" ? [c.yours.text] : []),
487+ ...(a.pick !== "yours" ? [c.theirs.text] : []),
488+ ]);
489+ const wanted = sides.flatMap((t) => t.split(/\r?\n/).map((l) => l.trim())).filter((l) => l !== "");
490+ if (wanted.length > 0 && wanted.every((l) => lines.has(l))) done.push(file);
491+ }
492+ const left = [...plan.keys()].filter((f) => !done.includes(f));
493+ if (left.length > 0)
494+ return {
495+ exit: EXIT.refused,
496+ text: [
497+ ...pre,
498+ pulled.text,
499+ `Not pushed: the server advised settling ${left.join(", ")}, but the pull left no marker block there. Settle as the pull says, then push again.`,
500+ ].join("\n"),
501+ json: { collisions, advice, autosettle: { pulled: true, settled: done, left } },
502+ };
503+ const why = [...plan].map(([file, a]) => `${file}: kept ${a.pick} (${a.reason})`).join("; ");
504+ const again = await publishSteps(
505+ args,
506+ env,
507+ root,
508+ config,
509+ api,
510+ `${message}\n\nSettled automatically (abso 19): ${why}`,
511+ checked,
512+ waitSeconds,
513+ skippedCheck,
514+ leftOut,
515+ true,
516+ );
517+ return {
518+ ...again,
519+ text: [
520+ ...pre,
521+ `Held: ${plural(collisions.length, "collision")} with work pushed since your last pull. Settled automatically, as the server advised:`,
522+ ...[...plan].map(([file, a]) => ` ${file}: ${adviceWords(a)}`),
523+ again.text,
524+ "Check what was kept with abso show <version>:<file>; to change it, edit the file and push. ABSO_AUTOSETTLE=off settles nothing by itself.",
525+ ].join("\n"),
526+ json: { ...(again.json as object), autosettled: Object.fromEntries(plan) },
527+ };
528+ }
463529 return {
464530 exit: EXIT.refused,
465531 text: [
@@ -511,6 +577,29 @@
511577 return `${what} (${how}): ${a.reason}`;
512578}
513579
580+/**
581+ * What to settle by itself (#19), file by file, or null to leave it to the agent: every collision a lines collision
582+ * the server advised keeping a side of (it advises a side only at or above its threshold), each file's advice the
583+ * same, nothing still queued or local-only, and ABSO_AUTOSETTLE not "off".
584+ */
585+function autoPlan(
586+ collisions: readonly Collision[],
587+ advice: readonly (Advice | null)[],
588+ env: Env,
589+): Map<string, Advice> | null {
590+ if (fromEnv(env.env, "AUTOSETTLE") === "off" || collisions.length === 0) return null;
591+ const plan = new Map<string, Advice>();
592+ for (const [i, c] of collisions.entries()) {
593+ const a = advice[i];
594+ if ((c.kind ?? "lines") !== "lines" || c.untouched || c.marked || c.theirs.queued !== undefined) return null;
595+ if (isLocalOnly(c.file) || !a || a.pick === "agent") return null;
596+ const before = plan.get(c.file);
597+ if (before && before.pick !== a.pick) return null;
598+ if (!before || a.confidence < before.confidence) plan.set(c.file, a);
599+ }
600+ return plan;
601+}
514603export async function runSync(args: Parsed, env: Env): Promise<Output> {
515604 const { root, api } = open(env);
516605 const recorded = await recordFolder(root, api);