Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: complete preserved image usage receipt and backfill corrections (#13494)
picodotd431583a983f
diff --git a/server/services/imageRenderBackfill.js b/server/services/imageRenderBackfill.jsindex dc86a63901..753ed2ef21 100644--- a/server/services/imageRenderBackfill.js+++ b/server/services/imageRenderBackfill.js@@ -5,6 +5,14 @@ import { atomicWrite } from '../lib/fileCore.js';import { codexRenderReceipt, readRenderReceipts, recordRenderReceipt, publishAccountingFile } from './imageRenderUsage.js';const hash = value => createHash('sha256').update(JSON.stringify(value)).digest('hex');+const fingerprint = plan => {+ const coverage = { ...plan.coverage };+ // Live completions may add ledger receipts after review without changing+ // the historical source inventory or its recoverability evidence.+ delete coverage.alreadyRecorded;+ delete coverage.additiveOutputs;+ return hash({ sourceHash: plan.sourceHash, receipts: plan.receipts, coverage });+};// Reads only PortOS's authoritative sidecars and completed queue metadata.// Never consults provider session directories, filesystem mtimes, or prompts.@@ -12,38 +20,53 @@ export async function planImageRenderBackfill(dataDir) {const directory = join(dataDir, 'image-render-usage');const existing = new Map((await readRenderReceipts({ directory })).map(row => [row.id, row]));const candidates = new Map();+ const sourceInventory = [];const coverage = { sidecars: 0, codexSidecars: 0, unattributedSidecars: 0, derived: 0, unrecoverable: 0, unreadable: 0, queueOnly: 0, duplicates: 0 };const representedFiles = new Set();const add = meta => {const receipt = codexRenderReceipt(meta);- if (!receipt) { coverage.unrecoverable++; return; }- if (candidates.has(receipt.id)) { coverage.duplicates++; return; }+ if (!receipt) { coverage.unrecoverable++; return false; }+ if (candidates.has(receipt.id)) { coverage.duplicates++; return true; }candidates.set(receipt.id, receipt);+ return true;};const entries = await readdir(join(dataDir, 'images'), { withFileTypes: true });for (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {if (!entry.isFile() || !entry.name.endsWith('.metadata.json')) continue;coverage.sidecars++;let meta;- try { meta = JSON.parse(await readFile(join(dataDir, 'images', entry.name), 'utf8')); }+ try {+ const contents = await readFile(join(dataDir, 'images', entry.name), 'utf8');+ sourceInventory.push([hash(entry.name), hash(contents)]);+ meta = JSON.parse(contents);+ }catch (err) {// Permission failures stop this inventory; they are never an empty source.if (!(err instanceof SyntaxError)) throw err;coverage.unreadable++;continue;}- representedFiles.add(entry.name.replace(/\.metadata\.json$/, '.png'));- if (meta?.filename) representedFiles.add(meta.filename);+ const derived = Boolean(meta?.cleanedFrom || meta?.filmLookFrom || meta?.sourceFilename);+ let recovered = false;if (!meta?.mode) coverage.unattributedSidecars++;- if (meta?.mode !== 'codex') continue;- coverage.codexSidecars++;- if (meta.cleanedFrom || meta.filmLookFrom || meta.sourceFilename) { coverage.derived++; continue; }- add(meta);+ if (meta?.mode === 'codex') {+ coverage.codexSidecars++;+ if (derived) coverage.derived++;+ else recovered = add(meta);+ }+ // An incomplete sidecar may still have sufficient completed-queue evidence.+ // Explicit derived/other-provider evidence remains an exclusion.+ if (recovered || derived || (meta?.mode && meta.mode !== 'codex')) {+ representedFiles.add(entry.name.replace(/\.metadata\.json$/, '.png'));+ if (meta?.filename) representedFiles.add(meta.filename);+ }}- const queue = await readFile(join(dataDir, 'media-jobs.json'), 'utf8').then(JSON.parse).catch(err => {- if (err.code === 'ENOENT') return { jobs: [] };+ const queueContents = await readFile(join(dataDir, 'media-jobs.json'), 'utf8').catch(err => {+ if (err.code === 'ENOENT') return null;throw err;});+ sourceInventory.push(['media-queue', hash(queueContents)]);+ const queue = queueContents === null ? { jobs: [] } : JSON.parse(queueContents);if (!Array.isArray(queue.jobs)) throw new Error('Invalid media queue history');for (const job of queue.jobs) {if (job.kind !== 'image' || job.status !== 'completed' || job.params?.mode !== 'codex' || !job.result?.filename || representedFiles.has(job.result.filename)) continue;@@ -52,8 +75,8 @@ export async function planImageRenderBackfill(dataDir) {}const receipts = [...candidates.values()].sort((a, b) => a.id.localeCompare(b.id));const pending = receipts.filter(row => !existing.has(row.id));- return {- version: 1, inventoryHash: hash(receipts), receipts,+ const plan = {+ version: 1, sourceHash: hash(sourceInventory), receipts,coverage: {...coverage, eligibleOutputs: receipts.length,renderGroups: new Set(receipts.map(row => row.renderKey)).size,@@ -66,11 +89,12 @@ export async function planImageRenderBackfill(dataDir) {},unknown: ['image tokens', 'image cost', 'subscription allowance units', 'driver tokens', 'unsaved/failed image-tool calls', 'execution machine for historical sidecars without local queue evidence'],};+ return { ...plan, inventoryHash: fingerprint(plan) };}export async function applyImageRenderBackfill(dataDir, reviewedPlan, journalPath) {const current = await planImageRenderBackfill(dataDir);- if (reviewedPlan.version !== 1 || current.inventoryHash !== reviewedPlan.inventoryHash || hash(reviewedPlan.receipts) !== current.inventoryHash) {+ if (reviewedPlan.version !== 1 || current.inventoryHash !== reviewedPlan.inventoryHash || fingerprint(reviewedPlan) !== current.inventoryHash) {throw new Error('Image inventory changed; create and review a new dry-run plan');}const batch = randomUUID();diff --git a/server/services/imageRenderBackfill.test.js b/server/services/imageRenderBackfill.test.jsindex 51aaa50b7c..08c60e4350 100644--- a/server/services/imageRenderBackfill.test.js+++ b/server/services/imageRenderBackfill.test.js@@ -57,10 +57,11 @@ describe('saved Codex image usage recovery', () => {it('publishes complete receipts exactly once across simultaneous writers and does not replace a live receipt during backfill', async () => {const receipt = codexRenderReceipt(meta({ driverReportedTokens: codexDriverReportedTokens('result\ntokens used\n1,234\n') }));- expect((await Promise.all(Array.from({ length: 8 }, () => recordRenderReceipt(receipt, { directory })))).filter(Boolean)).toHaveLength(1);await sidecar('original', meta());const plan = await planImageRenderBackfill(root);- expect(plan.coverage.alreadyRecorded).toBe(1);+ expect(plan.coverage.additiveOutputs).toBe(1);+ expect((await Promise.all(Array.from({ length: 8 }, () => recordRenderReceipt(receipt, { directory })))).filter(Boolean)).toHaveLength(1);+ expect((await planImageRenderBackfill(root)).coverage.alreadyRecorded).toBe(1);expect((await applyImageRenderBackfill(root, plan, join(root, 'journal.json'))).inserted).toBe(0);expect(await readRenderReceipts({ directory })).toEqual([receipt]);expect(await getImageRenderUsage({ directory })).toMatchObject({ driverTokens: { reportedTotal: 1234, sessionsMeasured: 1 }, driverSessionsUnknown: 0, imageCostUsd: null });@@ -90,6 +91,31 @@ describe('saved Codex image usage recovery', () => {expect(plan.coverage).toMatchObject({ eligibleOutputs: 1, queueOnly: 1, unrecoverable: 3, jobIdentityOutputs: 1, earliest: '2026-06-01T01:02:03.000Z' });});+ it('recovers incomplete sidecars from queue evidence while excluding derived outputs and other providers', async () => {+ await sidecar('incomplete', meta({ id: null, codexSessionId: null, createdAt: null }));+ await sidecar('derived', meta({ cleanedFrom: 'original.png' }));+ await sidecar('other-provider', { mode: 'agy' });+ await writeFile(join(root, 'media-jobs.json'), JSON.stringify({ jobs:+ ['incomplete', 'derived', 'other-provider'].map(name => ({+ kind: 'image', status: 'completed', params: { mode: 'codex' },+ result: { filename: `${name}.png`, generationId: id }, startedAt: '2026-07-01T12:00:00Z',+ })),+ }));+ const plan = await planImageRenderBackfill(root);+ expect(plan.coverage).toMatchObject({ eligibleOutputs: 1, queueOnly: 1, derived: 1, unrecoverable: 1 });+ expect((await applyImageRenderBackfill(root, plan, join(root, 'journal.json'))).inserted).toBe(1);+ expect(await getImageRenderUsage({ directory })).toMatchObject({ savedOutputs: 1, jobIdentityGroups: 1 });+ });++ it.each([['malformed', '{'], ['unattributed', '{}']])('refuses an apply when %s sidecars change reviewed coverage', async (name, content) => {+ await sidecar('original', meta());+ const plan = await planImageRenderBackfill(root);+ await writeFile(join(root, 'images', `${name}.metadata.json`), content);+ expect((await planImageRenderBackfill(root)).receipts).toEqual(plan.receipts);+ await expect(applyImageRenderBackfill(root, plan, join(root, 'journal.json'))).rejects.toThrow('inventory changed');+ expect(await readdir(root)).not.toContain('image-render-usage');+ });+it('fails closed on a damaged ledger and reports malformed sidecars without inventing usage', async () => {await writeFile(join(root, 'images', 'bad.metadata.json'), '{');expect((await planImageRenderBackfill(root)).coverage.unreadable).toBe(1);@@ -97,4 +123,23 @@ describe('saved Codex image usage recovery', () => {await writeFile(join(directory, `${codexRenderReceipt(meta()).id}.json`), '{');await expect(planImageRenderBackfill(root)).rejects.toThrow();});++ it.each([+ ['missing session attribution', { identitySource: undefined }],+ ['invalid session attribution', { identitySource: 'unknown' }],+ ['missing token evidence', { driverTokens: undefined }],+ ['empty token evidence', { driverTokens: {} }],+ ['negative tokens', { driverTokens: { source: 'codex-cli-footer', reportedTotal: -1 } }],+ ['fractional tokens', { driverTokens: { source: 'codex-cli-footer', reportedTotal: 0.5 } }],+ ['unsafe token total', { driverTokens: { source: 'codex-cli-footer', reportedTotal: Number.MAX_SAFE_INTEGER + 1 } }],+ ['unrecognized token source', { driverTokens: { source: 'estimated', reportedTotal: 0 } }],+ ['missing timestamp provenance', { timestampSource: undefined }],+ ['invented image cost', { imageCostUsd: 0 }],+ ])('refuses %s instead of publishing misleading accounting', async (_name, damaged) => {+ const receipt = codexRenderReceipt(meta());+ await recordRenderReceipt(receipt, { directory });+ await writeFile(join(directory, `${receipt.id}.json`), JSON.stringify({ ...receipt, ...damaged }));+ await expect(getImageRenderUsage({ directory })).rejects.toThrow('Invalid image render usage receipt');+ await expect(recordRenderReceipt(receipt, { directory })).rejects.toThrow('Conflicting image render receipt');+ });});diff --git a/server/services/imageRenderUsage.js b/server/services/imageRenderUsage.jsindex e08ac803cb..5605017c3c 100644--- a/server/services/imageRenderUsage.js+++ b/server/services/imageRenderUsage.js@@ -1,6 +1,7 @@import { createHash, randomUUID } from 'node:crypto';import { link, open, readFile, readdir } from 'node:fs/promises';import { dirname, join } from 'node:path';+import { z } from 'zod';import { atomicWrite, ensureDir, unlinkGuarded } from '../lib/fileCore.js';import { PATHS } from '../lib/paths.js';@@ -14,6 +15,23 @@ const timestamp = value => {return Number.isFinite(Date.parse(value)) ? new Date(value).toISOString() : null;};const digest = value => createHash('sha256').update(value).digest('hex');+const hashIdentity = z.string().regex(/^[a-f0-9]{64}$/);+// Missing evidence must fail the ledger read rather than imply a known session+// or a measured zero. Use the same contract for new and existing receipts.+const receiptSchema = z.object({+ version: z.literal(1), id: hashIdentity, renderKey: hashIdentity,+ occurredAt: z.string().refine(value => timestamp(value) === value),+ timestampSource: z.enum(['renderStartedAt', 'createdAt']),+ identitySource: z.enum(['codex-session', 'portos-job']),+ driverModel: z.string().nullable(),+ driverTokens: z.object({+ reportedTotal: z.number().int().nonnegative().safe(),+ source: z.literal('codex-cli-footer'),+ }).nullable(),+ imageTokens: z.null(), imageCostUsd: z.null(), allowanceUnits: z.null(),+ source: z.literal('portos-saved-render'),+ backfillBatch: z.string().regex(uuid).optional(),+});// Project only accounting evidence. Never persist prompts, filenames, paths or// session contents. A driver session may produce several image-tool outputs.@@ -48,7 +66,7 @@ export async function readRenderReceipts({ directory = ledgerDir() } = {}) {for (const entry of entries) {if (!entry.isFile() || !/^[a-f0-9]{64}\.json$/.test(entry.name)) continue;const receipt = JSON.parse(await readFile(join(directory, entry.name), 'utf8'));- if (receipt.version !== 1 || receipt.id !== entry.name.slice(0, -5) || !timestamp(receipt.occurredAt) || !/^[a-f0-9]{64}$/.test(receipt.renderKey)) {+ if (!receiptSchema.safeParse(receipt).success || receipt.id !== entry.name.slice(0, -5)) {throw new Error('Invalid image render usage receipt');}receipts.push(receipt);@@ -81,7 +99,7 @@ export async function publishAccountingFile(path, value) {}export async function recordRenderReceipt(receipt, { directory = ledgerDir() } = {}) {- if (!receipt || !/^[a-f0-9]{64}$/.test(receipt.id)) throw new Error('Invalid image render receipt identity');+ if (!receiptSchema.safeParse(receipt).success) throw new Error('Invalid image render receipt');const path = join(directory, `${receipt.id}.json`);let existing = await readFile(path, 'utf8').then(JSON.parse).catch(err => {if (err.code === 'ENOENT') return undefined;@@ -91,7 +109,7 @@ export async function recordRenderReceipt(receipt, { directory = ledgerDir() } =if (await publishAccountingFile(path, receipt)) return true;existing = JSON.parse(await readFile(path, 'utf8'));}- if (existing?.id !== receipt.id || !/^[a-f0-9]{64}$/.test(existing.renderKey) || existing.version !== 1) throw new Error('Conflicting image render receipt');+ if (!receiptSchema.safeParse(existing).success || existing.id !== receipt.id) throw new Error('Conflicting image render receipt');return false;}diff --git a/server/services/promptSections/__snapshots__/reviewLoopMatrix/followUp-gh-leaveopen-compact.txt b/server/services/promptSections/__snapshots__/reviewLoopMatrix/followUp-gh-leaveopen-compact.txtindex 5305c73adb..d5503f284c 100644--- a/server/services/promptSections/__snapshots__/reviewLoopMatrix/followUp-gh-leaveopen-compact.txt+++ b/server/services/promptSections/__snapshots__/reviewLoopMatrix/followUp-gh-leaveopen-compact.txt@@ -39,7 +39,7 @@ A `409` (`CHALLENGE_EXHAUSTED` = the one challenge is spent, or `CHALLENGE_BUDGE### CLI Reviewer Procedure (codex)-Drive each spawnable CLI reviewer EXACTLY as the slashdo local-agent review loop specifies — use its per-CLI invocation and review-only prompt contract verbatim; verify isolation flags with the installed CLI's help before supplying review data. Do not use throwaway provider prompts or invent unsupported flags. Run the reviewer once per round, capture its findings, and (unless reviewer-applies is set) apply the fixes yourself.+Follow slashdo's per-CLI invocation and review-only prompt contract verbatim; verify isolation flags with the installed CLI's help before supplying review data. Do not invent flags or provider prompts. Run once per round, capture findings, and apply fixes yourself unless reviewer-applies is set.## Local agent review loopdiff --git a/server/services/promptSections/__snapshots__/reviewLoopMatrix/followUp-gh-leaveopen-verbose.txt b/server/services/promptSections/__snapshots__/reviewLoopMatrix/followUp-gh-leaveopen-verbose.txtindex b271f07859..c1423f7acc 100644--- a/server/services/promptSections/__snapshots__/reviewLoopMatrix/followUp-gh-leaveopen-verbose.txt+++ b/server/services/promptSections/__snapshots__/reviewLoopMatrix/followUp-gh-leaveopen-verbose.txt@@ -55,7 +55,7 @@ PR Details:### CLI Reviewer Procedure (codex)-Drive each spawnable CLI reviewer EXACTLY as the slashdo local-agent review loop specifies — use its per-CLI invocation and review-only prompt contract verbatim; verify isolation flags with the installed CLI's help before supplying review data. Do not use throwaway provider prompts or invent unsupported flags. Run the reviewer once per round, capture its findings, and (unless reviewer-applies is set) apply the fixes yourself.+Follow slashdo's per-CLI invocation and review-only prompt contract verbatim; verify isolation flags with the installed CLI's help before supplying review data. Do not invent flags or provider prompts. Run once per round, capture findings, and apply fixes yourself unless reviewer-applies is set.## Local agent review loopdiff --git a/server/services/promptSections/__snapshots__/reviewLoopMatrix/followUp-gh-merge-compact.txt b/server/services/promptSections/__snapshots__/reviewLoopMatrix/followUp-gh-merge-compact.txtindex 6c46c09d64..bbdabb58ad 100644--- a/server/services/promptSections/__snapshots__/reviewLoopMatrix/followUp-gh-merge-compact.txt+++ b/server/services/promptSections/__snapshots__/reviewLoopMatrix/followUp-gh-merge-compact.txt@@ -57,7 +57,7 @@ A `409` (`CHALLENGE_EXHAUSTED` = the one challenge is spent, or `CHALLENGE_BUDGE### CLI Reviewer Procedure (codex)-Drive each spawnable CLI reviewer EXACTLY as the slashdo local-agent review loop specifies — use its per-CLI invocation and review-only prompt contract verbatim; verify isolation flags with the installed CLI's help before supplying review data. Do not use throwaway provider prompts or invent unsupported flags. Run the reviewer once per round, capture its findings, and (unless reviewer-applies is set) apply the fixes yourself.+Follow slashdo's per-CLI invocation and review-only prompt contract verbatim; verify isolation flags with the installed CLI's help before supplying review data. Do not invent flags or provider prompts. Run once per round, capture findings, and apply fixes yourself unless reviewer-applies is set.## Local agent review loopdiff --git a/server/services/promptSections/__snapshots__/reviewLoopMatrix/followUp-gh-merge-verbose.txt b/server/services/promptSections/__snapshots__/reviewLoopMatrix/followUp-gh-merge-verbose.txtindex b8d5b3b26a..5fb22135d6 100644--- a/server/services/promptSections/__snapshots__/reviewLoopMatrix/followUp-gh-merge-verbose.txt+++ b/server/services/promptSections/__snapshots__/reviewLoopMatrix/followUp-gh-merge-verbose.txt@@ -72,7 +72,7 @@ PR Details:### CLI Reviewer Procedure (codex)-Drive each spawnable CLI reviewer EXACTLY as the slashdo local-agent review loop specifies — use its per-CLI invocation and review-only prompt contract verbatim; verify isolation flags with the installed CLI's help before supplying review data. Do not use throwaway provider prompts or invent unsupported flags. Run the reviewer once per round, capture its findings, and (unless reviewer-applies is set) apply the fixes yourself.+Follow slashdo's per-CLI invocation and review-only prompt contract verbatim; verify isolation flags with the installed CLI's help before supplying review data. Do not invent flags or provider prompts. Run once per round, capture findings, and apply fixes yourself unless reviewer-applies is set.## Local agent review loopdiff --git a/server/services/promptSections/__snapshots__/reviewLoopMatrix/followUp-glab-leaveopen-compact.txt b/server/services/promptSections/__snapshots__/reviewLoopMatrix/followUp-glab-leaveopen-compact.txtindex 1e74b9dd45..5e87fcb90e 100644--- a/server/services/promptSections/__snapshots__/reviewLoopMatrix/followUp-glab-leaveopen-compact.txt+++ b/server/services/promptSections/__snapshots__/reviewLoopMatrix/followUp-glab-leaveopen-compact.txt@@ -39,7 +39,7 @@ A `409` (`CHALLENGE_EXHAUSTED` = the one challenge is spent, or `CHALLENGE_BUDGE### CLI Reviewer Procedure (codex)-Drive each spawnable CLI reviewer EXACTLY as the slashdo local-agent review loop specifies — use its per-CLI invocation and review-only prompt contract verbatim; verify isolation flags with the installed CLI's help before supplying review data. Do not use throwaway provider prompts or invent unsupported flags. Run the reviewer once per round, capture its findings, and (unless reviewer-applies is set) apply the fixes yourself.+Follow slashdo's per-CLI invocation and review-only prompt contract verbatim; verify isolation flags with the installed CLI's help before supplying review data. Do not invent flags or provider prompts. Run once per round, capture findings, and apply fixes yourself unless reviewer-applies is set.## Local agent review loopdiff --git a/server/services/promptSections/__snapshots__/reviewLoopMatrix/followUp-glab-leaveopen-verbose.txt b/server/services/promptSections/__snapshots__/reviewLoopMatrix/followUp-glab-leaveopen-verbose.txtindex e9dbcaf97d..c00d25708d 100644--- a/server/services/promptSections/__snapshots__/reviewLoopMatrix/followUp-glab-leaveopen-verbose.txt+++ b/server/services/promptSections/__snapshots__/reviewLoopMatrix/followUp-glab-leaveopen-verbose.txt@@ -55,7 +55,7 @@ PR Details:### CLI Reviewer Procedure (codex)-Drive each spawnable CLI reviewer EXACTLY as the slashdo local-agent review loop specifies — use its per-CLI invocation and review-only prompt contract verbatim; verify isolation flags with the installed CLI's help before supplying review data. Do not use throwaway provider prompts or invent unsupported flags. Run the reviewer once per round, capture its findings, and (unless reviewer-applies is set) apply the fixes yourself.+Follow slashdo's per-CLI invocation and review-only prompt contract verbatim; verify isolation flags with the installed CLI's help before supplying review data. Do not invent flags or provider prompts. Run once per round, capture findings, and apply fixes yourself unless reviewer-applies is set.## Local agent review loopdiff --git a/server/services/promptSections/__snapshots__/reviewLoopMatrix/followUp-glab-merge-compact.txt b/server/services/promptSections/__snapshots__/reviewLoopMatrix/followUp-glab-merge-compact.txtindex 2a74fd9760..f09502c2f5 100644--- a/server/services/promptSections/__snapshots__/reviewLoopMatrix/followUp-glab-merge-compact.txt+++ b/server/services/promptSections/__snapshots__/reviewLoopMatrix/followUp-glab-merge-compact.txt@@ -47,7 +47,7 @@ A `409` (`CHALLENGE_EXHAUSTED` = the one challenge is spent, or `CHALLENGE_BUDGE### CLI Reviewer Procedure (codex)-Drive each spawnable CLI reviewer EXACTLY as the slashdo local-agent review loop specifies — use its per-CLI invocation and review-only prompt contract verbatim; verify isolation flags with the installed CLI's help before supplying review data. Do not use throwaway provider prompts or invent unsupported flags. Run the reviewer once per round, capture its findings, and (unless reviewer-applies is set) apply the fixes yourself.+Follow slashdo's per-CLI invocation and review-only prompt contract verbatim; verify isolation flags with the installed CLI's help before supplying review data. Do not invent flags or provider prompts. Run once per round, capture findings, and apply fixes yourself unless reviewer-applies is set.## Local agent review loopdiff --git a/server/services/promptSections/__snapshots__/reviewLoopMatrix/followUp-glab-merge-verbose.txt b/server/services/promptSections/__snapshots__/reviewLoopMatrix/followUp-glab-merge-verbose.txtindex d5e8b7716f..922837decd 100644--- a/server/services/promptSections/__snapshots__/reviewLoopMatrix/followUp-glab-merge-verbose.txt+++ b/server/services/promptSections/__snapshots__/reviewLoopMatrix/followUp-glab-merge-verbose.txt@@ -62,7 +62,7 @@ PR Details:### CLI Reviewer Procedure (codex)-Drive each spawnable CLI reviewer EXACTLY as the slashdo local-agent review loop specifies — use its per-CLI invocation and review-only prompt contract verbatim; verify isolation flags with the installed CLI's help before supplying review data. Do not use throwaway provider prompts or invent unsupported flags. Run the reviewer once per round, capture its findings, and (unless reviewer-applies is set) apply the fixes yourself.+Follow slashdo's per-CLI invocation and review-only prompt contract verbatim; verify isolation flags with the installed CLI's help before supplying review data. Do not invent flags or provider prompts. Run once per round, capture findings, and apply fixes yourself unless reviewer-applies is set.## Local agent review loopdiff --git a/server/services/promptSections/__snapshots__/reviewLoopMatrix/followup-copilot-first.txt b/server/services/promptSections/__snapshots__/reviewLoopMatrix/followup-copilot-first.txtindex 63665b128c..75b4ece7a4 100644--- a/server/services/promptSections/__snapshots__/reviewLoopMatrix/followup-copilot-first.txt+++ b/server/services/promptSections/__snapshots__/reviewLoopMatrix/followup-copilot-first.txt@@ -44,7 +44,7 @@ A `409` (`CHALLENGE_EXHAUSTED` = the one challenge is spent, or `CHALLENGE_BUDGE### CLI Reviewer Procedure (codex)-Drive each spawnable CLI reviewer EXACTLY as the slashdo local-agent review loop specifies — use its per-CLI invocation and review-only prompt contract verbatim; verify isolation flags with the installed CLI's help before supplying review data. Do not use throwaway provider prompts or invent unsupported flags. Run the reviewer once per round, capture its findings, and (unless reviewer-applies is set) apply the fixes yourself.+Follow slashdo's per-CLI invocation and review-only prompt contract verbatim; verify isolation flags with the installed CLI's help before supplying review data. Do not invent flags or provider prompts. Run once per round, capture findings, and apply fixes yourself unless reviewer-applies is set.## Local agent review loopdiff --git a/server/services/promptSections/__snapshots__/reviewLoopMatrix/inline-gh-leaveopen-compact.txt b/server/services/promptSections/__snapshots__/reviewLoopMatrix/inline-gh-leaveopen-compact.txtindex 764793b2b1..a8b7cb135e 100644--- a/server/services/promptSections/__snapshots__/reviewLoopMatrix/inline-gh-leaveopen-compact.txt+++ b/server/services/promptSections/__snapshots__/reviewLoopMatrix/inline-gh-leaveopen-compact.txt@@ -47,7 +47,7 @@ A `409` (`CHALLENGE_EXHAUSTED` = the one challenge is spent, or `CHALLENGE_BUDGE### CLI Reviewer Procedure (codex)-Drive each spawnable CLI reviewer EXACTLY as the slashdo local-agent review loop specifies — use its per-CLI invocation and review-only prompt contract verbatim; verify isolation flags with the installed CLI's help before supplying review data. Do not use throwaway provider prompts or invent unsupported flags. Run the reviewer once per round, capture its findings, and (unless reviewer-applies is set) apply the fixes yourself.+Follow slashdo's per-CLI invocation and review-only prompt contract verbatim; verify isolation flags with the installed CLI's help before supplying review data. Do not invent flags or provider prompts. Run once per round, capture findings, and apply fixes yourself unless reviewer-applies is set.## Local agent review loopdiff --git a/server/services/promptSections/__snapshots__/reviewLoopMatrix/inline-gh-leaveopen-verbose.txt b/server/services/promptSections/__snapshots__/reviewLoopMatrix/inline-gh-leaveopen-verbose.txtindex c1f9078567..62e4916eef 100644--- a/server/services/promptSections/__snapshots__/reviewLoopMatrix/inline-gh-leaveopen-verbose.txt+++ b/server/services/promptSections/__snapshots__/reviewLoopMatrix/inline-gh-leaveopen-verbose.txt@@ -63,7 +63,7 @@ PR Details:### CLI Reviewer Procedure (codex)-Drive each spawnable CLI reviewer EXACTLY as the slashdo local-agent review loop specifies — use its per-CLI invocation and review-only prompt contract verbatim; verify isolation flags with the installed CLI's help before supplying review data. Do not use throwaway provider prompts or invent unsupported flags. Run the reviewer once per round, capture its findings, and (unless reviewer-applies is set) apply the fixes yourself.+Follow slashdo's per-CLI invocation and review-only prompt contract verbatim; verify isolation flags with the installed CLI's help before supplying review data. Do not invent flags or provider prompts. Run once per round, capture findings, and apply fixes yourself unless reviewer-applies is set.## Local agent review loopdiff --git a/server/services/promptSections/__snapshots__/reviewLoopMatrix/inline-gh-merge-compact.txt b/server/services/promptSections/__snapshots__/reviewLoopMatrix/inline-gh-merge-compact.txtindex a507e6cd70..602712352c 100644--- a/server/services/promptSections/__snapshots__/reviewLoopMatrix/inline-gh-merge-compact.txt+++ b/server/services/promptSections/__snapshots__/reviewLoopMatrix/inline-gh-merge-compact.txt@@ -64,7 +64,7 @@ A `409` (`CHALLENGE_EXHAUSTED` = the one challenge is spent, or `CHALLENGE_BUDGE### CLI Reviewer Procedure (codex)-Drive each spawnable CLI reviewer EXACTLY as the slashdo local-agent review loop specifies — use its per-CLI invocation and review-only prompt contract verbatim; verify isolation flags with the installed CLI's help before supplying review data. Do not use throwaway provider prompts or invent unsupported flags. Run the reviewer once per round, capture its findings, and (unless reviewer-applies is set) apply the fixes yourself.+Follow slashdo's per-CLI invocation and review-only prompt contract verbatim; verify isolation flags with the installed CLI's help before supplying review data. Do not invent flags or provider prompts. Run once per round, capture findings, and apply fixes yourself unless reviewer-applies is set.## Local agent review loopdiff --git a/server/services/promptSections/__snapshots__/reviewLoopMatrix/inline-gh-merge-verbose.txt b/server/services/promptSections/__snapshots__/reviewLoopMatrix/inline-gh-merge-verbose.txtindex 5d73577c5d..4c99be9e9f 100644--- a/server/services/promptSections/__snapshots__/reviewLoopMatrix/inline-gh-merge-verbose.txt+++ b/server/services/promptSections/__snapshots__/reviewLoopMatrix/inline-gh-merge-verbose.txt@@ -80,7 +80,7 @@ PR Details:### CLI Reviewer Procedure (codex)-Drive each spawnable CLI reviewer EXACTLY as the slashdo local-agent review loop specifies — use its per-CLI invocation and review-only prompt contract verbatim; verify isolation flags with the installed CLI's help before supplying review data. Do not use throwaway provider prompts or invent unsupported flags. Run the reviewer once per round, capture its findings, and (unless reviewer-applies is set) apply the fixes yourself.+Follow slashdo's per-CLI invocation and review-only prompt contract verbatim; verify isolation flags with the installed CLI's help before supplying review data. Do not invent flags or provider prompts. Run once per round, capture findings, and apply fixes yourself unless reviewer-applies is set.## Local agent review loopdiff --git a/server/services/promptSections/__snapshots__/reviewLoopMatrix/inline-glab-leaveopen-compact.txt b/server/services/promptSections/__snapshots__/reviewLoopMatrix/inline-glab-leaveopen-compact.txtindex 1c7856aec7..d6407ad010 100644--- a/server/services/promptSections/__snapshots__/reviewLoopMatrix/inline-glab-leaveopen-compact.txt+++ b/server/services/promptSections/__snapshots__/reviewLoopMatrix/inline-glab-leaveopen-compact.txt@@ -47,7 +47,7 @@ A `409` (`CHALLENGE_EXHAUSTED` = the one challenge is spent, or `CHALLENGE_BUDGE### CLI Reviewer Procedure (codex)-Drive each spawnable CLI reviewer EXACTLY as the slashdo local-agent review loop specifies — use its per-CLI invocation and review-only prompt contract verbatim; verify isolation flags with the installed CLI's help before supplying review data. Do not use throwaway provider prompts or invent unsupported flags. Run the reviewer once per round, capture its findings, and (unless reviewer-applies is set) apply the fixes yourself.+Follow slashdo's per-CLI invocation and review-only prompt contract verbatim; verify isolation flags with the installed CLI's help before supplying review data. Do not invent flags or provider prompts. Run once per round, capture findings, and apply fixes yourself unless reviewer-applies is set.## Local agent review loopdiff --git a/server/services/promptSections/__snapshots__/reviewLoopMatrix/inline-glab-leaveopen-verbose.txt b/server/services/promptSections/__snapshots__/reviewLoopMatrix/inline-glab-leaveopen-verbose.txtindex 6f648d1c82..ea4f6e3e19 100644--- a/server/services/promptSections/__snapshots__/reviewLoopMatrix/inline-glab-leaveopen-verbose.txt+++ b/server/services/promptSections/__snapshots__/reviewLoopMatrix/inline-glab-leaveopen-verbose.txt@@ -63,7 +63,7 @@ PR Details:### CLI Reviewer Procedure (codex)-Drive each spawnable CLI reviewer EXACTLY as the slashdo local-agent review loop specifies — use its per-CLI invocation and review-only prompt contract verbatim; verify isolation flags with the installed CLI's help before supplying review data. Do not use throwaway provider prompts or invent unsupported flags. Run the reviewer once per round, capture its findings, and (unless reviewer-applies is set) apply the fixes yourself.+Follow slashdo's per-CLI invocation and review-only prompt contract verbatim; verify isolation flags with the installed CLI's help before supplying review data. Do not invent flags or provider prompts. Run once per round, capture findings, and apply fixes yourself unless reviewer-applies is set.## Local agent review loopdiff --git a/server/services/promptSections/__snapshots__/reviewLoopMatrix/inline-glab-merge-compact.txt b/server/services/promptSections/__snapshots__/reviewLoopMatrix/inline-glab-merge-compact.txtindex aeb8b23fd1..9b93b802db 100644--- a/server/services/promptSections/__snapshots__/reviewLoopMatrix/inline-glab-merge-compact.txt+++ b/server/services/promptSections/__snapshots__/reviewLoopMatrix/inline-glab-merge-compact.txt@@ -54,7 +54,7 @@ A `409` (`CHALLENGE_EXHAUSTED` = the one challenge is spent, or `CHALLENGE_BUDGE### CLI Reviewer Procedure (codex)-Drive each spawnable CLI reviewer EXACTLY as the slashdo local-agent review loop specifies — use its per-CLI invocation and review-only prompt contract verbatim; verify isolation flags with the installed CLI's help before supplying review data. Do not use throwaway provider prompts or invent unsupported flags. Run the reviewer once per round, capture its findings, and (unless reviewer-applies is set) apply the fixes yourself.+Follow slashdo's per-CLI invocation and review-only prompt contract verbatim; verify isolation flags with the installed CLI's help before supplying review data. Do not invent flags or provider prompts. Run once per round, capture findings, and apply fixes yourself unless reviewer-applies is set.## Local agent review loopdiff --git a/server/services/promptSections/__snapshots__/reviewLoopMatrix/inline-glab-merge-verbose.txt b/server/services/promptSections/__snapshots__/reviewLoopMatrix/inline-glab-merge-verbose.txtindex e129c2d20a..15bbb838f7 100644--- a/server/services/promptSections/__snapshots__/reviewLoopMatrix/inline-glab-merge-verbose.txt+++ b/server/services/promptSections/__snapshots__/reviewLoopMatrix/inline-glab-merge-verbose.txt@@ -70,7 +70,7 @@ PR Details:### CLI Reviewer Procedure (codex)-Drive each spawnable CLI reviewer EXACTLY as the slashdo local-agent review loop specifies — use its per-CLI invocation and review-only prompt contract verbatim; verify isolation flags with the installed CLI's help before supplying review data. Do not use throwaway provider prompts or invent unsupported flags. Run the reviewer once per round, capture its findings, and (unless reviewer-applies is set) apply the fixes yourself.+Follow slashdo's per-CLI invocation and review-only prompt contract verbatim; verify isolation flags with the installed CLI's help before supplying review data. Do not invent flags or provider prompts. Run once per round, capture findings, and apply fixes yourself unless reviewer-applies is set.## Local agent review loopdiff --git a/server/services/promptSections/__snapshots__/reviewLoopMatrix/local-gh.txt b/server/services/promptSections/__snapshots__/reviewLoopMatrix/local-gh.txtindex 2816cd3edc..1b2853aef1 100644--- a/server/services/promptSections/__snapshots__/reviewLoopMatrix/local-gh.txt+++ b/server/services/promptSections/__snapshots__/reviewLoopMatrix/local-gh.txt@@ -48,7 +48,7 @@ A `409` (`CHALLENGE_EXHAUSTED` = the one challenge is spent, or `CHALLENGE_BUDGE**Pre-PR rule:** keep reviewer fixes committed locally. Do NOT push or open a PR/MR here; the outer workflow publishes after the local review phase completes.-Drive each spawnable CLI reviewer EXACTLY as the slashdo local-agent review loop specifies — use its per-CLI invocation and review-only prompt contract verbatim; verify isolation flags with the installed CLI's help before supplying review data. Do not use throwaway provider prompts or invent unsupported flags. Run the reviewer once per round, capture its findings, and (unless reviewer-applies is set) apply the fixes yourself.+Follow slashdo's per-CLI invocation and review-only prompt contract verbatim; verify isolation flags with the installed CLI's help before supplying review data. Do not invent flags or provider prompts. Run once per round, capture findings, and apply fixes yourself unless reviewer-applies is set.## Local agent review loopdiff --git a/server/services/promptSections/__snapshots__/reviewLoopMatrix/local-glab.txt b/server/services/promptSections/__snapshots__/reviewLoopMatrix/local-glab.txtindex 2816cd3edc..1b2853aef1 100644--- a/server/services/promptSections/__snapshots__/reviewLoopMatrix/local-glab.txt+++ b/server/services/promptSections/__snapshots__/reviewLoopMatrix/local-glab.txt@@ -48,7 +48,7 @@ A `409` (`CHALLENGE_EXHAUSTED` = the one challenge is spent, or `CHALLENGE_BUDGE**Pre-PR rule:** keep reviewer fixes committed locally. Do NOT push or open a PR/MR here; the outer workflow publishes after the local review phase completes.-Drive each spawnable CLI reviewer EXACTLY as the slashdo local-agent review loop specifies — use its per-CLI invocation and review-only prompt contract verbatim; verify isolation flags with the installed CLI's help before supplying review data. Do not use throwaway provider prompts or invent unsupported flags. Run the reviewer once per round, capture its findings, and (unless reviewer-applies is set) apply the fixes yourself.+Follow slashdo's per-CLI invocation and review-only prompt contract verbatim; verify isolation flags with the installed CLI's help before supplying review data. Do not invent flags or provider prompts. Run once per round, capture findings, and apply fixes yourself unless reviewer-applies is set.## Local agent review loopdiff --git a/server/services/promptSections/reviewLifecycle.js b/server/services/promptSections/reviewLifecycle.jsindex 92ee84b27b..904d9d06cc 100644--- a/server/services/promptSections/reviewLifecycle.js+++ b/server/services/promptSections/reviewLifecycle.js@@ -931,7 +931,7 @@ export function buildReviewLoopFollowUpSection(metadata = {}, { verbose = false,// file instead. Same trade `buildSlashdoSection` makes: an initial run is// already carrying the real task, and pasting 40KB of reviewer recipe up front// to be read at step 4 is the wrong place to spend that context.- const cliProcedureHeader = `\n### CLI Reviewer Procedure (${cliReviewerHeading})\n\n${phase.procedureNote}Drive each spawnable CLI reviewer EXACTLY as the slashdo local-agent review loop specifies — use its per-CLI invocation and review-only prompt contract verbatim; verify isolation flags with the installed CLI's help before supplying review data. Do not use throwaway provider prompts or invent unsupported flags. Run the reviewer once per round, capture its findings, and (unless reviewer-applies is set) apply the fixes yourself.\n\n`;+ const cliProcedureHeader = `\n### CLI Reviewer Procedure (${cliReviewerHeading})\n\n${phase.procedureNote}Follow slashdo's per-CLI invocation and review-only prompt contract verbatim; verify isolation flags with the installed CLI's help before supplying review data. Do not invent flags or provider prompts. Run once per round, capture findings, and apply fixes yourself unless reviewer-applies is set.\n\n`;//// The path IS the decision — it is non-null only when the caller already// measured the body over budget and staged it. Re-testing the length here