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 295 --json
JSON
/christopher/abso-core/versions/295?format=json

Owed news: a publish can leave its definition news for other agents for after its write (abso Capacity; prod abso's publishes reset its object, 2026-10-15)

of shared·capacity··Not checked

  • With Project.owesDefinitionNews set, newsForOthers still tells same-lines and move news in the publish, but leaves the definition rule over other agents' drafts out. It records an OwedDefinitionNews {version, space, publisher, names} instead; takeOwedDefinitionNews hands it to the host once.
  • definitionNewsOwed(owed) works that news out later, as it would have been told at the publish: the rule runs against the space at that version, with the work published up to that version only (#newerFor and SharedAdditions take an end version). It reads only. An agent that has synced past the version since is left out.
  • deliverOwedNews(found) tells it through queueNews, so a key an agent was already told adds nothing.
  • Default off: the replay engine and every existing caller behave as before. abso's disk route turns it on, keeps the marker in the publish's own transaction, and delivers from the alarm.
  • Why: on abso's stored tables, the definition rule over ~40 drafts was 5.5 of a 1437-shaped publish's 7.3 s in the lab, about 45 s of one storage transaction in prod. That reset abso's object at 11:08 PM CT. With the rule owed, the publish's write is 18,622 statements instead of 105,252.
  • On prod since 11:35 PM CT as a patch (abso 2341e805), with Agent VCS's yes. This brings core level with it; abso's pin follows.
  • Keeps Observability's publishNews log lines (abso 702), and adds owed: 1 or 0 to the end line.

Checks: tsc clean. node --test in worker/project/test, 41 of 41 pass: changed-definition, collision-streaming, collisions-kept-views, news-cap, news-lazy, news-lines, news-times, news-written, owed-definition-news (new: the same news, against the publish's version even after a later publish removes the name, synced agents left out, the replay engine unchanged), project-writer-storage, writer-adoption.

Version 294 · Files at version 295

4 files, 229 lines added, 7 removed.

--- a/worker/project/news.ts
+++ b/worker/project/news.ts
@@ -257,8 +257,32 @@
257257 queueNews(agent: AgentState, items: readonly NewsItem[], entries: Entry[]): void;
258258 /** A line for the host's logs (ProjectOptions.logLine). */
259259 logLine?(line: Record<string, string | number>): void;
260+ /**
261+ * Owed news (abso Capacity, 2026-10-15): when this answers true, a publish leaves its definition news for other
262+ * agents to be worked out after its write (definitionNewsOwed) and hands it to owe instead.
263+ */
264+ owesDefinitionNews(): boolean;
265+ owe(owed: OwedDefinitionNews): void;
266+ spaceNamed(name: string): Space | undefined;
267+ /** newerFor as it was at `version` of the agent's space. */
268+ newerAt(agent: AgentState, version: number): ReadonlySet<AtomId>;
269+ /** definitionCollisions against the agent's space at `version`, not its newest. */
270+ definitionCollisionsAt(
271+ agent: AgentState,
272+ newer: ReadonlySet<AtomId>,
273+ names: ReadonlySet<string>,
274+ version: number,
275+ ): DefinitionCollision[];
260276}
261277
278+/** A publish's definition news for other agents, not yet worked out: the version it made, and the names it changed. */
279+export interface OwedDefinitionNews {
280+ readonly version: number;
281+ readonly space: string;
282+ readonly publisher: string;
283+ readonly names: readonly string[];
284+}
262286function lineNews(host: NewsHost, agent: AgentState, pairs: readonly Pair[]): NewsItem[] {
263287 return pairs.map((p) => ({ key: pairKey(p), text: linesText(host.collision(agent, p)) }));
264288}
@@ -349,6 +373,12 @@
349373 ),
350374 );
351375 };
376+ // Owed (abso Capacity, 2026-10-15): the definition rule over every other draft was most of a publish's write on
377+ // stored tables (5.5 of 7.3 s on abso in the lab, about 45 s in prod, long enough to reset the object). Same lines
378+ // and moves are told here as before; the definition news is worked out after the write, against this version.
379+ // Asked only once some other agent has a draft (news-lazy.test.ts: no news work at all otherwise).
380+ let owing: boolean | undefined;
381+ let owed = false;
352382 for (const agent of [...host.agents.values()].toSorted((a, b) => (a.name < b.name ? -1 : 1))) {
353383 if (agent === publisher || agent.space !== space.name) continue;
354384 const draft = host.draft(agent);
@@ -357,8 +387,10 @@
357387 host.logLine?.({ work: "publishNews", step: "start", space: space.name, version, publisher: publisher.name });
358388 const lines = pairsIn(host.graph, draft, just, unionOverlay(host.setOf(space), draft));
359389 changedNames ??= compareDefinitions();
390+ owing ??= host.owesDefinitionNews();
391+ if (owing && changedNames.size > 0) owed = true;
360392 const defs =
361− changedNames.size > 0
393+ changedNames.size > 0 && !owing
362394 ? host.definitionCollisions(agent, host.newerFor(agent), changedNames).filter((d) => just.has(d.by))
363395 : [];
364396 const items = [
@@ -380,5 +412,32 @@
380412 files,
381413 changedNames: changedNames?.size ?? 0,
382414 news,
415+ owed: owed ? 1 : 0,
383416 });
417+ if (owed)
418+ host.owe({ version, space: space.name, publisher: publisher.name, names: [...(changedNames ?? [])].sort() });
384419}
421+/**
422+ * The definition news a publish owes, worked out as newsForOthers would have at that version: the same agents, the
423+ * same rule against the space at `owed.version` and the work published up to it, the same words and keys. Reads only.
424+ * An agent that has synced past the version since is left out (the version is no longer newer for it), and an item
425+ * an agent was already told (from its own edit since, or this run before) is dropped, as queueNews would.
426+ */
427+export function definitionNewsOwed(host: NewsHost, owed: OwedDefinitionNews): { agent: string; items: NewsItem[] }[] {
428+ const space = host.spaceNamed(owed.space);
429+ if (!space || owed.version > last(space) || !space.versions[owed.version]) return [];
430+ const just = new Set(space.versions[owed.version]!.atoms);
431+ const names = new Set(owed.names);
432+ const out: { agent: string; items: NewsItem[] }[] = [];
433+ for (const agent of [...host.agents.values()].toSorted((a, b) => (a.name < b.name ? -1 : 1))) {
434+ if (agent.name === owed.publisher || agent.space !== space.name || agent.base >= owed.version) continue;
435+ if (host.draft(agent).length === 0) continue;
436+ const defs = host
437+ .definitionCollisionsAt(agent, host.newerAt(agent, owed.version), names, owed.version)
438+ .filter((d) => just.has(d.by));
439+ const items = definitionNews(defs).filter((item) => !agent.told.has(item.key));
440+ if (items.length > 0) out.push({ agent: agent.name, items });
441+ }
442+ return out;
443+}
--- a/worker/project/project.ts
+++ b/worker/project/project.ts
@@ -105,9 +105,11 @@
105105 addressedItem,
106106 newsAboutOwnDraft as hostedNewsAboutOwnDraft,
107107 newsForOthers as hostedNewsForOthers,
108+ definitionNewsOwed as hostedDefinitionNewsOwed,
108109 markedItem,
109110 type NewsHost,
110111 type NewsItem,
112+ type OwedDefinitionNews,
111113 reviewItem,
112114 settledItem,
113115} from "./news.ts";
@@ -330,6 +332,12 @@
330332 * doesn't depend on it.
331333 */
332334 checkerReady = false;
335+ /**
336+ * Owed news (abso Capacity, 2026-10-15): a publish's definition news for other agents is left for after its write
337+ * (takeOwedDefinitionNews, definitionNewsOwed, deliverOwedNews). The disk route sets it; the replay engine doesn't.
338+ */
339+ owesDefinitionNews = false;
340+ #owed: OwedDefinitionNews[] = [];
333341 readonly #now: (() => number) | undefined;
334342 readonly #newsWritten: ((items: readonly NewsWritten[]) => void) | undefined;
335343 readonly #whole: ProjectOptions["whole"];
@@ -1337,6 +1345,29 @@
13371345 return hostedAnnouncePerson(this.#announceHost, ...args);
13381346 }
13391347
1348+ /** The definition news the writes since the last call owe other agents, handed over once (news.ts). */
1349+ takeOwedDefinitionNews(): OwedDefinitionNews[] {
1350+ const owed = this.#owed;
1351+ this.#owed = [];
1352+ return owed;
1353+ }
1355+ /** What a publish owes, worked out against its version (news.ts definitionNewsOwed). Reads only. */
1356+ definitionNewsOwed(owed: OwedDefinitionNews): { agent: string; items: NewsItem[] }[] {
1357+ return hostedDefinitionNewsOwed(this.#newsHost, owed);
1358+ }
1360+ /** Tells each agent its owed items, as queueNews does: what an agent was already told adds nothing. */
1361+ deliverOwedNews(found: readonly { agent: string; items: readonly NewsItem[] }[]): number {
1362+ const entries: Entry[] = [];
1363+ for (const { agent: name, items } of found) {
1364+ const agent = this.#agents.get(name);
1365+ if (agent) this.#queueNews(agent, items, entries);
1366+ }
1367+ this.#flush(entries);
1368+ return entries.length;
1369+ }
13401371 /** A seat's earlier chat hears that another chat just used the seat (announce.ts seatNotice). */
13411372 seatNotice(...args: Tail<Parameters<typeof hostedSeatNotice>>): ReturnType<typeof hostedSeatNotice> {
13421373 return hostedSeatNotice(this.#announceHost, ...args);
@@ -2133,6 +2164,12 @@
21332164 definitionCollisions: (agent, newer, names) => this.#definitionCollisions(agent, newer, names),
21342165 queueNews: (agent, items, entries) => this.#queueNews(agent, items, entries),
21352166 logLine: (line) => this.#logLine?.(line),
2167+ owesDefinitionNews: () => this.owesDefinitionNews,
2168+ owe: (owed) => void this.#owed.push(owed),
2169+ spaceNamed: (name) => (name === SHARED ? this.#shared : this.#spaces.get(name)),
2170+ newerAt: (agent, version) => this.#newerFor(agent, version),
2171+ definitionCollisionsAt: (agent, newer, names, version) =>
2172+ this.#definitionCollisions(agent, newer, names, version),
21362173 };
21372174 return this.#news;
21382175 }
@@ -2995,13 +3032,14 @@
29953032 }
29963033
29973034 /** The space's atoms published after the agent's base, by others. */
2998− #newerFor(agent: AgentState): ReadonlySet<AtomId> {
3035+ /** `upTo`: the work published after the agent's base up to that version only (owed news, news.ts). */
3036+ #newerFor(agent: AgentState, upTo?: number): ReadonlySet<AtomId> {
29993037 const space = this.#spaceOf(agent);
30003038 const base = this.#at(space, agent.base);
3001− const current = this.#setOf(space);
3039+ const current = upTo === undefined ? this.#setOf(space) : this.#at(space, upTo);
30023040 const newer =
30033041 space.name === SHARED && space.membershipVersion
3004− ? new SharedAdditions(space, agent.base, base, current)
3042+ ? new SharedAdditions(space, agent.base, base, current, upTo ?? last(space))
30053043 : differenceSet(current, base);
30063044 return differenceSet(newer, new StableOverlaySet(agent.mine));
30073045 }
@@ -3141,6 +3179,8 @@
31413179 agent: AgentState,
31423180 newer: ReadonlySet<AtomId>,
31433181 names?: ReadonlySet<string>,
3182+ /** The space's version to compare against: its newest, or an owed publish's (news.ts). */
3183+ version?: number,
31443184 ): DefinitionCollision[] {
31453185 const draft = new Set(this.#draft(agent));
31463186 if (draft.size === 0 || newer.size === 0) return [];
@@ -3153,7 +3193,7 @@
31533193 draft,
31543194 this.#agentView(agent),
31553195 base,
3156− this.#viewAt(space, last(space)),
3196+ this.#viewAt(space, version ?? last(space)),
31573197 newer,
31583198 space.name,
31593199 undefined,
--- a/worker/project/spaces.ts
+++ b/worker/project/spaces.ts
@@ -361,10 +361,17 @@
361361 readonly baseVersion: number;
362362 readonly base: ReadonlySet<AtomId>;
363363 readonly current: ReadonlySet<AtomId>;
364− constructor(space: Space, baseVersion: number, base: ReadonlySet<AtomId>, current: ReadonlySet<AtomId>) {
364+ /** `endVersion`: the version `current` is (the newest by default; an earlier one for owed news, news.ts). */
365+ constructor(
366+ space: Space,
367+ baseVersion: number,
368+ base: ReadonlySet<AtomId>,
369+ current: ReadonlySet<AtomId>,
370+ endVersion = last(space),
371+ ) {
365372 super();
366373 if (space.name !== SHARED || !space.membershipVersion) throw Error("shared additions require indexed shared space");
367− this.endVersion = last(space);
374+ this.endVersion = endVersion;
368375 this.space = space;
369376 this.baseVersion = baseVersion;
370377 this.base = base;
--- /dev/null
+++ b/worker/project/test/owed-definition-news.test.ts
@@ -0,0 +1,116 @@
1+// Owed news (abso Capacity, 2026-10-15): with owesDefinitionNews set (abso's disk route sets it), a publish leaves its
2+// definition news for other agents for after its write. The same news, against the publish's version; told once; and
3+// the publisher's own answer as before. abso's worker/test/owed-news.test.ts covers the disk route's marker and alarm.
4+
5+import assert from "node:assert/strict";
6+import { test } from "node:test";
7+import { MemoryStore, Project } from "../project.ts";
8+
9+// abso-core's changed-definition.test.ts scenario: parse.ts defines parsePattern, match.ts imports it.
10+const START = {
11+ "src/parse.ts": [
12+ "export function parsePattern(text: string): Node {",
13+ ' return { kind: "lit", text };',
14+ "}",
15+ "",
16+ "export interface Node {",
17+ " kind: string;",
18+ " text: string;",
19+ "}",
20+ ].join("\n"),
21+ "src/match.ts": ['import { parsePattern } from "./parse.ts";', "", "export function run(p: string) {", " return p;", "}"].join(
22+ "\n",
23+ ),
24+ "README.md": "Uses parsePattern.\n",
25+};
27+/** bob's draft calls parsePattern; ann's draft changes its signature; cat's touches something else. Nothing published. */
28+function drafts(project: Project): void {
29+ project.init(START, 0);
30+ project.sync("bob");
31+ project.sync("ann");
32+ project.sync("cat");
33+ project.edit("bob", { file: "src/match.ts", old: " return p;\n", new: " const tree = parsePattern(p);\n return tree;\n" }, 1);
34+ project.edit(
35+ "ann",
36+ { file: "src/parse.ts", old: "parsePattern(text: string): Node", new: "parsePattern(text: string, flags: string): Node" },
37+ 2,
38+ );
39+ project.edit("cat", { file: "README.md", old: "Uses parsePattern.", new: "Uses parsePattern, twice." }, 3);
40+}
42+const definitionNews = (news: readonly string[]) => news.filter((n) => /definition of parsePattern/.test(n)).sort();
44+test("the news owed is the news a publish would have told, and the publisher's own answer is the same", () => {
45+ const told = new Project(new MemoryStore());
46+ drafts(told);
47+ const toldAnswer = told.publish("ann", "parsePattern takes flags", 4);
48+ const expected = definitionNews(told.news("bob").news);
49+ assert.equal(expected.length, 1, "the scenario has a definition collision");
51+ const owing = new Project(new MemoryStore());
52+ owing.owesDefinitionNews = true;
53+ drafts(owing);
54+ assert.deepEqual(owing.publish("ann", "parsePattern takes flags", 4), toldAnswer, "the publisher's answer");
55+ const owed = owing.takeOwedDefinitionNews();
56+ assert.deepEqual(owed, [{ version: owing.version, space: owed[0]!.space, publisher: "ann", names: ["parsePattern"] }]);
57+ assert.deepEqual(owing.takeOwedDefinitionNews(), [], "handed over once");
58+ // Not told yet: bob's news holds no definition news until it's delivered.
59+ assert.deepEqual(definitionNews(owing.news("bob").news), []);
60+ const found = owing.definitionNewsOwed(owed[0]!);
61+ assert.deepEqual(
62+ found.map((f) => f.agent),
63+ ["bob"],
64+ );
65+ assert.ok(owing.deliverOwedNews(found) > 0);
66+ assert.deepEqual(definitionNews(owing.news("bob").news), expected);
67+ // Told twice adds nothing, and a run of the read after delivery finds nothing left.
68+ assert.equal(owing.deliverOwedNews(found), 0);
69+ assert.deepEqual(owing.definitionNewsOwed(owed[0]!), []);
70+});
72+test("worked out against the publish's version, though more was published before the news went out", () => {
73+ const told = new Project(new MemoryStore());
74+ drafts(told);
75+ told.publish("ann", "parsePattern takes flags", 4);
76+ const expected = definitionNews(told.news("bob").news);
78+ const owing = new Project(new MemoryStore());
79+ owing.owesDefinitionNews = true;
80+ drafts(owing);
81+ owing.publish("ann", "parsePattern takes flags", 4);
82+ const [first] = owing.takeOwedDefinitionNews();
83+ // Then parsePattern is removed, before the first publish's news is out: against the newest version the news
84+ // would say "removes"; against the first publish's, it says "changes", as told at publish time.
85+ owing.sync("ann");
86+ owing.edit(
87+ "ann",
88+ {
89+ file: "src/parse.ts",
90+ old: 'export function parsePattern(text: string, flags: string): Node {\n return { kind: "lit", text };\n}\n',
91+ new: "",
92+ },
93+ 5,
94+ );
95+ owing.publish("ann", "parsePattern goes", 6);
96+ assert.ok(owing.deliverOwedNews(owing.definitionNewsOwed(first!)) > 0);
97+ assert.deepEqual(definitionNews(owing.news("bob").news), expected, "the first publish's news, as it was");
98+});
100+test("an agent that synced past the version since isn't told it", () => {
101+ const owing = new Project(new MemoryStore());
102+ owing.owesDefinitionNews = true;
103+ drafts(owing);
104+ owing.publish("ann", "parsePattern takes flags", 4);
105+ const [owed] = owing.takeOwedDefinitionNews();
106+ owing.sync("bob");
107+ assert.deepEqual(owing.definitionNewsOwed(owed!), []);
108+});
110+test("the replay engine tells it at publish time, as before", () => {
111+ const told = new Project(new MemoryStore());
112+ drafts(told);
113+ told.publish("ann", "parsePattern takes flags", 4);
114+ assert.deepEqual(told.takeOwedDefinitionNews(), []);
115+ assert.equal(definitionNews(told.news("bob").news).length, 1);
116+});