Files
stack/agents/sage/work/vikunja-setup/comment-386-window-bc.mjs
jason.woltje e24a13ad87 sage: Vikunja scripts and read-back records 2026-10-13 to 10-20 (decision 110, mos-0882)
102 files under agents/sage/work/vikunja-setup/: the comment, close and file scripts Sage ran on P19 and their
output records, including P19 386 comment 350 for the mos-0928 Part A window (rows 177 and 180-185). Each script
refuses to write a record that holds a key; a scan for both key values found none.
2026-10-20 03:32:46 -05:00

48 lines
5.0 KiB
JavaScript

// Sage, 2026-10-20: plan draft 9 W11 ("Sage files it on P19 386 and 382"). Comments on P19 386 with the merged B+C
// window STATE summary. Sage's own key; the sync key reads back. Prints no secret.
// Usage: node comment-386-window-bc.mjs https://tasks.woltje.com SAGE_TOKEN_FILE SYNC_TOKEN_FILE OUT_JSON
import { readFileSync, writeFileSync, existsSync } from "node:fs";
const [ORIGIN, KEY, SYNC, OUT] = process.argv.slice(2);
if (!/^https:\/\/tasks\.woltje\.com$/.test(ORIGIN)) throw new Error("tasks.woltje.com only");
if (!OUT || existsSync(OUT)) throw new Error("OUT_JSON missing or exists; refusing");
const TASK = 386;
const SIG = "Posted by Sage (T3 1ef1e4f8) with Sage's own key (bot user 13).";
const esc = (s) => s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
const p = (...xs) => xs.map((x) => `<p>${esc(x)}</p>`).join("") + `<p>${esc(SIG)}</p>`;
const BODY = p(
"Merged B+C window done. NEW 89af38a83 is live for mosaic-stack with its PM, the store is on 3i, and the tester listener is on 127.0.0.1:7333. W0 to W10 passed, no stop condition fired and nothing was rolled back. Darkwing operated it and Mos verified each step. Sage checked the STATE report (agents/darkwing/work/window-merged-bc/STATE.md, sha256 7be42b6bcab5657d) against the transcripts in window/ and found it consistent.",
"W5 activate 20261020T013708Z-89af38a83afa: exit 0, 3h to 3i, gate passed. Store backup ~/.mosaic-dev/backups/stack/20261020T013708Z-89af38a83afa, STAMP 2026-10-20T01:37:08.917Z, SHA256SUMS ef78f7d4, rechecked OK at S2b. W6: the tester set plugins.harness to [claude-code] (transaction 0a63a1dc). W7 pm-on 20261020T014103Z-89af38a83afa launched chief rc78c9700c8e9. W8 carried the seven skills, and each matches NEW. The bus and Console units now run from the NEW copy, the Console with --tester-port 7333, and 7332 healthz is 200.",
"W9: every tester read exited 0, and the chief answered a tester talk. A coder the chief started answered with its four skills, made no tool calls, and was stopped at 02:01:41Z. W10: the browser on 7333 showed only tester forms and sent only GET requests. 7332 answers x-mosaic-tester with 403, and 200 without the header.",
"Three deviations, each accepted by Mos. (1) W8 ran from the repo pinned to NEW, because a stack copy has no skill.sh or skills/ (mos-0914, mos-0915). Sage's carry doc was wrong, and its fix is due under #394. (2) The W9 coder was started by the chief, since TESTER_VERBS has no role.launch (mos-0917). (3) The tester Settings has no Token limits panel, by design. The limits were read as the tester (tokens []), and no human Console read ran (mos-0920, mos-0922).",
"S2b compared S2 with the W5 backup: every table matches on the rows they share, and nothing exists only in the backup. Rows added since W5 sit in deliveries, messages, role_claims, task_comment_cursors, task_snapshots and usage_records, and a restore would drop them. One point the report leaves out: the backup has 1384 events and 88 role_claims against S1's 1383 and 87, so the OLD bus wrote one of each between S1 (01:34:49Z) and the backup (01:37:08Z). That's expected with OLD still live.",
"Next: #394 fixes carry-past-row64.md and plan line 222. Dewey builds row 177 once the slot is clear. P19 390 (restore guard) and 391 (activation-id race) stay open. P19 382 closes with this report.",
);
const key = readFileSync(KEY, "utf8").trim(), sync = readFileSync(SYNC, "utf8").trim();
async function api(method, path, body, auth) {
const r = await fetch(ORIGIN + path, { method, headers: { Authorization: `Bearer ${auth}`, "Content-Type": "application/json" }, body: body === undefined ? undefined : JSON.stringify(body), redirect: "error" });
const t = await r.text(); let json = null; try { json = JSON.parse(t); } catch {}
return { status: r.status, json };
}
const list = (j) => j?.items ?? (Array.isArray(j) ? j : []);
const rec = { at: new Date().toISOString(), task: TASK, comment: null, problems: [] };
const save = () => {
const out = JSON.stringify(rec, null, 1) + "\n";
if (out.includes(key) || out.includes(sync)) throw new Error("secret in the record; not written");
writeFileSync(OUT, out);
};
const t = await api("GET", `/api/v2/tasks/${TASK}`, undefined, sync);
if (t.status !== 200 || t.json?.project_id !== 19 || !/Q173/.test(t.json?.title ?? "")) throw new Error(`task ${TASK}: ${t.status}, not the Q173 task`);
writeFileSync(OUT, "", { flag: "wx" });
const c = await api("PUT", `/api/v1/tasks/${TASK}/comments`, { comment: BODY }, key);
rec.comment = { status: c.status, id: c.json?.id ?? null };
if (c.status >= 300 || !Number.isSafeInteger(c.json?.id)) rec.problems.push(`comment: ${c.status} ${c.json?.message ?? ""}`);
else {
const back = await api("GET", `/api/v2/tasks/${TASK}/comments?per_page=50`, undefined, sync);
const found = list(back.json).find((x) => x.id === c.json.id);
Object.assign(rec.comment, { readBack: back.status, found: Boolean(found) });
if (back.status !== 200 || !found) rec.problems.push(`read-back: ${back.status}`);
}
save();
process.stdout.write(JSON.stringify(rec, null, 1) + "\n");
if (rec.problems.length) process.exit(2);