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.
49 lines
4.5 KiB
JavaScript
49 lines
4.5 KiB
JavaScript
// Sage, 2026-10-15: Mos #314 / Q167. Comments on #314 with the plan sent to Mos as sage-0376.
|
|
// Sage's own key (bot user 13). The sync key reads the task title first and the comment back. No state
|
|
// change to the task. Prints no secret.
|
|
// Usage: node comment-314-plan.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 = 314;
|
|
const SIG = "Created by Sage (T3 1ef1e4f8) with Sage's own key (bot user 13).";
|
|
const esc = (s) => s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
const p = (...xs) => xs.map((x) => `<p>${esc(x)}</p>`).join("") + `<p>${esc(SIG)}</p>`;
|
|
const TEXT = [
|
|
"Plan sent to Mos as sage-0376, 2026-10-15T22:05Z. Not started: it waits on Mos for Q4 (agents land into the business working repo, not canonical refactor, recommended) and Q5 (Q167 covers shrinking GATED_ONLY to the hard-waits list).",
|
|
"Root causes. S1: an approval is consumable only by the run that raised it (packages/bus/src/broker.mjs:600, supersede :1044). S2: git.merge.protected is in GATED and GATED_ONLY, so no role can hold it. S4: anything not granted classifies gated and routes to the human (broker.mjs:447, :1036). S8: talk prints and marks read every inbox message while it waits (packages/cli/src/cli.mjs:240-244).",
|
|
"Rows 135-143. 135 Sage: PRD 1.5 under Q167, after 297. 136 Dewey: S1, approvals bind to decision and role instance, consumed once, no schema step. 137 Darkwing: S2, a land op on the host git socket using land-work checks and gate. 138 Rocko: S3 and S5, versioned specs, schema 3f. 139 Dewey: S4, spec-covered decisions route to the arbiter, hard waits stay with Jason. 140 Researcher: S6, pm staff request to chief. 141 Darkwing: S7, instance names, folds in 623b1665, schema 3g. 142 Researcher: S8. 143 Rocko: S9 and S10. Filbert reviews unless the row says Dewey. Rows 124-126, 128 and 129 wait behind these.",
|
|
"Schema window: code-only rows ride any re-pin after the 3e window. 138 and 141 each get their own window, one schema step per window, with the gap rule for land-work.",
|
|
"Acceptance: Jason sets a north star through the assistant (a mosaic version command), confirms spec v1, watches pm, chief, a coder and a reviewer produce and land it with an empty inbox, survives a host restart, changes the spec once without reopening settled decisions, and gets a block back on a proposal that breaks the spec. The script lands as docs/acceptance/314.md in row 135.",
|
|
];
|
|
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, 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 task = await api("GET", `/api/v2/tasks/${TASK}`, undefined, sync);
|
|
rec.title = task.json?.title ?? null;
|
|
if (task.status !== 200 || task.json?.project_id !== 19) throw new Error(`task ${TASK}: ${task.status}, project ${task.json?.project_id}`);
|
|
writeFileSync(OUT, "", { flag: "wx" });
|
|
const r = await api("PUT", `/api/v1/tasks/${TASK}/comments`, { comment: p(...TEXT) }, key);
|
|
Object.assign(rec, { status: r.status, id: r.json?.id ?? null });
|
|
if (r.status >= 300 || !Number.isSafeInteger(r.json?.id)) rec.problems.push(`comment: ${r.status} ${r.json?.message ?? ""}`);
|
|
else {
|
|
const back = await api("GET", `/api/v2/tasks/${TASK}/comments?per_page=50`, undefined, sync);
|
|
const found = list(back.json).find((c) => c.id === r.json.id);
|
|
Object.assign(rec, { readBack: back.status, found: Boolean(found), author: found?.author?.username ?? null });
|
|
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);
|