@staix/agent-mem 0.34.0 → 0.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -55,8 +55,10 @@ export interface RecordVariantMetric {
55
55
  /** All marks are process-local performance.now() milliseconds since the process time origin. */
56
56
  export interface JcodeJournalTiming { scanStartMs?: number; scanEndMs?: number; workStartMs?: number; publishStartMs?: number; publishEndMs?: number; publishTotalMs?: number; workerSpawnStartMs?: number; workerSpawnEndMs?: number; cursorCloseStartMs?: number; cursorCloseEndMs?: number; metricSampleAtMs?: number }
57
57
  export interface TranscriptTiming { killAtMs?: number; reapAtMs?: number; metricSampleAtMs: number }
58
- export interface MetricSample extends RecordVariantMetric { jcodeJournalTiming?: JcodeJournalTiming; transcriptTiming?: TranscriptTiming; at: string; kind: "hook" | "search"; /** #485: the read tool that completed, so a peak can be attributed; never its arguments or result. */ tool?: string; /** #485: the process peak after this call was higher than after any sample before it. */ peakRaised?: boolean; brief?: BriefObservation; wallMs?: number; rssMB?: number; rawRssMB?: number; rssSources?: HookRssSources; rssScope?: "owned-images"; transcriptOffset?: number; transcriptStopReason?: HookTranscriptStopReason; /** #226: owned children killed but still alive when the hook returned (bounded reap). */ abandonedChildren?: number; /** #226: a killed worker skipped this call's drain; staged records stay pending (not a capture drop). */ drainSkipped?: number; /** #226: when the worker drain started (ms after hook start) and how many records it committed. */ drainStartMs?: number; drained?: number; idleMB?: number; recordInstructionBytes?: number; recordInstructionEstimatedTokens?: number; captureDrops?: number; captureDropReason?: CaptureDropReason }
59
- const METRICS_MAX_BYTES = 64 * 1024, METRICS_KEEP = 200;
58
+ export interface MetricSample extends RecordVariantMetric { jcodeJournalTiming?: JcodeJournalTiming; transcriptTiming?: TranscriptTiming; at: string; kind: "hook" | "search" | "mcp-phase"; /** #485: the read tool that completed, so a peak can be attributed; never its arguments or result. */ tool?: string; /** #485: the process peak after this call was higher than after any sample before it. */ peakRaised?: boolean; shared?: boolean; brief?: BriefObservation; wallMs?: number; rssMB?: number; rawRssMB?: number; rssSources?: HookRssSources; rssScope?: "owned-images"; transcriptOffset?: number; transcriptStopReason?: HookTranscriptStopReason; /** #226: owned children killed but still alive when the hook returned (bounded reap). */ abandonedChildren?: number; /** #226: a killed worker skipped this call's drain; staged records stay pending (not a capture drop). */ drainSkipped?: number; /** #226: when the worker drain started (ms after hook start) and how many records it committed. */ drainStartMs?: number; drained?: number; idleMB?: number; recordInstructionBytes?: number; recordInstructionEstimatedTokens?: number; captureDrops?: number; captureDropReason?: CaptureDropReason }
59
+ const METRICS_MAX_BYTES = 128 * 1024, METRICS_KEEP = 200, MCP_PHASE_KEEP = 32;
60
+ // ponytail: reserve 17 KiB for future appends; upgrade to separate bounded files if these windows need larger guarantees.
61
+ const HOOK_BYTES = 74 * 1024, SEARCH_BYTES = 30 * 1024, PHASE_BYTES = 6 * 1024, OTHER_BYTES = 1024;
60
62
 
61
63
  /**
62
64
  * #485: the newest `limit` samples of each kind. Hook samples share this file with the read-tool samples a long-lived
@@ -66,22 +68,22 @@ function newestPerKind<T>(items: readonly T[], limit: number, kindOf: (item: T)
66
68
  const kept: T[] = [], seen = new Map<string, number>();
67
69
  for (let index = items.length - 1; index >= 0; index--) {
68
70
  const item = items[index]!, kind = kindOf(item), count = seen.get(kind) ?? 0;
69
- if (count >= limit) continue;
71
+ if (count >= (kind === "mcp-phase" ? Math.min(limit, MCP_PHASE_KEEP) : limit)) continue;
70
72
  seen.set(kind, count + 1); kept.push(item);
71
73
  }
72
74
  return kept.reverse();
73
75
  }
74
76
 
75
77
  /**
76
- * #485: the process peak on the same basis as `scripts/budget-rss.ts` `peakRssKB` (VmHWM on Linux, rusage maxRSS
77
- * elsewhere). `undefined` when this host cannot answer, so a read that only wanted a telemetry sample still completes.
78
+ * Process lifetime peak on the same basis as `scripts/budget-rss.ts`: VmHWM on Linux, maxRSS elsewhere.
79
+ * `undefined` when unavailable; telemetry never makes a call fail.
78
80
  */
79
81
  export function processPeakRssKB(): number | undefined {
80
82
  try { return processImageRssKB("self") ?? process.resourceUsage().maxRSS; } catch { return undefined; }
81
83
  }
82
84
 
83
85
  /** #485: one read-tool call's window; `alone` goes false as soon as another read call shares any part of it. */
84
- export interface PeakWindow { alone: boolean }
86
+ export interface PeakWindow { alone: boolean; startPeak?: number; parent?: PeakWindow; gapKB?: number; gapMs?: number }
85
87
 
86
88
  /** A host that cannot report its peak must not turn a read into a failure, so a throwing read is `undefined`. */
87
89
  const peekOnce = (read: () => number | undefined): number | undefined => { try { return read(); } catch { return undefined; } };
@@ -94,34 +96,60 @@ const peekOnce = (read: () => number | undefined): number | undefined => { try {
94
96
  */
95
97
  export function createPeakTracker(read: () => number | undefined = processPeakRssKB) {
96
98
  const windows = new Set<PeakWindow>();
97
- let observed = peekOnce(read);
99
+ let observed = peekOnce(read), idleSince = performance.now();
98
100
  const peek = () => peekOnce(read);
99
101
  const advance = (peakKB: number) => { observed = observed === undefined ? peakKB : Math.max(observed, peakKB); };
100
102
  return {
101
- begin(): PeakWindow {
102
- const window: PeakWindow = { alone: windows.size === 0 };
103
- for (const other of windows) other.alone = false;
103
+ begin(parent?: PeakWindow): PeakWindow {
104
+ let gapKB: number | undefined;
105
+ if (windows.size === 0) { const current = peek(); if (current !== undefined) { if (observed !== undefined && current > observed) gapKB = current; advance(current); } }
106
+ const startPeak = windows.size === 0 ? observed : peek();
107
+ const window: PeakWindow = { alone: parent ? parent.alone && windows.size === 1 && windows.has(parent) : windows.size === 0, ...(startPeak === undefined ? {} : { startPeak }), ...(parent ? { parent } : {}), ...(gapKB === undefined ? {} : { gapKB, gapMs: Math.max(0, performance.now() - idleSince) }) };
108
+ for (const other of windows) if (other !== parent) other.alone = false;
104
109
  windows.add(window);
105
110
  return window;
106
111
  },
107
112
  /** The call completed: report whether it may be credited with the peak, and the peak to record with its sample. */
108
- end(window: PeakWindow): { peakKB?: number; raised: boolean } {
113
+ end(window: PeakWindow): { peakKB?: number; raised: boolean; shared?: true } {
109
114
  windows.delete(window);
115
+ if (windows.size === 0) idleSince = performance.now();
110
116
  const peakKB = peek();
111
117
  if (peakKB === undefined) return { raised: false };
112
- const raised = window.alone && (observed === undefined || peakKB > observed);
118
+ const raised = window.alone && observed !== undefined && peakKB > observed;
119
+ const shared = !window.alone && window.startPeak !== undefined && peakKB > window.startPeak;
120
+ if (raised && window.parent) window.parent.alone = false;
113
121
  advance(peakKB);
114
- return { peakKB, raised };
122
+ return { peakKB, raised, ...(shared ? { shared: true as const } : {}) };
115
123
  },
116
124
  /** The call refused or threw: it records nothing, but the peak still advances so a later call is not miscredited. */
117
125
  abort(window: PeakWindow): void {
118
126
  windows.delete(window);
127
+ if (windows.size === 0) idleSince = performance.now();
119
128
  const peakKB = peek();
120
129
  if (peakKB !== undefined) advance(peakKB);
121
130
  },
122
131
  };
123
132
  }
124
133
 
134
+ export type McpPhaseName = "startup" | "idle-gap" | "preload" | "construct" | "on-emitted" | "recall-prepare" | "amem_work_state_read" | "amem_work_state_write" | "amem_remember" | "amem_correct" | "amem_capacity" | `failed:${"amem_search" | "amem_evidence" | "amem_show" | "amem_timeline" | "amem_graph" | "amem_brief" | "amem_vault_candidates"}`;
135
+ export const MCP_PHASE_NAMES: readonly McpPhaseName[] = ["startup", "idle-gap", "preload", "construct", "on-emitted", "recall-prepare", "amem_work_state_read", "amem_work_state_write", "amem_remember", "amem_correct", "amem_capacity", "failed:amem_search", "failed:amem_evidence", "failed:amem_show", "failed:amem_timeline", "failed:amem_graph", "failed:amem_brief", "failed:amem_vault_candidates"];
136
+ export type PeakTracker = ReturnType<typeof createPeakTracker>;
137
+ /** A lifetime peak that rose between instrumented windows cannot be assigned to a tool. */
138
+ export function recordMcpGap(base: string, peakKB: number, wallMs: number): void {
139
+ try { appendMetricsLater(base, [{ at: new Date().toISOString(), kind: "mcp-phase", tool: "idle-gap", wallMs, rssMB: peakKB / 1024, peakRaised: false }]); } catch { /* observational only */ }
140
+ }
141
+ /** Fixed phase labels and asynchronous handoff only; never retain call input or result. */
142
+ export function observeMcpPhase(base: string, peaks: PeakTracker, name: McpPhaseName, parent?: PeakWindow): () => void {
143
+ const started = performance.now(); let window: PeakWindow | undefined;
144
+ try { window = peaks.begin(parent); if (window.gapKB !== undefined) recordMcpGap(base, window.gapKB, window.gapMs ?? 0); } catch { /* observational only */ }
145
+ return () => {
146
+ try {
147
+ if (!window) return;
148
+ const ended = peaks.end(window); window = undefined;
149
+ if (ended.peakKB !== undefined && (ended.raised || ended.shared)) appendMetricsLater(base, [{ at: new Date().toISOString(), kind: "mcp-phase", tool: name, wallMs: performance.now() - started, rssMB: ended.peakKB / 1024, peakRaised: ended.raised, ...(ended.shared ? { shared: true } : {}) }]);
150
+ } catch { /* observational only */ }
151
+ };
152
+ }
125
153
  export function metricsPath(base: string): string {
126
154
  return join(base, "metrics.jsonl");
127
155
  }
@@ -135,13 +163,22 @@ export function metricsPath(base: string): string {
135
163
  let trimGeneration = 0;
136
164
  /** The kept text of a trim: torn lines dropped, the newest METRICS_KEEP of each kind kept, oldest first. */
137
165
  function trimmedText(text: string): string {
138
- const rows: { line: string; kind: string }[] = [];
166
+ const rows: { line: string; kind: string; index: number; bytes: number }[] = [];
139
167
  for (const line of text.split("\n")) {
140
168
  if (!line) continue;
141
- // A line the read caught mid-append is dropped, never copied into the replacement.
142
- try { const kind = (JSON.parse(line) as { kind?: unknown }).kind; rows.push({ line, kind: typeof kind === "string" ? kind : "other" }); } catch { /* torn tail */ }
169
+ try { const kind = (JSON.parse(line) as { kind?: unknown }).kind; rows.push({ line, kind: typeof kind === "string" ? kind : "other", index: rows.length, bytes: Buffer.byteLength(line) + 1 }); } catch { /* torn tail */ }
143
170
  }
144
- return newestPerKind(rows, METRICS_KEEP, row => row.kind).map(row => row.line).join("\n") + "\n";
171
+ const selected = newestPerKind(rows, METRICS_KEEP, row => row.kind);
172
+ const bounded = (items: typeof rows, cap: number) => {
173
+ const kept: typeof rows = []; let bytes = 0;
174
+ for (let i = items.length - 1; i >= 0; i--) { const row = items[i]!; if (bytes + row.bytes <= cap) { kept.push(row); bytes += row.bytes; } }
175
+ return kept;
176
+ };
177
+ return [...bounded(selected.filter(row => row.kind === "hook"), HOOK_BYTES),
178
+ ...bounded(selected.filter(row => row.kind === "search"), SEARCH_BYTES),
179
+ ...bounded(selected.filter(row => row.kind === "mcp-phase"), PHASE_BYTES),
180
+ ...bounded(selected.filter(row => row.kind !== "hook" && row.kind !== "search" && row.kind !== "mcp-phase"), OTHER_BYTES)]
181
+ .sort((a, b) => a.index - b.index).map(row => row.line + "\n").join("");
145
182
  }
146
183
 
147
184
  function trimMetrics(file: string): void {
@@ -163,10 +200,14 @@ function trimMetrics(file: string): void {
163
200
  * is refused before a byte is written. One worker drains the hand-offs in call order, so the file keeps the order the
164
201
  * calls completed in; a sample still in flight when the process exits is simply lost.
165
202
  */
166
- const pending: { base: string; samples: MetricSample[] }[] = [];
167
- let draining = false;
203
+ const pending: { base: string; samples: MetricSample[]; phase: boolean }[] = [];
204
+ let draining = false, pendingPhases = 0;
168
205
  export function appendMetricsLater(base: string, samples: MetricSample[]): void {
169
- pending.push({ base, samples });
206
+ const phase = samples.length > 0 && samples.every(sample => sample.kind === "mcp-phase");
207
+ // ponytail: at most 32 outstanding phase writes; a bounded worker queue with per-kind fairness is the upgrade.
208
+ if (phase && pendingPhases >= MCP_PHASE_KEEP) return;
209
+ if (phase) pendingPhases++;
210
+ pending.push({ base, samples, phase });
170
211
  if (draining) return;
171
212
  draining = true;
172
213
  setImmediate(() => { void drainPending(); });
@@ -176,6 +217,7 @@ async function drainPending(): Promise<void> {
176
217
  while (pending.length) {
177
218
  const next = pending.shift()!;
178
219
  try { await writeSamplesLater(next.base, next.samples); } catch { /* a lost sample is never a failed call */ }
220
+ finally { if (next.phase) pendingPhases--; }
179
221
  }
180
222
  draining = false;
181
223
  }
@@ -219,7 +261,7 @@ export function readMetrics(base: string, limit = METRICS_KEEP): MetricSample[]
219
261
  if (!line) continue;
220
262
  try {
221
263
  const s = JSON.parse(line) as MetricSample;
222
- if ((s?.kind === "hook" || s?.kind === "search") && typeof s.at === "string") parsed.push(s);
264
+ if ((s?.kind === "hook" || s?.kind === "search" || s?.kind === "mcp-phase") && typeof s.at === "string") parsed.push(s);
223
265
  } catch { /* a malformed line is skipped */ }
224
266
  }
225
267
  return newestPerKind(parsed, limit, sample => sample.kind);
@@ -270,15 +312,17 @@ export function readCaptureDrops(base: string): { readable: true; counts: Partia
270
312
  const length = readSync(fd, bytes, 0, bytes.length, start);
271
313
  let text = new TextDecoder("utf-8", { fatal: true }).decode(bytes.subarray(0, length));
272
314
  if (start) text = text.slice(text.indexOf("\n") + 1);
273
- const tail = text.split("\n").filter(line => line.trim() !== "").slice(-METRICS_KEEP);
315
+ const tail = text.split("\n").filter(line => line.trim() !== "");
274
316
  lines = tail.length;
317
+ const hooks: MetricSample[] = [];
275
318
  for (const line of tail) {
276
- try {
277
- const sample = JSON.parse(line) as MetricSample;
278
- if (sample.kind !== "hook" || !DROP_REASONS.includes(sample.captureDropReason!) || !Number.isSafeInteger(sample.captureDrops) || sample.captureDrops! <= 0) continue;
279
- const reason = sample.captureDropReason!;
280
- counts[reason] = (counts[reason] ?? 0) + sample.captureDrops!;
281
- } catch { malformedLines++; /* A malformed metric is never a notice; doctor reports how many were skipped. */ }
319
+ try { const sample = JSON.parse(line) as MetricSample; if (sample.kind === "hook") hooks.push(sample); }
320
+ catch { malformedLines++; /* A malformed metric is never a notice; doctor reports how many were skipped. */ }
321
+ }
322
+ for (const sample of hooks.slice(-METRICS_KEEP)) {
323
+ if (!DROP_REASONS.includes(sample.captureDropReason!) || !Number.isSafeInteger(sample.captureDrops) || sample.captureDrops! <= 0) continue;
324
+ const reason = sample.captureDropReason!;
325
+ counts[reason] = (counts[reason] ?? 0) + sample.captureDrops!;
282
326
  }
283
327
  } catch { return { readable: false, reason: "metrics.jsonl cannot be read or is not UTF-8" }; }
284
328
  finally { if (fd !== undefined) closeSync(fd); }
@@ -4,11 +4,11 @@ import { join } from "node:path";
4
4
  import { realPath } from "./platform.ts";
5
5
 
6
6
  const messages={
7
- shards:"An interrupted or still-running person shard migration retains profile.lock; have the person finish it or run amem migrate --shards --resume.",
8
- prune:"An interrupted or still-running person public-prune view migration retains profile.lock; have the person finish it or run amem migrate --public-prune-view --resume.",
9
- activation:"An interrupted or still-running person sync-placement activation retains profile.lock; have the person run amem migrate --sync-placement --resume, or amem migrate --sync-placement --abandon only while both markers retain their original v2 bytes.",
10
- renewal:"An interrupted or still-running person writer-inventory renewal retains profile.lock; have the person run amem migrate --sync-placement --resume, or amem migrate --sync-placement --abandon only before the first commit-log byte.",
11
- staging:"An interrupted or still-running person writer-inventory renewal retains profile.lock and unpublished intent staging; have the person run amem migrate --sync-placement --abandon, then amem migrate --sync-placement --dry-run before another apply.",
7
+ shards:"An interrupted or still-running shard migration retains profile.lock; wait for it to finish or run amem migrate --shards --resume.",
8
+ prune:"An interrupted or still-running public-prune view migration retains profile.lock; wait for it to finish or run amem migrate --public-prune-view --resume.",
9
+ activation:"An interrupted or still-running sync-placement activation retains profile.lock; run amem migrate --sync-placement --resume, or amem migrate --sync-placement --abandon only while both markers retain their original v2 bytes.",
10
+ renewal:"An interrupted or still-running writer-inventory renewal retains profile.lock; run amem migrate --sync-placement --resume, or amem migrate --sync-placement --abandon only before the first commit-log byte.",
11
+ staging:"An interrupted or still-running writer-inventory renewal retains profile.lock and unpublished intent staging; run amem migrate --sync-placement --abandon, then amem migrate --sync-placement --dry-run before another apply.",
12
12
  } as const;
13
13
  type Family=keyof typeof messages;
14
14
  const recognised=new WeakMap<object,string>();
@@ -25,20 +25,36 @@ export interface ShardHistoryAuditorOptions {
25
25
  * Body bytes, without the Git object header; the auditor verifies each requested identity itself. */
26
26
  object?(oid: string, type: "commit" | "tree"): Promise<Buffer>;
27
27
  }
28
- export type ShardHistoryCause = "unavailable" | "blob" | "forbidden-entry" | "public-prune-floor";
28
+ export type ShardHistoryCause = "unavailable" | "blob" | "bound" | "forbidden-entry" | "public-prune-floor";
29
29
  const refusals: Record<ShardHistoryCause, string> = {
30
30
  unavailable: "Shard history is unavailable, inconsistent or unsupported; retain and inspect the complete selected history before continuing.",
31
31
  blob: "Shard history blob is unavailable or its identity, bound or complete newline is invalid; retain and inspect the selected history before continuing.",
32
+ bound: "Shard history inspection exceeded its retained-history bound; retain the history and do not abandon it: a later window needs the multi-plan checkpoint work (#288).",
32
33
  "forbidden-entry": "Shard history contains a forbidden historical tree entry; retain and inspect the selected history before continuing.",
33
34
  "public-prune-floor": "Shard history requires the v2 public prune floor; activate compatible public-prune support before continuing.",
34
35
  };
36
+ export interface ShardHistoryBound { kind: string; limit: number; observed: number }
35
37
  export class ShardHistoryError extends Error {
36
38
  readonly code: ShardHistoryCause;
37
- constructor(code: ShardHistoryCause = "unavailable") {
39
+ /** #567: only for code `bound`, copied as counts from the source's own data fields; never a path or object id. */
40
+ readonly bound?: ShardHistoryBound;
41
+ constructor(code: ShardHistoryCause = "unavailable", bound?: ShardHistoryBound) {
38
42
  const safe = typeof code === "string" && Object.hasOwn(refusals, code) ? code : "unavailable";
39
43
  super(refusals[safe]); this.code = safe; this.name = "ShardHistoryError";
44
+ if (safe === "bound" && bound) this.bound = bound;
40
45
  }
41
46
  }
47
+ /** A source throw keeps `bound` only when its own data `code` says so; its kind/limit/observed survive only as finite counts. */
48
+ function sourceBound(error: unknown): ShardHistoryBound | undefined | false {
49
+ try {
50
+ if (!error || typeof error !== "object" || types.isProxy(error)) return false;
51
+ const own = (key: string) => { const d = Object.getOwnPropertyDescriptor(error, key); return d && "value" in d ? d.value as unknown : undefined; };
52
+ if (own("code") !== "bound") return false;
53
+ const kind = own("kind"), limit = own("limit"), observed = own("observed");
54
+ return typeof kind === "string" && /^[a-z-]{1,32}$/.test(kind) && Number.isSafeInteger(limit) && Number.isSafeInteger(observed)
55
+ ? { kind, limit: limit as number, observed: observed as number } : undefined;
56
+ } catch { return false; }
57
+ }
42
58
  function cause(error: unknown): ShardHistoryCause {
43
59
  try {
44
60
  if (!error || typeof error !== "object" || types.isProxy(error) || !(error instanceof ShardHistoryError)) return "unavailable";
@@ -83,18 +99,23 @@ export class ShardHistoryAuditor {
83
99
  const maximum = path === "shard.json" || isShardManifestPath(path) ? 64 * 1024 : SHARD_PACK_MAX_BYTES;
84
100
  let bytes = this.#blobs.get(object);
85
101
  if (!bytes) {
86
- const result = await this.#options.blob(object, path);
102
+ let result: Uint8Array;
103
+ try { result = await this.#options.blob(object, path); }
104
+ catch (error) { const bound = sourceBound(error); if (bound !== false) throw new ShardHistoryError("bound", bound); throw error; }
87
105
  if (!(result instanceof Uint8Array)) fail("blob"); bytes = Buffer.from(result);
88
106
  if (bytes.length < 1 || bytes.length > maximum || bytes.at(-1) !== 10
89
107
  || createHash("sha1").update(`blob ${bytes.length}\0`).update(bytes).digest("hex") !== object) fail("blob");
90
108
  this.#blobs.set(object, bytes);
91
109
  }
92
110
  if (bytes.length > maximum) fail("blob"); return bytes;
93
- } catch { return fail("blob"); }
111
+ } catch (error) { if (error instanceof ShardHistoryError && error.code === "bound") throw error; return fail("blob"); }
94
112
  }
95
113
  async #object(object: string, type: "commit" | "tree"): Promise<Buffer> {
96
114
  if (!this.#options.object || !oid(object)) return fail();
97
- const body = await this.#options.object(object, type);
115
+ let body: Uint8Array;
116
+ // #567: a source bound on a commit or tree read keeps cause bound with its counts, like a blob read.
117
+ try { body = await this.#options.object(object, type); }
118
+ catch (error) { const bound = sourceBound(error); if (bound !== false) throw new ShardHistoryError("bound", bound); throw error; }
98
119
  if (!(body instanceof Uint8Array) || body.length > (type === "commit" ? 65536 : SHARD_PACK_MAX_BYTES)) return fail();
99
120
  const bytes = Buffer.from(body);
100
121
  if (createHash("sha1").update(`${type} ${bytes.length}\0`).update(bytes).digest("hex") !== object) return fail();
@@ -242,7 +263,7 @@ export class ShardHistoryAuditor {
242
263
  }
243
264
  if (!latest || lines.at(-1)?.split(" ")[0] !== tip) return fail();
244
265
  this.#histories.set(tip, latest); return detached(latest);
245
- } catch (error) { return fail(cause(error)); }
266
+ } catch (error) { const code = cause(error); if (code === "bound" && error instanceof ShardHistoryError && error.bound) throw new ShardHistoryError("bound", { ...error.bound }); return fail(code); }
246
267
  finally { this.#running = false; }
247
268
  }
248
269
  }
@@ -174,7 +174,7 @@ function realmGapRemedy(gap: PlacementRealmGap | undefined): string {
174
174
  case "capture-only": return `class=capture-only; it holds capture rows and no curated memory, so capture stays readable; ${admit} if you want curated memory for it`;
175
175
  case "no-memory": return `class=no-memory; it holds no captured rows and no curated notes yet; ${admit} if you want curated memory for it, or remove it with amem project archive <project>`;
176
176
  case "curated-unadmitted": return `class=curated-unadmitted; it holds curated notes that are not part of the activated inventory, and ${admit} opens them`;
177
- case "unverified": return "class=unverified; neither its curated state nor the activated inventory could be verified safely; have the person inspect the home before changing anything";
177
+ case "unverified": return "class=unverified; neither its curated state nor the activated inventory could be verified safely; inspect the home before changing anything";
178
178
  default: return admit;
179
179
  }
180
180
  }
@@ -44,7 +44,7 @@ export class PlacementActivationError extends Error {
44
44
  }
45
45
  export class PlacementActivationInputError extends Error {
46
46
  constructor(readonly inputClass:"policy"|"source"|"aliases"|"writer root"|"receipt"|"floor"){
47
- super(`Sync placement activation frozen ${inputClass} input changed or is unavailable; restore that input and run amem migrate --sync-placement --resume. If both markers still contain their original v2 bytes, the person may run amem migrate --sync-placement --abandon, then review a fresh --dry-run and --apply. Once any v3 marker exists, only forward resume is supported.`);
47
+ super(`Sync placement activation frozen ${inputClass} input changed or is unavailable; restore that input and run amem migrate --sync-placement --resume. If both markers still contain their original v2 bytes, run amem migrate --sync-placement --abandon, then review a fresh --dry-run and --apply. Once any v3 marker exists, only forward resume is supported.`);
48
48
  this.name="PlacementActivationInputError";
49
49
  }
50
50
  }
@@ -128,7 +128,7 @@ export async function activateSyncPlacement(options:PlacementActivationOptions)
128
128
  const active=initialBase.active,dirs=active.activation.realms.map(realm=>realm.scope==="user"?join(home,"user"):join(home,"projects",realm.keyHash.slice(0,16)));
129
129
  return withPlacementActivationFences(home,dirs,(mutation,owner)=>finishCommittedActivation(home,{epoch:active.epoch,plan:active.activation},options,mutation,owner)).catch(error=>rethrowActivationFailure(error));
130
130
  }
131
- if(pending&&options.mode!=="resume")throw Error("Sync placement activation is retained; run amem migrate --sync-placement --resume, or person --abandon while both markers retain the original v2 bytes, before reviewing a new --dry-run.");
131
+ if(pending&&options.mode!=="resume")throw Error("Sync placement activation is retained; run amem migrate --sync-placement --resume, or --abandon while both markers retain the original v2 bytes, before reviewing a new --dry-run.");
132
132
  const source=pending?undefined:previewSyncPlacementSources(home);
133
133
  const writer=pending?undefined:initialPlacementWriterContext(home,options.writerRoots,options.ownRoot);
134
134
  const report=source?counts(source):undefined;
@@ -18,7 +18,7 @@ const phases: Record<PlacementSyncBoundPhase, string> = { "source-capture": "sou
18
18
  export function placementSyncBoundMessage(bound: PlacementSyncBound): string {
19
19
  // #288 step 3: a full live window is relieved by a person-reviewed checkpoint; records stay a reported bound.
20
20
  const remedy = bound.kind === "journal-objects"
21
- ? "The active epoch journal cannot hold this publication; have the person preview a checkpoint with amem migrate --sync-placement --checkpoint --writer-root <install root> (repeat for every install), then confirm it and rerun amem sync."
21
+ ? "The active epoch journal cannot hold this publication; preview a checkpoint with amem migrate --sync-placement --checkpoint --writer-root <install root> (repeat for every install), then confirm it after the exact command is approved and rerun amem sync."
22
22
  : bound.kind === "journal-records"
23
23
  ? "The active epoch journal cannot hold this publication; retain the inputs and report this bound."
24
24
  : "Retain the inputs and report this bound; no row was omitted to fit.";
@@ -26,13 +26,14 @@ import { assertPlacementActivationOwner } from "./sync-placement-activation-proo
26
26
  import { placementFenceDirectories } from "./sync-placement-writer-renewal.ts";
27
27
  import { initialPlacementWriterContext } from "../sync-placement-writer-context.ts";
28
28
  import { checkpointProspective, type CheckpointProspective } from "./sync-placement-checkpoint-prospective.ts";
29
+ import { ShardHistoryError, type ShardHistoryCause } from "./shard-sync-history.ts";
29
30
 
30
31
  export const CHECKPOINT_PREVIEW = PLACEMENT_CHECKPOINT_COMMAND;
31
32
  const RESUME = `${CHECKPOINT_PREVIEW} --resume`, ABANDON = `${CHECKPOINT_PREVIEW} --abandon`;
32
33
  const homeFloorAtLeast = (home: string, minimum: string): boolean =>
33
34
  (readFormatFloors(home) ?? []).some(floor => floor.surface === "home" && !formatVersionBelow(floor.minReader, minimum));
34
35
 
35
- export type PlacementCheckpointCause = "pending" | "commit-started" | "floor" | "writer-below-floor" | "headroom" | "obligation" | "changed" | "inactive" | "candidate";
36
+ export type PlacementCheckpointCause = "pending" | "commit-started" | "floor" | "writer-below-floor" | "headroom" | "obligation" | "changed" | "inactive" | "candidate" | "history";
36
37
  const MESSAGES: Record<PlacementCheckpointCause, string> = {
37
38
  pending: PLACEMENT_CHECKPOINT_PENDING_MESSAGE,
38
39
  "commit-started": `The placement checkpoint's commit line has started, so it can no longer be abandoned; run ${RESUME} to complete it.`,
@@ -43,13 +44,34 @@ const MESSAGES: Record<PlacementCheckpointCause, string> = {
43
44
  changed: `The placement state changed since the checkpoint plan was sealed; preview a fresh plan with ${CHECKPOINT_PREVIEW} and confirm that one.`,
44
45
  inactive: "This home has no active sync placement; activate it with amem migrate --sync-placement --dry-run first.",
45
46
  candidate: `A checkpoint carries one writer renewal: pass the complete inventory as repeatable --writer-root <install root> (every amem install sharing this home), then preview again with ${CHECKPOINT_PREVIEW}.`,
47
+ history: "",
46
48
  };
49
+ /** #567: the retained-history cause class and, for `bound`, which bound with its counts. Never a path, row or object id. */
50
+ export interface PlacementCheckpointHistoryRefusal { category: "shard history"; cause: ShardHistoryCause; kind?: string; limit?: number; observed?: number }
51
+ function historyMessage(refusal: PlacementCheckpointHistoryRefusal): string {
52
+ const exceeded = refusal.cause === "bound" && refusal.kind !== undefined ? ` (${refusal.kind}: ${refusal.observed} over the limit of ${refusal.limit})` : "";
53
+ const next = refusal.cause === "bound"
54
+ ? "Retain the history and do not abandon or edit it; a window this large needs the multi-plan checkpoint work in #288. Nothing was written."
55
+ : `Retain the selected history and inspect it with a compatible runtime, then preview again with ${CHECKPOINT_PREVIEW}. Nothing was written.`;
56
+ return `The checkpoint could not inspect retained shard history: shard history ${refusal.cause}${exceeded}. ${next}`;
57
+ }
47
58
  /** A person-facing checkpoint refusal with one cause class and its next step; never a path, row or project name. */
48
59
  export class PlacementCheckpointError extends Error {
49
- constructor(readonly causeClass: PlacementCheckpointCause, detail = "") {
50
- super(causeClass === "headroom" ? `The checkpoint would not leave room for the next sync: ${detail} A single checkpoint cannot unblock this plan; the deferred multi-plan split in #288 design item 5 is the open path. Nothing was written.` : MESSAGES[causeClass] + (detail ? ` ${detail}` : ""));
60
+ readonly history?: PlacementCheckpointHistoryRefusal;
61
+ constructor(readonly causeClass: PlacementCheckpointCause, detail = "", history?: PlacementCheckpointHistoryRefusal) {
62
+ super(causeClass === "headroom" ? `The checkpoint would not leave room for the next sync: ${detail} A single checkpoint cannot unblock this plan; the deferred multi-plan split in #288 design item 5 is the open path. Nothing was written.`
63
+ : causeClass === "history" && history ? historyMessage(history) : MESSAGES[causeClass] + (detail ? ` ${detail}` : ""));
51
64
  this.name = "PlacementCheckpointError";
65
+ if (causeClass === "history" && history) this.history = history;
66
+ }
67
+ }
68
+ /** Maps only this module's closed ShardHistoryError data to the checkpoint's history cause; anything else is rethrown. */
69
+ function historyRefusal(error: unknown): never {
70
+ if (error instanceof ShardHistoryError) {
71
+ const code = Object.getOwnPropertyDescriptor(error, "code")?.value as ShardHistoryCause, bound = code === "bound" ? error.bound : undefined;
72
+ throw new PlacementCheckpointError("history", "", { category: "shard history", cause: code, ...(bound ? { kind: bound.kind, limit: bound.limit, observed: bound.observed } : {}) });
52
73
  }
74
+ throw error;
53
75
  }
54
76
 
55
77
  function active(home: string): ActivePlacementBinding {
@@ -105,7 +127,7 @@ export async function previewPlacementCheckpoint(homeInput: string, opts: { writ
105
127
  nextStep: `${CHECKPOINT_PREVIEW} --confirm --plan <saved preview JSON> --writer-root <install root> (repeat for every install)` };
106
128
  }
107
129
  async function checkpointHeadroom(home: string, intent: CheckpointIntent): Promise<{ headroom: PlacementCheckpointHeadroom; journalObjects: PlacementJournalObjectComposition; assertCurrent(): void }> {
108
- const epochHash = intent.epochHash, prospective = await checkpointProspective(home);
130
+ const epochHash = intent.epochHash, prospective = await checkpointProspective(home).catch(historyRefusal);
109
131
  let completed = { slots: 0, reservedJournalChunks: 0 }, journalObjects!: PlacementJournalObjectComposition;
110
132
  readPlacementPublicationMetadata(home, epochHash, io => {
111
133
  journalObjects = placementJournalObjectComposition({ names: io.names() });
@@ -8,7 +8,8 @@ import { readActivePlacementBinding } from "./sync-placement-active.ts";
8
8
  import { readPlacementRuntimeMarkers } from "./sync-placement-guard.ts";
9
9
  import { previewSelectedSyncPlacementSources } from "./sync-placement-capture.ts";
10
10
  import { placementInventory, placementInventoryBatches, type InventoryRealm } from "./sync-placement-inventory.ts";
11
- import { captureInspectionJournal, inspectRetainedPublicationHistories, PlacementInspectionObjects } from "./sync-placement-inspection-evidence.ts";
11
+ import { captureInspectionJournal, inspectRetainedPublicationHistories, PlacementHistoryBoundError, PlacementInspectionObjects } from "./sync-placement-inspection-evidence.ts";
12
+ import { ShardHistoryError } from "./shard-sync-history.ts";
12
13
  import { createPlacementRecord, SyncPlacementJournalError, PLACEMENT_JOURNAL_CHUNK_MAX_BYTES, type PlacementRealm } from "./sync-placement-journal-format.ts";
13
14
  import { materializePlacementRows, verifiedPlacementPrunes } from "./sync-placement-materialize.ts";
14
15
  import { planPlacementPublicationAsync, publicationBytes, publicationFileNames } from "./sync-placement-publication-plan.ts";
@@ -83,6 +84,9 @@ export async function checkpointProspective(home: string): Promise<{ value: Chec
83
84
  let histories: Awaited<ReturnType<typeof inspectRetainedPublicationHistories>>;
84
85
  try { histories = await inspectRetainedPublicationHistories(journal, targets.map(target => ({ realm: target.realm, generation: active.profile.generation })), objects); }
85
86
  catch (error) {
87
+ // #567: a retained-history bound reached directly (tree, retained object, row count) is a named refusal with its
88
+ // counts, never the cache-unavailable fallback that would hide it behind a smaller-looking plan.
89
+ if (error instanceof PlacementHistoryBoundError) throw new ShardHistoryError("bound", { kind: error.kind, limit: error.limit, observed: error.observed });
86
90
  if (error instanceof SyncPlacementJournalError && (error.code === "corrupt" || error.code === "bound"))
87
91
  return { value: { state: "unavailable", reason: "cache-or-remote-evidence-unavailable" },
88
92
  assertCurrent: () => { checkInventory(); source.assertSourcesUnchanged(); journal.assertCurrent(); } };
@@ -60,7 +60,7 @@ export function doctorScratchInventory(home: string): EffectiveRealmInventory |
60
60
 
61
61
  export const PLACEMENT_STAGE1_REFUSAL = "sync placement v3 requires matching durable activation metadata; keep the current compatible profile active until person-authorized activation is complete";
62
62
  export const PLACEMENT_MARKER_REFUSAL = "sync placement metadata is invalid or unsupported; person inspection and a compatible reader are required before continuing";
63
- export const PLACEMENT_ACTIVATION_PENDING = "sync placement activation is pending or incomplete; have the person inspect retained evidence and run amem migrate --sync-placement --resume, or --abandon only while both markers retain their original v2 bytes";
63
+ export const PLACEMENT_ACTIVATION_PENDING = "sync placement activation is pending or incomplete; inspect retained evidence and run amem migrate --sync-placement --resume, or --abandon only while both markers retain their original v2 bytes";
64
64
  export class SyncPlacementRuntimeError extends Error {
65
65
  readonly code: "sync_placement_not_enabled" | "sync_placement_unavailable";
66
66
  constructor(reason: string) { super(reason); this.name = "SyncPlacementRuntimeError"; this.code = reason === PLACEMENT_STAGE1_REFUSAL ? "sync_placement_not_enabled" : "sync_placement_unavailable";rememberProfileLockError(this,reason); }
@@ -79,7 +79,7 @@ export async function inspectRetainedPublicationHistories(snapshot: InspectionJo
79
79
  if (!tip) continue;
80
80
  if (planned.refHash !== hash(shardSyncRef(target.realm))) unavailable();
81
81
  const auditor = objects.auditor(target.realm, target.generation), history = await auditor.history(tip);
82
- if (history.rows.size > SYNC_SCREEN_MAX_ROWS) bound();
82
+ if (history.rows.size > SYNC_SCREEN_MAX_ROWS) historyBound("history-rows", SYNC_SCREEN_MAX_ROWS, history.rows.size);
83
83
  const membership = [...history.rows.values()].map(row => ({ id: row.id, rowHash: hashJSON(row) })).sort((a, b) => a.id.localeCompare(b.id));
84
84
  if (hashJSON(membership) !== planned.exportSetHash || hash(history.files.get("shard.json") ?? Buffer.alloc(0)) !== planned.descriptorHash
85
85
  || planned.tree !== objects.tree(tip)) unavailable();
@@ -123,6 +123,12 @@ export async function inspectRetainedPublicationHistories(snapshot: InspectionJo
123
123
 
124
124
  function unavailable(): never { throw new SyncPlacementJournalError("corrupt"); }
125
125
  function bound(): never { throw new SyncPlacementJournalError("bound"); }
126
+ export type PlacementHistoryBoundKind = "graph-bytes" | "graph-objects" | "object-bytes" | "history-rows";
127
+ /** #567: still code `bound` for every existing catch; adds which retained-history bound was exceeded, as counts only. */
128
+ export class PlacementHistoryBoundError extends SyncPlacementJournalError {
129
+ constructor(readonly kind: PlacementHistoryBoundKind, readonly limit: number, readonly observed: number) { super("bound"); }
130
+ }
131
+ function historyBound(kind: PlacementHistoryBoundKind, limit: number, observed: number): never { throw new PlacementHistoryBoundError(kind, limit, observed); }
126
132
  const hash = (bytes: string | Uint8Array) => createHash("sha256").update(bytes).digest("hex");
127
133
  const oid = (value: string) => /^[a-f0-9]{40}$/.test(value);
128
134
  const forbidden = ["commondir", "shallow", "info/grafts", "objects/info/alternates", "objects/info/http-alternates", "config.worktree"];
@@ -171,7 +177,6 @@ export class PlacementInspectionObjects {
171
177
  private readonly check: () => void;
172
178
  private bytes = 0;
173
179
  private sourceRows = 0;
174
- private sourceBytes = 0;
175
180
  private readonly sourcePacks = new Set<string>();
176
181
  private readonly objects = new Map<string, { type: string; bytes: Buffer }>();
177
182
  constructor(home: string, check: () => void) {
@@ -220,16 +225,22 @@ export class PlacementInspectionObjects {
220
225
  // Larger retained histories need a reviewed immutable digest inventory; physical row-pack limits stay separate.
221
226
  if (!oid(object)) unavailable();
222
227
  const prior = this.objects.get(object); if (prior) { if (prior.type !== type || prior.bytes.length > maximum) unavailable(); return Buffer.from(prior.bytes); }
223
- if (this.objects.size >= SYNC_SCREEN_MAX_ROWS) bound();
228
+ if (this.objects.size >= SYNC_SCREEN_MAX_ROWS) historyBound("graph-objects", SYNC_SCREEN_MAX_ROWS, this.objects.size + 1);
224
229
  if (this.text(["cat-file", "-t", object]) !== type) unavailable();
225
230
  const size = Number(this.text(["cat-file", "-s", object]));
226
- if (!Number.isSafeInteger(size) || size < 0 || size > maximum || this.bytes + size > PUBLIC_PRUNE_GRAPH_MAX_BYTES) bound();
231
+ if (!Number.isSafeInteger(size) || size < 0) bound();
232
+ if (size > maximum) historyBound("object-bytes", maximum, size);
233
+ if (this.bytes + size > PUBLIC_PRUNE_GRAPH_MAX_BYTES) historyBound("graph-bytes", PUBLIC_PRUNE_GRAPH_MAX_BYTES, this.bytes + size);
227
234
  const result = this.run(["cat-file", type, object], Math.max(1, maximum));
228
235
  if (result.code !== 0 || result.bytes.length !== size || createHash("sha1").update(`${type} ${size}\0`).update(result.bytes).digest("hex") !== object) unavailable();
229
236
  this.bytes += size; this.objects.set(object, { type, bytes: result.bytes }); return Buffer.from(result.bytes);
230
237
  }
231
238
  auditor(realm: ShardSyncRealm, generation: string): ShardHistoryAuditor {
232
239
  // The byte cache is shared and bounded. Do not retain a full decoded body map for every historical receipt.
240
+ // #567: retained-history inspection is bounded by object() (80 MiB graph bytes, 20000 objects) plus the cumulative
241
+ // row count below, never by the 8 MiB sync-screen byte envelope: that envelope bounds what sync publishes, and a
242
+ // full window's already-published packs routinely exceed it, which deadlocked the checkpoint meant to relieve it.
243
+ // ponytail: the 80 MiB graph bound is the ceiling; past it, a reviewed immutable digest inventory replaces the cache.
233
244
  return new ShardHistoryAuditor({ realm, generation, placement: true, publicPrune: true, git: async args => this.text(args),
234
245
  object: async (id, type) => this.object(id, type, type === "commit" ? 65536 : SHARD_PACK_MAX_BYTES),
235
246
  blob: async (id, path) => {
@@ -237,8 +248,8 @@ export class PlacementInspectionObjects {
237
248
  const physical = canonicalJSON([realm, id]);
238
249
  if (path.startsWith("rows/") && !this.sourcePacks.has(physical)) {
239
250
  let lines = 0; for (const byte of bytes) if (byte === 10) lines++;
240
- if (this.sourceRows + lines > SYNC_SCREEN_MAX_ROWS || this.sourceBytes + bytes.length > SYNC_SCREEN_MAX_BYTES) bound();
241
- this.sourceRows += lines; this.sourceBytes += bytes.length; this.sourcePacks.add(physical);
251
+ if (this.sourceRows + lines > SYNC_SCREEN_MAX_ROWS) historyBound("history-rows", SYNC_SCREEN_MAX_ROWS, this.sourceRows + lines);
252
+ this.sourceRows += lines; this.sourcePacks.add(physical);
242
253
  }
243
254
  return bytes;
244
255
  } });
@@ -92,8 +92,8 @@ function callbacks(input: SyncPlacementInspectionOptions): SyncPlacementInspecti
92
92
  }
93
93
  function inactive(store: MemoryStore): Extract<SyncPlacementInspection, { complete: false }> {
94
94
  const steps: string[] = [];
95
- if (!store.profile.sharded) steps.push("Have the person run amem migrate --shards --dry-run, review the plan, then amem migrate --shards --apply.");
96
- if (!store.profile.foreignPruneFormat) steps.push("Have the person run amem migrate --public-prune-view --dry-run, review the plan, then amem migrate --public-prune-view --apply.");
95
+ if (!store.profile.sharded) steps.push("Run amem migrate --shards --dry-run, review the plan, then run amem migrate --shards --apply after the exact command is approved.");
96
+ if (!store.profile.foreignPruneFormat) steps.push("Run amem migrate --public-prune-view --dry-run, review the plan, then run amem migrate --public-prune-view --apply after the exact command is approved.");
97
97
  steps.push("Complete separately person-authorized placement activation with compatible exact writer pins; this stage provides no placement activation command or marker writer.");
98
98
  return { complete: false, reason: "placement-not-active", nextStep: "Placement is not active. " + steps.join(" ") };
99
99
  }
@@ -12,7 +12,7 @@ const preview = "amem migrate --sync-placement --dry-run";
12
12
  /** Typed only for safe adapter diagnostics; the floor predicate and remedy stay shared. */
13
13
  export class PlacementHomeFloorError extends Error {
14
14
  constructor(minReader: string) {
15
- super(`Sync placement requires a person-authored home floor of ${minReader} or later in formats.json; have the person append that record, then rerun ${preview}.`);
15
+ super(`Sync placement requires a home floor of ${minReader} or later in formats.json; preview amem formats raise home ${minReader}, add --confirm after the exact command is approved, then rerun ${preview}.`);
16
16
  this.name = "PlacementHomeFloorError";
17
17
  }
18
18
  }
@@ -14,7 +14,7 @@ const NEXT: Record<PlacementRefusalCategory, string> = {
14
14
  "source-selection": "Another writer changed the selected sources during the run; close other memory writers, then rerun amem sync.",
15
15
  policy: "The memory policy changed or is not attested; reload the host so it passes the current policy, then rerun amem sync.",
16
16
  remote: "Check the private sync remote (amem sync --remote <url> once, and that the repository is private and reachable), then rerun amem sync.",
17
- "writer-pin": "A writer sharing this home no longer matches its recorded install; upgrade it to the pinned version, or have the person review amem migrate --sync-placement --dry-run --writer-root <install root> to re-pin it, then rerun amem sync.",
17
+ "writer-pin": "A writer sharing this home no longer matches its recorded install; upgrade it to the pinned version, or review amem migrate --sync-placement --dry-run --writer-root <install root>, then apply the re-pin after the exact command is approved and rerun amem sync.",
18
18
  "size-bound": "Retain the inputs and report this bound; no row was omitted to fit.",
19
19
  lock: "Another sync or memory writer holds this home; wait for it to finish (amem sync --status), then rerun amem sync.",
20
20
  other: "Rerun amem sync; if it refuses again, report the category and phase shown here.",
@@ -32,7 +32,7 @@ export class WriterRenewalError extends Error{
32
32
  :causeClass==="capacity"
33
33
  ? `Writer renewal metadata capacity is exhausted ${details}; retain this epoch and request a separately reviewed archival/checkpoint protocol before another renewal.`
34
34
  :causeClass==="authorization"
35
- ? "Writer renewal requires explicit person authorization of this exact inventory; have the person preview it with amem migrate --sync-placement --dry-run and then apply."
35
+ ? "Writer renewal requires approval of this exact inventory; preview it with amem migrate --sync-placement --dry-run, then apply after the exact command is approved."
36
36
  : "Writer renewal frozen inventory or binding changed; restore it and run amem migrate --sync-placement --resume, or use --abandon before commit append starts and review a new dry-run.");
37
37
  this.name="WriterRenewalError";
38
38
  }
@@ -20,12 +20,12 @@ export const WRITER_RENEWAL_INTENT_SCHEMA="agent-mem.sync-placement-writer-renew
20
20
 
21
21
  export type SharedWriterRevisionErrorCode="invalid"|"bound"|"changed"|"pending"|"checkpoint-pending"|"staging"|"cap";
22
22
  const messages:Record<SharedWriterRevisionErrorCode,string>={
23
- invalid:"Writer renewal metadata is invalid or unsupported; have the person inspect the retained same-epoch inventory and rerun amem migrate --sync-placement --dry-run.",
23
+ invalid:"Writer renewal metadata is invalid or unsupported; inspect the retained same-epoch inventory and rerun amem migrate --sync-placement --dry-run.",
24
24
  bound:"Writer renewal metadata exceeds its supported bound; retain the existing inventory and request a separately reviewed archival/checkpoint before retrying.",
25
25
  changed:"Writer renewal bindings changed; retain the existing inventory, inspect the same-epoch evidence and review a fresh dry-run before applying.",
26
- pending:"Writer renewal is pending; preserve its exact intent and have the person run amem migrate --sync-placement --resume.",
26
+ pending:"Writer renewal is pending; preserve its exact intent and run amem migrate --sync-placement --resume.",
27
27
  "checkpoint-pending":PLACEMENT_CHECKPOINT_PENDING_MESSAGE,
28
- staging:"Writer renewal has orphan staging without a registered final intent; have the person inspect it and run amem migrate --sync-placement --abandon, then amem migrate --sync-placement --dry-run before another apply.",
28
+ staging:"Writer renewal has orphan staging without a registered final intent; inspect it and run amem migrate --sync-placement --abandon, then amem migrate --sync-placement --dry-run before another apply.",
29
29
  cap:"Writer revision capacity is exhausted (remaining 0); retain this epoch and request a separately reviewed archival/checkpoint before another renewal.",
30
30
  };
31
31
  // ponytail: at most64 immutable writer revisions; only a separately reviewed archival/checkpoint can extend this history.