diff --git a/agents/sage/work/vikunja-setup/2026-10-15_r121-r131-followups.json b/agents/sage/work/vikunja-setup/2026-10-15_r121-r131-followups.json new file mode 100644 index 000000000..f28580a35 --- /dev/null +++ b/agents/sage/work/vikunja-setup/2026-10-15_r121-r131-followups.json @@ -0,0 +1,27 @@ +{ + "at": "2026-10-15T16:54:33.445Z", + "project": 19, + "created": [ + { + "title": "business: rename the organization file's projects key to repos", + "id": 292, + "index": 133, + "inverse": "mark done: POST /api/v1/tasks/292 done true (pm); delete is Jason's or ops-01's", + "readBack": 200, + "project_back": 19, + "due_back": "0001-01-01T00:00:00Z", + "done": false + }, + { + "title": "business: the organization writer's validation refusals carry no code", + "id": 293, + "index": 134, + "inverse": "mark done: POST /api/v1/tasks/293 done true (pm); delete is Jason's or ops-01's", + "readBack": 200, + "project_back": 19, + "due_back": "0001-01-01T00:00:00Z", + "done": false + } + ], + "problems": [] +} diff --git a/agents/sage/work/vikunja-setup/2026-10-15_r123-followup.json b/agents/sage/work/vikunja-setup/2026-10-15_r123-followup.json new file mode 100644 index 000000000..33be30274 --- /dev/null +++ b/agents/sage/work/vikunja-setup/2026-10-15_r123-followup.json @@ -0,0 +1,17 @@ +{ + "at": "2026-10-15T17:09:50.414Z", + "project": 19, + "created": [ + { + "title": "bus: organization.set returns outcome-unknown when the consume fails after the writer", + "id": 299, + "index": 140, + "inverse": "mark done: POST /api/v1/tasks/299 done true (pm); delete is Jason's or ops-01's", + "readBack": 200, + "project_back": 19, + "due_back": "0001-01-01T00:00:00Z", + "done": false + } + ], + "problems": [] +} diff --git a/agents/sage/work/vikunja-setup/2026-10-15_r49-followup.json b/agents/sage/work/vikunja-setup/2026-10-15_r49-followup.json new file mode 100644 index 000000000..b2c8fc0d6 --- /dev/null +++ b/agents/sage/work/vikunja-setup/2026-10-15_r49-followup.json @@ -0,0 +1,17 @@ +{ + "at": "2026-10-15T17:15:26.923Z", + "project": 19, + "created": [ + { + "title": "tasks: keep the highest comment cursor per task when one pass reads a task twice", + "id": 300, + "index": 141, + "inverse": "mark done: POST /api/v1/tasks/300 done true (pm); delete is Jason's or ops-01's", + "readBack": 200, + "project_back": 19, + "due_back": "0001-01-01T00:00:00Z", + "done": false + } + ], + "problems": [] +} diff --git a/agents/sage/work/vikunja-setup/file-r121-r131-followups.mjs b/agents/sage/work/vikunja-setup/file-r121-r131-followups.mjs new file mode 100644 index 000000000..20ee74de5 --- /dev/null +++ b/agents/sage/work/vikunja-setup/file-r121-r131-followups.mjs @@ -0,0 +1,66 @@ +// Sage, 2026-10-15: decision 110. Files two follow-ups as tasks in project 19 with Sage's own key (bot +// user 13): the org-file projects key rename (row 121 design, #1615) and the uncoded writer refusal +// (row 131 r2, #1626). Refuses if a title already exists. The sync key reads them back. No labels, no +// assignees, no bucket moves. Rollback is marking a task done; deletion is Jason's or ops-01's. Prints no secret. +// Usage: node file-r121-r131-followups.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 PROJECT = 19; +const SIG = "Created by Sage (T3 1ef1e4f8) with Sage's own key (bot user 13)."; +const esc = (s) => s.replace(/&/g, "&").replace(//g, ">"); +const p = (...xs) => xs.map((x) => `

${esc(x)}

`).join("") + `

${esc(SIG)}

`; +const TASKS = [ + { title: "business: rename the organization file's projects key to repos", + description: p("The organization file's projects key (business.mjs, checkout.mjs) lists the git repositories cloned into a workspace. Row 121 (#1615) adds bus projects (REQ-ORG-2), which hold threads and are created at run time, and a bus project may name one org-file repo id. Two things called project is a real name clash, and the PRD notes flag it. Darkwing raised it in the row 121 design (comment 28555, section 3), and Sage ruled it a follow-up, not part of row 121 (28556, answer 3).", + "The rename is a breaking org-file schema change. It needs a brief and its own queue row: the loader and validator, checkout.mjs, a conversion for existing files with the exact change for Jason's file (decision 144: Jason edits it himself, and Sage sends the change through Mos), the docs, and a re-pin window. Don't start before row 121 lands.") }, + { title: "business: the organization writer's validation refusals carry no code", + description: p("Filbert's row 131 round 2 approve (#1626, comment 28568), non-blocking: a refusal from the writer's new parsed-bytes check (organization.mjs write(), ruling F1b) is a BusinessError with no code. The writer's existing validation refusals have none either. The plug-in setter's own refusals are coded.", + "Give each writer refusal a named code, so a caller and the change log can tell a stale revision, an invalid document and a value that doesn't survive JSON apart. One test and one mutant per code. Check the broker's mapping in request() (the BusinessError case returns invalid-request) and keep it or narrow it on purpose.") }, +]; +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 : []); +async function existing() { + const out = []; + for (let page = 1; page < 20; page++) { + const r = await api("GET", `/api/v2/projects/${PROJECT}/tasks?per_page=50&page=${page}`, undefined, sync); + if (r.status !== 200) throw new Error(`list tasks: ${r.status}`); + out.push(...list(r.json)); + if (list(r.json).length < 50) return out; + } + throw new Error("more than 19 pages"); +} +const rec = { at: new Date().toISOString(), project: PROJECT, created: [], 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 before = await existing(); +const clash = before.filter((t) => TASKS.some((x) => x.title === t.title)); +if (clash.length) throw new Error(`exists: ${clash.map((t) => `#${t.id} ${t.title}`).join("; ")}; refusing`); +writeFileSync(OUT, "", { flag: "wx" }); + +for (const t of TASKS) { + rec.created.push({ title: t.title }); + save(); + const body = { title: t.title, description: t.description, ...(t.due ? { due_date: t.due } : {}) }; + const r = await api("PUT", `/api/v1/projects/${PROJECT}/tasks`, body, key); + if (r.status >= 300 || !Number.isSafeInteger(r.json?.id)) { + rec.problems.push(`create ${t.title}: ${r.status} ${r.json?.code ?? ""} ${r.json?.message ?? ""}`); + break; + } + Object.assign(rec.created.at(-1), { id: r.json.id, index: r.json.index, inverse: `mark done: POST /api/v1/tasks/${r.json.id} done true (pm); delete is Jason's or ops-01's` }); + const back = await api("GET", `/api/v2/tasks/${r.json.id}`, undefined, sync); + Object.assign(rec.created.at(-1), { readBack: back.status, project_back: back.json?.project_id, due_back: back.json?.due_date, done: back.json?.done }); + if (back.status !== 200 || back.json?.title !== t.title || back.json?.project_id !== PROJECT || back.json?.done) rec.problems.push(`${t.title} read-back differs`); +} +save(); +process.stdout.write(JSON.stringify(rec, null, 1) + "\n"); +if (rec.problems.length) process.exit(2); diff --git a/agents/sage/work/vikunja-setup/file-r123-followup.mjs b/agents/sage/work/vikunja-setup/file-r123-followup.mjs new file mode 100644 index 000000000..c27fae3d9 --- /dev/null +++ b/agents/sage/work/vikunja-setup/file-r123-followup.mjs @@ -0,0 +1,63 @@ +// Sage, 2026-10-15: decision 110. Files one follow-up as a task in project 19 with Sage's own key (bot +// user 13): a consume failure after the organization writer commits (row 123 r2, #1617). Refuses if the +// title already exists. The sync key reads it back. No labels, no assignees, no bucket moves. Rollback is +// marking the task done; deletion is Jason's or ops-01's. Prints no secret. +// Usage: node file-r123-followup.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 PROJECT = 19; +const SIG = "Created by Sage (T3 1ef1e4f8) with Sage's own key (bot user 13)."; +const esc = (s) => s.replace(/&/g, "&").replace(//g, ">"); +const p = (...xs) => xs.map((x) => `

${esc(x)}

`).join("") + `

${esc(SIG)}

`; +const TASKS = [ + { title: "bus: organization.set returns outcome-unknown when the consume fails after the writer", + description: p("Filbert's row 123 round 2 approve (#1617, comment 28578), non-blocking. organization.set checks the grant, runs the organization writer, then consumes organization.change in a second store transaction. If that consume fails, the change stands and the receipt names the chief, but the chief gets storage-refused and the log has one action.refused and no action.allowed. Filbert probed it with a store proxy that throws on the transaction after the writer.", + "Return outcome-unknown instead. The bus README already says that code means a mutation may already have committed. A retry is safe because the old revision gives revision-conflict. One test with a store that throws after the writer, and one mutant that puts storage-refused back. Do it after row 123 lands.") }, +]; +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 : []); +async function existing() { + const out = []; + for (let page = 1; page < 20; page++) { + const r = await api("GET", `/api/v2/projects/${PROJECT}/tasks?per_page=50&page=${page}`, undefined, sync); + if (r.status !== 200) throw new Error(`list tasks: ${r.status}`); + out.push(...list(r.json)); + if (list(r.json).length < 50) return out; + } + throw new Error("more than 19 pages"); +} +const rec = { at: new Date().toISOString(), project: PROJECT, created: [], 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 before = await existing(); +const clash = before.filter((t) => TASKS.some((x) => x.title === t.title)); +if (clash.length) throw new Error(`exists: ${clash.map((t) => `#${t.id} ${t.title}`).join("; ")}; refusing`); +writeFileSync(OUT, "", { flag: "wx" }); + +for (const t of TASKS) { + rec.created.push({ title: t.title }); + save(); + const body = { title: t.title, description: t.description, ...(t.due ? { due_date: t.due } : {}) }; + const r = await api("PUT", `/api/v1/projects/${PROJECT}/tasks`, body, key); + if (r.status >= 300 || !Number.isSafeInteger(r.json?.id)) { + rec.problems.push(`create ${t.title}: ${r.status} ${r.json?.code ?? ""} ${r.json?.message ?? ""}`); + break; + } + Object.assign(rec.created.at(-1), { id: r.json.id, index: r.json.index, inverse: `mark done: POST /api/v1/tasks/${r.json.id} done true (pm); delete is Jason's or ops-01's` }); + const back = await api("GET", `/api/v2/tasks/${r.json.id}`, undefined, sync); + Object.assign(rec.created.at(-1), { readBack: back.status, project_back: back.json?.project_id, due_back: back.json?.due_date, done: back.json?.done }); + if (back.status !== 200 || back.json?.title !== t.title || back.json?.project_id !== PROJECT || back.json?.done) rec.problems.push(`${t.title} read-back differs`); +} +save(); +process.stdout.write(JSON.stringify(rec, null, 1) + "\n"); +if (rec.problems.length) process.exit(2); diff --git a/agents/sage/work/vikunja-setup/file-r49-followup.mjs b/agents/sage/work/vikunja-setup/file-r49-followup.mjs new file mode 100644 index 000000000..baf4d68fb --- /dev/null +++ b/agents/sage/work/vikunja-setup/file-r49-followup.mjs @@ -0,0 +1,63 @@ +// Sage, 2026-10-15: decision 110. Files one follow-up as a task in project 19 with Sage's own key (bot +// user 13): a task read in two project reads in one pass aborts recordTask (row 49 r1, #1535). Refuses if the +// title already exists. The sync key reads it back. No labels, no assignees, no bucket moves. Rollback is +// marking the task done; deletion is Jason's or ops-01's. Prints no secret. +// Usage: node file-r49-followup.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 PROJECT = 19; +const SIG = "Created by Sage (T3 1ef1e4f8) with Sage's own key (bot user 13)."; +const esc = (s) => s.replace(/&/g, "&").replace(//g, ">"); +const p = (...xs) => xs.map((x) => `

${esc(x)}

`).join("") + `

${esc(SIG)}

`; +const TASKS = [ + { title: "tasks: keep the highest comment cursor per task when one pass reads a task twice", + description: p("Filbert's row 49 round 1 approve (#1535, comment 28579), non-blocking. foreignComments no longer updates lastComment inside the loop. If a task moves between two project reads in the same tick or reconcile and has a new comment, both reads push the same cursor. The forward trigger rejects the second insert and the whole recordTask rolls back. Filbert's probe: two equal inserts for one task in one transaction give 'comment cursor must advance' and zero rows. The next pass recovers, and nothing is lost or duplicated.", + "Keep the highest cursor per task in out instead. One test that reads the same task in two project reads in one pass, and one mutant that puts the duplicate push back. Do it after row 49 lands.") }, +]; +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 : []); +async function existing() { + const out = []; + for (let page = 1; page < 20; page++) { + const r = await api("GET", `/api/v2/projects/${PROJECT}/tasks?per_page=50&page=${page}`, undefined, sync); + if (r.status !== 200) throw new Error(`list tasks: ${r.status}`); + out.push(...list(r.json)); + if (list(r.json).length < 50) return out; + } + throw new Error("more than 19 pages"); +} +const rec = { at: new Date().toISOString(), project: PROJECT, created: [], 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 before = await existing(); +const clash = before.filter((t) => TASKS.some((x) => x.title === t.title)); +if (clash.length) throw new Error(`exists: ${clash.map((t) => `#${t.id} ${t.title}`).join("; ")}; refusing`); +writeFileSync(OUT, "", { flag: "wx" }); + +for (const t of TASKS) { + rec.created.push({ title: t.title }); + save(); + const body = { title: t.title, description: t.description, ...(t.due ? { due_date: t.due } : {}) }; + const r = await api("PUT", `/api/v1/projects/${PROJECT}/tasks`, body, key); + if (r.status >= 300 || !Number.isSafeInteger(r.json?.id)) { + rec.problems.push(`create ${t.title}: ${r.status} ${r.json?.code ?? ""} ${r.json?.message ?? ""}`); + break; + } + Object.assign(rec.created.at(-1), { id: r.json.id, index: r.json.index, inverse: `mark done: POST /api/v1/tasks/${r.json.id} done true (pm); delete is Jason's or ops-01's` }); + const back = await api("GET", `/api/v2/tasks/${r.json.id}`, undefined, sync); + Object.assign(rec.created.at(-1), { readBack: back.status, project_back: back.json?.project_id, due_back: back.json?.due_date, done: back.json?.done }); + if (back.status !== 200 || back.json?.title !== t.title || back.json?.project_id !== PROJECT || back.json?.done) rec.problems.push(`${t.title} read-back differs`); +} +save(); +process.stdout.write(JSON.stringify(rec, null, 1) + "\n"); +if (rec.problems.length) process.exit(2); diff --git a/agents/sage/work/window-plan/schema-chain-3c-3e.md b/agents/sage/work/window-plan/schema-chain-3c-3e.md new file mode 100644 index 000000000..e25aa5fb7 --- /dev/null +++ b/agents/sage/work/window-plan/schema-chain-3c-3e.md @@ -0,0 +1,71 @@ +# Bus schema window: 3b to 3e (rows 49, 123, 132, 121) + +Sage, 2026-10-15. Draft for Mos. Nothing here is authorized yet; the window +is Mos's to schedule, and the steps follow docs/TOOLS.md "later update" with +the migration from agents/rocko/work/queue-49/r1/MIGRATION.md inserted. + +## What has to land first + +| Row | Issue | Schema step | State today | +|-----|-------|-------------|-------------| +| 49 | #1535 | 3b → 3c, comment cursors and the migrator | Filbert approved (28579); Darkwing's verdict pending | +| 123 | #1617 | 3c → 3d, revoke with a reason | Filbert approved r2 (28578); lands after 49 | +| 132 | #1628 | none, harness tools for the chief | queued; must land before 3d goes live (Sage, #1617 comment 28565) | +| 121 | #1615 | 3d → 3e | Darkwing building on eaeb5ebf2; lands after 49 and 123 | + +One window, after all four land. `migrate-schema.mjs` chains the steps in +order, each committed version a resume boundary, so one call takes the live +store from 3b to 3e. Three windows would mean three bus stops for no gain. +If 121 slips, the window can go at 3d with 49, 123 and 132; 3d → 3e then +needs its own window. + +## Gap between row 49 landing and the window (Filbert, 28579 note 2) + +Once row 49 lands, `scripts/land-work/read.mjs` imports `SCHEMA_VERSION` +from store.mjs. From any tree at or after that commit it refuses the live 3b +bus with `bus-schema`. It fails closed, so nothing is damaged, but every +`scripts/land-work.sh` run against the live bus refuses until Mos migrates. +The live copy (2f57e3c59) carries no land-work, so the canonical checkout is +the only place it runs from. + +Rule for the gap: no land-work run against the live bus between the row 49 +landing and the migration. A merge decision the PM raises in the gap stays +open and is landed after the window. My own landings use +`scripts/conductor-apply.sh` and don't read the bus, so rows 123, 132 and 121 +can still land in the gap. Row 49's MIGRATION.md doesn't name this; the +window record should. + +## Timing constraint on the 3b → 3c step + +MIGRATION.md step 3: the first epoch is migration host time minus a +60-second margin. Comments posted while the bus is down and more than a +minute before the migration can't be told apart from history. So Mos runs +the migration right after stopping the bus, backup in between, and doesn't +hold the store stopped and unmigrated. Later outages use stored ids and +have no such limit. + +## Checks to add to the window + +1. Before the stop: `stack-copy.sh copy NEW`, as usual. Confirm NEW contains + rows 49, 123, 132 and 121 (or the agreed subset). +2. Backup of the whole stopped bus directory, WAL included (MIGRATION.md + step 2). Record the backup path and OLD copy id. +3. `node /packages/bus/src/migrate-schema.mjs `. + Any refusal stops the window; rollback is the backup plus OLD. +4. Re-pin and start the bus on NEW. Pass if `status` is active and the bus + log shows `bus schema 3e ready` (or 3d for the subset). +5. Harness tools check for row 132: the chief's tool list carries + `role.revoke` and `organization.set` as typed tools. Exact command comes + with row 132's packet. +6. Claude resume smoke: a role session that existed before the window + resumes on NEW and answers one `[mos test]` talk. PM tests stay + talk/follow/read only. +7. land-work read check: `node scripts/land-work/read.mjs` from the + canonical checkout no longer refuses `bus-schema`. Only after this does + any held merge decision get landed. + +## Rollback + +Code can't downgrade the schema. With the bus stopped and Mos's go: restore +the full bus-directory backup and re-pin OLD. Anything recorded after the +backup is lost; Sage and Mos decide that together.