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
blame on this site's /mcp
CLI
abso blame worker/project/writer-agents.ts --json
JSON
/christopher/abso-core/blame/worker/project/writer-agents.ts?format=json
240 linescapacity 80% · codex-capacity-chair 20%Last change capacity in version 262,

240 lines from 6 changes in 4 versions.

capacity262Old agent rows move their told lists into buckets a few at each write (abso Capacity, issue 664; Agent VCS's go). A project adopted before the told buckets (260) keeps each old agent row's list until that agent's row is next written; idle agents' big rows would stay. WriterAgents.moveOldTold walks the agents in the order they joined, from a cursor in the writer state, and rewrites up to 4 old rows at each write (Project's flush of a committed write, never a read or an adoption page), until the cursor passes them all; then it costs one read. Rows written since are in the new form, and an agent read in between answers the same. In practice a write also rewrites every agent it touches, so most rows move with the first writes. Tests (told-buckets): nine agents' rows made old, with no move started, all move within three writes on a reopened writer while news matches the in-memory project, and the cursor ends past every agent; moveOldTold alone moves 4, 4, 2 then 0 of ten untouched old rows, each keeping its keys. All of src/engine/test and worker/project/test pass.Compare1import { type GraphStateStorage, StoredMap, storedArray } from "../../src/engine/state-source.ts";
codex-capacity-chair109Add opt-in persistent writer state, checked reopen and bounded adoptionCompare2import type { AgentState } from "./project-types.ts";
3
4type StoredAgent = Omit<AgentState, "told" | "parked"> & {
capacity258Told lists out of agent rows, in 64 bucket rows per agent; layout pages read through the writer cache; a laid-out file's authors counted by writer (abso Capacity, issue 664; Security yes on ask 2102; Agent VCS approved). - writer-agents.ts: each agent's told keys (the news it has been told) live in 64 rows of their own, project:agents:told, keyed by the agent's name and a fixed hash bucket (FNV-1a mod 64), each holding its bucket's keys sorted; the agent row no longer carries them. told.has reads one bucket and told.add rewrites one; status, where and drafts never read them. A row written before keeps its list, read alongside the buckets (StoredTold.listed) until the agent's row is next written, which moves the list into the buckets; a fresh adoption writes the new form from the start. Removing an agent clears its buckets; delete and purge clear the writer state with them. abso's 109 agent rows were 4.3 MB, the largest 100.9 KB. - CachedStateStorage can read collections straight through; the writer passes file-lines, file-texts and file-deletes pages, which are read only to lay a file out (the view keeps the layout) and pushed out the small rows read on every call. - authorsInView: a laid-out file's lines by author from its visible lines' writers, each writer's author once (tree with authors, folder blame, and the totals adoption keeps), instead of an atom id and line id per line. Tests: told-buckets (new: news on a stored writer against the in-memory project, every step's news asked twice, before and after an agent's told keys are half in an old row's list and half in buckets, with a writer opened afresh; the old list moves into the buckets on the agent's next write; an agent never reads another's buckets; a rollback leaves the buckets as they were). state-cache: a collection read straight through is never kept and pushes nothing out. All of src/engine/test (295) and worker/project/test (351, one skipped) pass.Compare5 /** The told list as rows written before the told buckets kept it (abso Capacity); absent since. */
6 told?: string[];
codex-capacity-chair109Add opt-in persistent writer state, checked reopen and bounded adoptionCompare7 parked: [string, { base: number; mine: AgentState["mine"] }][];
8};
9
10/**
capacity258Told lists out of agent rows, in 64 bucket rows per agent; layout pages read through the writer cache; a laid-out file's authors counted by writer (abso Capacity, issue 664; Security yes on ask 2102; Agent VCS approved). - writer-agents.ts: each agent's told keys (the news it has been told) live in 64 rows of their own, project:agents:told, keyed by the agent's name and a fixed hash bucket (FNV-1a mod 64), each holding its bucket's keys sorted; the agent row no longer carries them. told.has reads one bucket and told.add rewrites one; status, where and drafts never read them. A row written before keeps its list, read alongside the buckets (StoredTold.listed) until the agent's row is next written, which moves the list into the buckets; a fresh adoption writes the new form from the start. Removing an agent clears its buckets; delete and purge clear the writer state with them. abso's 109 agent rows were 4.3 MB, the largest 100.9 KB. - CachedStateStorage can read collections straight through; the writer passes file-lines, file-texts and file-deletes pages, which are read only to lay a file out (the view keeps the layout) and pushed out the small rows read on every call. - authorsInView: a laid-out file's lines by author from its visible lines' writers, each writer's author once (tree with authors, folder blame, and the totals adoption keeps), instead of an atom id and line id per line. Tests: told-buckets (new: news on a stored writer against the in-memory project, every step's news asked twice, before and after an agent's told keys are half in an old row's list and half in buckets, with a writer opened afresh; the old list moves into the buckets on the agent's next write; an agent never reads another's buckets; a rollback leaves the buckets as they were). state-cache: a collection read straight through is never kept and pushes nothing out. All of src/engine/test (295) and worker/project/test (351, one skipped) pass.Compare11 * Each agent's told keys (the news it has been told about) in TOLD_BUCKETS rows of their own, beside its agent row
12 * (abso Capacity, issue 664; Security yes on ask 2102). The list grows for as long as the agent works and was most of
13 * its row: abso's 109 agent rows were 4.3 MB, read in full by every status, where and drafts, none of which reads it.
14 * A row is keyed by the agent's name and a bucket (a fixed hash of the key), and holds that bucket's keys, sorted.
15 */
16const TOLD = "project:agents:told";
17export const TOLD_BUCKETS = 64;
19/** The bucket a told key goes in: 32-bit FNV-1a of its UTF-16 code units. */
20export function toldBucket(key: string): number {
21 let hash = 0x811c9dc5;
22 for (let i = 0; i < key.length; i++) {
23 hash ^= key.charCodeAt(i);
24 hash = Math.imul(hash, 0x01000193);
25 }
26 return (hash >>> 0) % TOLD_BUCKETS;
29const toldRow = (agent: string, bucket: number) => JSON.stringify([agent, bucket]);
31function sortedIndex(keys: readonly string[], key: string): number {
32 let lo = 0;
33 let hi = keys.length;
34 while (lo < hi) {
35 const mid = (lo + hi) >> 1;
36 if (keys[mid]! < key) lo = mid + 1;
37 else hi = mid;
38 }
39 return lo;
42/**
43 * An agent's told keys on a stored writer: has() reads one bucket and add() rewrites one. A row written before the
44 * buckets carries its list itself (`listed`), read alongside the buckets until the agent's row is next written, which
45 * moves the list into the buckets (WriterAgents' encode).
46 */
47export class StoredTold extends Set<string> {
48 readonly #storage: GraphStateStorage;
49 readonly #agent: string;
50 readonly #listed: Set<string>;
51 constructor(storage: GraphStateStorage, agent: string, listed: Iterable<string> = []) {
52 super();
53 this.#storage = storage;
54 this.#agent = agent;
55 this.#listed = new Set(listed);
56 }
57 /** Keys an old row listed and the buckets don't hold yet. */
58 get listed(): ReadonlySet<string> {
59 return this.#listed;
60 }
61 #bucket(bucket: number): string[] {
62 return (this.#storage.read(TOLD, toldRow(this.#agent, bucket)) as string[] | undefined) ?? [];
63 }
64 #inBuckets(key: string): boolean {
65 const keys = this.#bucket(toldBucket(key));
66 return keys[sortedIndex(keys, key)] === key;
67 }
68 override has(key: string): boolean {
69 return this.#listed.has(key) || this.#inBuckets(key);
70 }
71 override add(key: string): this {
72 if (this.has(key)) return this;
73 storeTold(this.#storage, this.#agent, [key]);
74 return this;
75 }
76 override delete(key: string): boolean {
77 const listed = this.#listed.delete(key);
78 const bucket = toldBucket(key);
79 const keys = this.#bucket(bucket);
80 const at = sortedIndex(keys, key);
81 if (keys[at] !== key) return listed;
82 keys.splice(at, 1);
83 if (keys.length > 0) this.#storage.write(TOLD, toldRow(this.#agent, bucket), keys);
84 else this.#storage.remove(TOLD, toldRow(this.#agent, bucket));
85 return true;
86 }
87 override clear(): void {
88 this.#listed.clear();
89 clearTold(this.#storage, this.#agent);
90 }
91 override get size(): number {
92 let n = 0;
93 for (const _ of this.values()) n++;
94 return n;
95 }
96 override *values(): SetIterator<string> {
97 yield* this.#listed;
98 for (let bucket = 0; bucket < TOLD_BUCKETS; bucket++)
99 for (const key of this.#bucket(bucket)) if (!this.#listed.has(key)) yield key;
100 }
101 override keys(): SetIterator<string> {
102 return this.values();
103 }
104 override *entries(): SetIterator<[string, string]> {
105 for (const key of this.values()) yield [key, key];
106 }
107 override [Symbol.iterator](): SetIterator<string> {
108 return this.values();
109 }
110 override forEach(callback: (value: string, key: string, set: Set<string>) => void, thisArg?: unknown): void {
111 for (const key of this.values()) callback.call(thisArg, key, key, this);
112 }
113 /** Move an old row's list into the buckets. */
114 moveListed(): void {
115 if (this.#listed.size === 0) return;
116 storeTold(this.#storage, this.#agent, this.#listed);
117 this.#listed.clear();
118 }
121/** Put keys in an agent's buckets: each bucket read and written once. */
122function storeTold(storage: GraphStateStorage, agent: string, keys: Iterable<string>): void {
123 const byBucket = new Map<number, string[]>();
124 for (const key of keys) {
125 const bucket = toldBucket(key);
126 let list = byBucket.get(bucket);
127 if (!list) byBucket.set(bucket, (list = []));
128 list.push(key);
129 }
130 for (const [bucket, adding] of byBucket) {
131 const keys = (storage.read(TOLD, toldRow(agent, bucket)) as string[] | undefined) ?? [];
132 let changed = false;
133 for (const key of adding) {
134 const at = sortedIndex(keys, key);
135 if (keys[at] === key) continue;
136 keys.splice(at, 0, key);
137 changed = true;
138 }
139 if (changed) storage.write(TOLD, toldRow(agent, bucket), keys);
140 }
143/** Take out every bucket of an agent's (when the agent is removed). */
144function clearTold(storage: GraphStateStorage, agent: string): void {
145 for (let bucket = 0; bucket < TOLD_BUCKETS; bucket++) storage.remove(TOLD, toldRow(agent, bucket));
148/**
codex-capacity-chair109Add opt-in persistent writer state, checked reopen and bounded adoptionCompare149 * Identity map for agents touched by the current operation. Project's existing
150 * reducers share mutable agent references, so copies cannot be substituted
151 * halfway through an operation. Flush those rows with the canonical append,
152 * then drop the references. Opening this map does not load any agents.
153 */
154export class WriterAgents extends StoredMap<string, AgentState> {
155 readonly #touched = new Map<string, AgentState>();
capacity258Told lists out of agent rows, in 64 bucket rows per agent; layout pages read through the writer cache; a laid-out file's authors counted by writer (abso Capacity, issue 664; Security yes on ask 2102; Agent VCS approved). - writer-agents.ts: each agent's told keys (the news it has been told) live in 64 rows of their own, project:agents:told, keyed by the agent's name and a fixed hash bucket (FNV-1a mod 64), each holding its bucket's keys sorted; the agent row no longer carries them. told.has reads one bucket and told.add rewrites one; status, where and drafts never read them. A row written before keeps its list, read alongside the buckets (StoredTold.listed) until the agent's row is next written, which moves the list into the buckets; a fresh adoption writes the new form from the start. Removing an agent clears its buckets; delete and purge clear the writer state with them. abso's 109 agent rows were 4.3 MB, the largest 100.9 KB. - CachedStateStorage can read collections straight through; the writer passes file-lines, file-texts and file-deletes pages, which are read only to lay a file out (the view keeps the layout) and pushed out the small rows read on every call. - authorsInView: a laid-out file's lines by author from its visible lines' writers, each writer's author once (tree with authors, folder blame, and the totals adoption keeps), instead of an atom id and line id per line. Tests: told-buckets (new: news on a stored writer against the in-memory project, every step's news asked twice, before and after an agent's told keys are half in an old row's list and half in buckets, with a writer opened afresh; the old list moves into the buckets on the agent's next write; an agent never reads another's buckets; a rollback leaves the buckets as they were). state-cache: a collection read straight through is never kept and pushes nothing out. All of src/engine/test (295) and worker/project/test (351, one skipped) pass.Compare156 readonly #storage: GraphStateStorage;
codex-capacity-chair109Add opt-in persistent writer state, checked reopen and bounded adoptionCompare157 constructor(storage: GraphStateStorage) {
158 super(storage, "project:agents", {
capacity258Told lists out of agent rows, in 64 bucket rows per agent; layout pages read through the writer cache; a laid-out file's authors counted by writer (abso Capacity, issue 664; Security yes on ask 2102; Agent VCS approved). - writer-agents.ts: each agent's told keys (the news it has been told) live in 64 rows of their own, project:agents:told, keyed by the agent's name and a fixed hash bucket (FNV-1a mod 64), each holding its bucket's keys sorted; the agent row no longer carries them. told.has reads one bucket and told.add rewrites one; status, where and drafts never read them. A row written before keeps its list, read alongside the buckets (StoredTold.listed) until the agent's row is next written, which moves the list into the buckets; a fresh adoption writes the new form from the start. Removing an agent clears its buckets; delete and purge clear the writer state with them. abso's 109 agent rows were 4.3 MB, the largest 100.9 KB. - CachedStateStorage can read collections straight through; the writer passes file-lines, file-texts and file-deletes pages, which are read only to lay a file out (the view keeps the layout) and pushed out the small rows read on every call. - authorsInView: a laid-out file's lines by author from its visible lines' writers, each writer's author once (tree with authors, folder blame, and the totals adoption keeps), instead of an atom id and line id per line. Tests: told-buckets (new: news on a stored writer against the in-memory project, every step's news asked twice, before and after an agent's told keys are half in an old row's list and half in buckets, with a writer opened afresh; the old list moves into the buckets on the agent's next write; an agent never reads another's buckets; a rollback leaves the buckets as they were). state-cache: a collection read straight through is never kept and pushes nothing out. All of src/engine/test (295) and worker/project/test (351, one skipped) pass.Compare159 // The row without its told keys, which go to the agent's buckets: an old row's list moves there now.
160 encode: (agent) => {
161 const { told, ...rest } = agent;
162 if (told instanceof StoredTold) told.moveListed();
163 else storeTold(storage, agent.name, told);
164 return { ...rest, parked: [...agent.parked] };
165 },
codex-capacity-chair109Add opt-in persistent writer state, checked reopen and bounded adoptionCompare166 decode: (value) => {
capacity258Told lists out of agent rows, in 64 bucket rows per agent; layout pages read through the writer cache; a laid-out file's authors counted by writer (abso Capacity, issue 664; Security yes on ask 2102; Agent VCS approved). - writer-agents.ts: each agent's told keys (the news it has been told) live in 64 rows of their own, project:agents:told, keyed by the agent's name and a fixed hash bucket (FNV-1a mod 64), each holding its bucket's keys sorted; the agent row no longer carries them. told.has reads one bucket and told.add rewrites one; status, where and drafts never read them. A row written before keeps its list, read alongside the buckets (StoredTold.listed) until the agent's row is next written, which moves the list into the buckets; a fresh adoption writes the new form from the start. Removing an agent clears its buckets; delete and purge clear the writer state with them. abso's 109 agent rows were 4.3 MB, the largest 100.9 KB. - CachedStateStorage can read collections straight through; the writer passes file-lines, file-texts and file-deletes pages, which are read only to lay a file out (the view keeps the layout) and pushed out the small rows read on every call. - authorsInView: a laid-out file's lines by author from its visible lines' writers, each writer's author once (tree with authors, folder blame, and the totals adoption keeps), instead of an atom id and line id per line. Tests: told-buckets (new: news on a stored writer against the in-memory project, every step's news asked twice, before and after an agent's told keys are half in an old row's list and half in buckets, with a writer opened afresh; the old list moves into the buckets on the agent's next write; an agent never reads another's buckets; a rollback leaves the buckets as they were). state-cache: a collection read straight through is never kept and pushes nothing out. All of src/engine/test (295) and worker/project/test (351, one skipped) pass.Compare167 const { told, ...agent } = value as StoredAgent;
168 return { ...agent, told: new StoredTold(storage, agent.name, told), parked: new Map(agent.parked) };
codex-capacity-chair109Add opt-in persistent writer state, checked reopen and bounded adoptionCompare169 },
170 });
capacity258Told lists out of agent rows, in 64 bucket rows per agent; layout pages read through the writer cache; a laid-out file's authors counted by writer (abso Capacity, issue 664; Security yes on ask 2102; Agent VCS approved). - writer-agents.ts: each agent's told keys (the news it has been told) live in 64 rows of their own, project:agents:told, keyed by the agent's name and a fixed hash bucket (FNV-1a mod 64), each holding its bucket's keys sorted; the agent row no longer carries them. told.has reads one bucket and told.add rewrites one; status, where and drafts never read them. A row written before keeps its list, read alongside the buckets (StoredTold.listed) until the agent's row is next written, which moves the list into the buckets; a fresh adoption writes the new form from the start. Removing an agent clears its buckets; delete and purge clear the writer state with them. abso's 109 agent rows were 4.3 MB, the largest 100.9 KB. - CachedStateStorage can read collections straight through; the writer passes file-lines, file-texts and file-deletes pages, which are read only to lay a file out (the view keeps the layout) and pushed out the small rows read on every call. - authorsInView: a laid-out file's lines by author from its visible lines' writers, each writer's author once (tree with authors, folder blame, and the totals adoption keeps), instead of an atom id and line id per line. Tests: told-buckets (new: news on a stored writer against the in-memory project, every step's news asked twice, before and after an agent's told keys are half in an old row's list and half in buckets, with a writer opened afresh; the old list moves into the buckets on the agent's next write; an agent never reads another's buckets; a rollback leaves the buckets as they were). state-cache: a collection read straight through is never kept and pushes nothing out. All of src/engine/test (295) and worker/project/test (351, one skipped) pass.Compare171 this.#storage = storage;
codex-capacity-chair109Add opt-in persistent writer state, checked reopen and bounded adoptionCompare172 }
173 override get(key: string): AgentState | undefined {
174 let value = this.#touched.get(key);
175 if (!value) {
176 value = super.get(key);
177 if (value) this.#touched.set(key, value);
178 }
179 return value;
180 }
181 override set(key: string, value: AgentState): this {
182 super.set(key, value);
183 this.#touched.set(key, value);
184 return this;
185 }
186 override delete(key: string): boolean {
187 this.#touched.delete(key);
capacity258Told lists out of agent rows, in 64 bucket rows per agent; layout pages read through the writer cache; a laid-out file's authors counted by writer (abso Capacity, issue 664; Security yes on ask 2102; Agent VCS approved). - writer-agents.ts: each agent's told keys (the news it has been told) live in 64 rows of their own, project:agents:told, keyed by the agent's name and a fixed hash bucket (FNV-1a mod 64), each holding its bucket's keys sorted; the agent row no longer carries them. told.has reads one bucket and told.add rewrites one; status, where and drafts never read them. A row written before keeps its list, read alongside the buckets (StoredTold.listed) until the agent's row is next written, which moves the list into the buckets; a fresh adoption writes the new form from the start. Removing an agent clears its buckets; delete and purge clear the writer state with them. abso's 109 agent rows were 4.3 MB, the largest 100.9 KB. - CachedStateStorage can read collections straight through; the writer passes file-lines, file-texts and file-deletes pages, which are read only to lay a file out (the view keeps the layout) and pushed out the small rows read on every call. - authorsInView: a laid-out file's lines by author from its visible lines' writers, each writer's author once (tree with authors, folder blame, and the totals adoption keeps), instead of an atom id and line id per line. Tests: told-buckets (new: news on a stored writer against the in-memory project, every step's news asked twice, before and after an agent's told keys are half in an old row's list and half in buckets, with a writer opened afresh; the old list moves into the buckets on the agent's next write; an agent never reads another's buckets; a rollback leaves the buckets as they were). state-cache: a collection read straight through is never kept and pushes nothing out. All of src/engine/test (295) and worker/project/test (351, one skipped) pass.Compare188 // Its told keys go with it (Security on ask 2102).
189 clearTold(this.#storage, key);
codex-capacity-chair109Add opt-in persistent writer state, checked reopen and bounded adoptionCompare190 return super.delete(key);
191 }
192 override *entries(): MapIterator<[string, AgentState]> {
193 for (const [key, stored] of super.entries()) {
194 let value = this.#touched.get(key);
195 if (!value) this.#touched.set(key, (value = stored));
196 yield [key, value];
197 }
198 }
capacity247A kept reader settles after each read; line texts weigh what V8 holds (abso Capacity, issue 664). What a kept reader held on abso, measured per question without the answer itself (heap snapshot after tree with authors, 56.9 MB held): the view cache 38.3 MB against its 24 MB budget, the agents read 6.5 to 7.7 MB, the move skeleton 2.4 MB, the state cache 2.3 MB; the rest is the engine's indexes. - Project.afterRead: the view cache trimmed to its budget (ViewCache.trim) and the agents the read decoded let go (WriterAgents.release). Views grow while a call lays files out and the cache weighed them only when asked for again; a read-only reader never flushed its agents, so it held every agent's news told. - View weight: a laid-out line's text counts a 16-byte header and a byte a character (two outside Latin-1), rounded to 8, as V8 holds it. It counted 8 and two a character, so abso's whole shared layout (22.7 MB held) weighed about 28 MB, over the budget alone: once trimmed, it was laid out again for every question (blame folder 2.5 s became 14.4 s). Full warm run on the abso export: held heap at most 41.7 MB (was 56.9), 24 to 29 MB between the big reads (was 32 to 37); every answer the same. Status and drafts take about 30 ms more (agents read again); blame folder 1.7 s instead of 2.5 s. Tests: view-cache (trim reweighs growth with no further hit), after-read (new: reads before and after it, and a write after it, against the in-memory project), and the collision, path and compare tests: 21 of 21.Compare199 /** Let go of the agents read, when nothing changed them: a reader kept between calls (abso Capacity). */
200 release(): void {
201 this.#touched.clear();
202 }
codex-capacity-chair109Add opt-in persistent writer state, checked reopen and bounded adoptionCompare204 flush(): void {
205 for (const [key, value] of this.#touched) super.set(key, value);
206 this.#touched.clear();
207 }
capacity262Old agent rows move their told lists into buckets a few at each write (abso Capacity, issue 664; Agent VCS's go). A project adopted before the told buckets (260) keeps each old agent row's list until that agent's row is next written; idle agents' big rows would stay. WriterAgents.moveOldTold walks the agents in the order they joined, from a cursor in the writer state, and rewrites up to 4 old rows at each write (Project's flush of a committed write, never a read or an adoption page), until the cursor passes them all; then it costs one read. Rows written since are in the new form, and an agent read in between answers the same. In practice a write also rewrites every agent it touches, so most rows move with the first writes. Tests (told-buckets): nine agents' rows made old, with no move started, all move within three writes on a reopened writer while news matches the in-memory project, and the cursor ends past every agent; moveOldTold alone moves 4, 4, 2 then 0 of ten untouched old rows, each keeping its keys. All of src/engine/test and worker/project/test pass.Compare208
209 /**
210 * Move up to `limit` more agents' old told lists into their buckets (abso Capacity, issue 664; Agent VCS's go): a
211 * cursor walks the agents in the order they joined, once, a few rows at each write, so a project adopted before the
212 * buckets moves every row over without a separate step. Rows written since are in the new form already, and an
213 * agent read in between answers the same (StoredTold.listed). Returns how many rows it rewrote.
214 */
215 moveOldTold(limit: number): number {
216 const done = (this.#storage.read(TOLD_META, "cursor") as number | undefined) ?? 0;
217 const order = this.#order();
218 if (done >= order.length) return 0;
219 let at = done;
220 let moved = 0;
221 for (; at < order.length && at < done + limit; at++) {
222 const key = order[at]!;
223 if (this.#touched.has(key)) continue; // written with this operation: its row is new already
224 const agent = super.get(key);
225 if (!(agent?.told instanceof StoredTold) || agent.told.listed.size === 0) continue;
226 super.set(key, agent);
227 moved++;
228 }
229 this.#storage.write(TOLD_META, "cursor", at);
230 return moved;
231 }
233 /** The agents' keys in the order they joined (StoredMap's slots, a removed agent's included: it reads as absent). */
234 #order(): readonly string[] {
235 return storedArray<string>(this.#storage, "project:agents:order");
236 }
codex-capacity-chair109Add opt-in persistent writer state, checked reopen and bounded adoptionCompare237}
capacity262Old agent rows move their told lists into buckets a few at each write (abso Capacity, issue 664; Agent VCS's go). A project adopted before the told buckets (260) keeps each old agent row's list until that agent's row is next written; idle agents' big rows would stay. WriterAgents.moveOldTold walks the agents in the order they joined, from a cursor in the writer state, and rewrites up to 4 old rows at each write (Project's flush of a committed write, never a read or an adoption page), until the cursor passes them all; then it costs one read. Rows written since are in the new form, and an agent read in between answers the same. In practice a write also rewrites every agent it touches, so most rows move with the first writes. Tests (told-buckets): nine agents' rows made old, with no move started, all move within three writes on a reopened writer while news matches the in-memory project, and the cursor ends past every agent; moveOldTold alone moves 4, 4, 2 then 0 of ten untouched old rows, each keeping its keys. All of src/engine/test and worker/project/test pass.Compare238
239/** Where the move of old told lists into buckets has got to (WriterAgents.moveOldTold). */
240const TOLD_META = "project:agents:told:meta";