Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
8bab38a
goal(FIX-2242): FIX-2070's removed message names are rows in the voca…
claude Oct 28, 2026
bef89c8
goal(FIX-2242): the FIX-2070 closure walk, workers-talk-together
claude Oct 28, 2026
010f194
goal(FIX-2242): scene ed setup fixes, and the filer's steer must carr…
claude Oct 28, 2026
da07eb3
goal(FIX-2242): the ring never waits for a reply
claude Oct 28, 2026
de4cc8e
Merge remote-tracking branch 'origin/main' into claude/project-thread…
claude Oct 28, 2026
67836e9
goal(FIX-2242): leg 1 asks for a send, not a call, now that sendMessa…
claude Oct 28, 2026
7756729
Merge remote-tracking branch 'origin/main' into claude/project-thread…
claude Oct 28, 2026
1ee64a2
goal(FIX-2242): a question asked and answered between two polls is re…
claude Oct 28, 2026
77e5cc1
goal(FIX-2242): scene ed's task must ask before it writes; a told que…
claude Oct 28, 2026
2c4fc4d
goal(FIX-2242): scene ed's task asks before it writes
claude Oct 28, 2026
e2b7302
goal(FIX-2242): read the task's steers from its full read
claude Oct 28, 2026
e75e349
goal(FIX-2242): first verdict row
claude Oct 28, 2026
23dc3d9
goal(FIX-2242): Codex's findings: the seventh refusal is the ring's o…
claude Oct 28, 2026
7505b4b
Merge remote-tracking branch 'origin/main' into claude/project-thread…
claude Oct 28, 2026
66bd6ce
goal(FIX-2242): follow main's renames (questions, answers); drop an u…
claude Oct 28, 2026
b468a04
goal(FIX-2242): Codex's second round: the browser counts the ring's o…
claude Oct 28, 2026
cec952a
goal(FIX-2242): a scene that ends early reads its other assertions FAIL
claude Oct 28, 2026
9086175
goal(FIX-2242): b:task-unchanged compares the whole settled row
claude Oct 28, 2026
bfb443f
Merge remote-tracking branch 'origin/main' into claude/project-thread…
claude Oct 28, 2026
e493cb8
goal(FIX-2242): read the stop by its user_approval reason
claude Oct 28, 2026
2508825
goal(FIX-2242): the sweep's control expects only the --only families'…
claude Oct 28, 2026
b4a6049
Merge remote-tracking branch 'origin/main' into claude/project-thread…
claude Oct 28, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,8 @@ jobs:
- name: One word per thing
run: node goals/vocabulary/one-word-per-thing/sweep.mjs

# The planted parkOnAsk must still be reported, or the sweep above could
# pass because it stopped reading a file.
# The planted parkOnAsk, messageWorker and replyTo must still be reported,
# or the sweep above could pass because it stopped reading a file.
- name: The vocabulary sweep reports its plant
run: node goals/vocabulary/one-word-per-thing/sweep.mjs --control

Expand Down
34 changes: 34 additions & 0 deletions goals/shift-manager/workers-message-each-other/checkout.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**
* The tree a goal run serves: this checkout, or another commit's own tree and
* install (`GOAL_COMMIT`), so a before-state control runs that commit's code.
* Shared with FIX-2242's closure goal (`workers-talk-together`).
*/
import { execFileSync, spawnSync } from "node:child_process";
import { existsSync, mkdirSync } from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { REPO_ROOT } from "../../lib/index.mts";

const say = (s: string) => console.error(`[checkout ${new Date().toISOString().slice(11, 19)}] ${s}`);

/** The tree a run serves: this checkout, or another commit's own tree and install. */
export function checkoutFor(commit: string | undefined): { root: string; commit: string; describe: string } {
const git = (...args: string[]) => execFileSync("git", ["-C", REPO_ROOT, ...args], { encoding: "utf8" }).trim();
if (commit === undefined || commit === "") {
const head = git("rev-parse", "HEAD");
const dirty = git("status", "--porcelain", "--", ".", ":(exclude)goals").length > 0;
return { root: REPO_ROOT, commit: head, describe: `this checkout, \`${head.slice(0, 9)}\`${dirty ? " with uncommitted changes outside goals/" : ""}` };
}
const sha = git("rev-parse", `${commit}^{commit}`);
const root = join(tmpdir(), "fsd-goal-messages-trees", sha.slice(0, 12));
if (!existsSync(join(root, "package.json"))) {
mkdirSync(root, { recursive: true });
execFileSync("sh", ["-c", `git -C "${REPO_ROOT}" archive --format=tar ${sha} | tar -x -C "${root}"`]);
}
if (!existsSync(join(root, "node_modules"))) {
say(`installing ${sha.slice(0, 9)} in ${root}`);
const installed = spawnSync("pnpm", ["install", "--frozen-lockfile", "--prefer-offline"], { cwd: root, encoding: "utf8", timeout: 900_000 });
if (installed.status !== 0) throw new Error(`setup: ${sha} did not install: ${(installed.stdout + installed.stderr).slice(-1500)}`);
}
return { root, commit: sha, describe: `\`${sha.slice(0, 9)}\` (GOAL_COMMIT=${commit}), its own tree and install` };
}
11 changes: 6 additions & 5 deletions goals/shift-manager/workers-message-each-other/faults.mts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* each appends a line to the run's fault log (`GOAL_FAULT_LOG`) when it fires,
* so a sub-leg whose fault never fired is a setup failure, not a grade.
*
* Every fault touches only the herald's messages, so the rest of the install
* runs as shipped. Fault patches keep the line they anchor on, so a control
* Every fault touches only one sender's messages (the herald's here; FIX-2242's
* closure names its own), so the rest of the install runs as shipped. Fault patches keep the line they anchor on, so a control
* patching the same line still finds it: the runner applies the faults first.
*/
import { existsSync, readFileSync } from "node:fs";
Expand Down Expand Up @@ -98,9 +98,10 @@ export const FAULTS: Record<FaultName, { does: string; patches: ModulePatch[] }>
},
};

/** The patches for `faults`, in order. */
export function faultPatches(faults: readonly FaultName[]): ModulePatch[] {
return faults.flatMap((f) => FAULTS[f].patches);
/** The patches for `faults`, in order, each firing only on messages from `sender`. */
export function faultPatches(faults: readonly FaultName[], sender = "herald"): ModulePatch[] {
const from = JSON.stringify(sender);
return faults.flatMap((f) => FAULTS[f].patches.map((p) => ({ ...p, to: p.to.replaceAll('"herald"', from) })));
}

/** One line of the fault log. */
Expand Down
2 changes: 1 addition & 1 deletion goals/shift-manager/workers-message-each-other/goal.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

**Signal:** each failure is tagged `<leg>:<assertion>`.

- **1** (Alice tells Researcher *"Ask the Shift Coordinator what the codename is, and tell me"*, after telling the coordinator the codename): `1:sent` Researcher's turn messages the coordinator; `1:answer-holds-codename` a Researcher answer to the person, in a turn after the coordinator's answer landed, holds the codename; `1:coordinator-shows-message` the coordinator's conversation shows exactly one line *From researcher:* under Researcher's name; `1:coordinator-answered` it sent Researcher a message back.
- **1** (Alice tells Researcher *"Ask the Shift Coordinator what the codename is with a message, without waiting for the reply, and tell me once its answer arrives"* (a send, not a call: leg 10 grades calls), after telling the coordinator the codename): `1:sent` Researcher's turn messages the coordinator; `1:answer-holds-codename` a Researcher answer to the person, in a turn after the coordinator's answer landed, holds the codename; `1:coordinator-shows-message` the coordinator's conversation shows exactly one line *From researcher:* under Researcher's name; `1:coordinator-answered` it sent Researcher a message back.
- **1b** (the other way): `1b:sent` the coordinator, told to tell Researcher a new codename, messages it; `1b:researcher-shows-message` Researcher's conversation shows it under the coordinator's name; `1b:next-answer-holds-it` Researcher's next answer to the person holds it.
- **2** (from a task): the coordinator files Researcher a task to ask Helper A its favourite colour. `2:filed` the coordinator's board holds the task; `2:reached-helper` and `2:from-task` the message to Helper A was sent from the task's own session; `2:answered` Helper A answers it; `2:lands-in-own-conversation` the answer lands in Researcher's own conversation, not the task's ended session, under Helper A's name with the colour; `2:wakes` a Researcher turn writes after it; `2:no-row` Helper A's board holds no row.
- **3b** (through a delegation): Researcher messages Helper A, Helper A files Helper B a task, Helper B's task messages Researcher. `3b:counts-on` that message is counted in the exchange Researcher's line started: the same chain in the log, at a later hop.
Expand Down
4 changes: 2 additions & 2 deletions goals/shift-manager/workers-message-each-other/legs-calls.mts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const SLACK_MS = 6_000;
const show = (value: unknown) => JSON.stringify(value)?.slice(0, 500);

/** A turn, read until its request ends: a call parks it on a wait, which isn't an end. */
async function talkThrough(world: World, leg: string, worker: string, session: SessionSummary, words: string, timeoutMs = 180_000): Promise<Turn & { seen: string[]; seenAt: number[] }> {
export async function talkThrough(world: World, leg: string, worker: string, session: SessionSummary, words: string, timeoutMs = 180_000): Promise<Turn & { seen: string[]; seenAt: number[] }> {
const { alice } = world;
const client = alice.flow(session.flowKind);
const requestId = (await client.send("respond", { message: words }, { sessionId: session.id })).id;
Expand Down Expand Up @@ -74,7 +74,7 @@ async function talkThrough(world: World, leg: string, worker: string, session: S
* When a parked turn went on: the first time it read as running again after
* it first parked, as polled every 500 ms. A call's answer is the turn going on.
*/
function resumedAt(turn: { seen: string[]; seenAt: number[] }): number | undefined {
export function resumedAt(turn: { seen: string[]; seenAt: number[] }): number | undefined {
const parked = turn.seen.indexOf("suspended");
if (parked < 0) return undefined;
const next = turn.seen.findIndex((status, i) => i > parked && status !== "suspended");
Expand Down
14 changes: 7 additions & 7 deletions goals/shift-manager/workers-message-each-other/legs-delivery.mts
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ export type SubLeg = (typeof SUB_LEGS)[number];
/** Hired for 9:late-refusal and fired mid-leg, so Helper B stays on the roster for every other leg. */
export const LATE_HELPER = "late-helper";
/** The block name the pass's resend is dispatched from (`MESSAGE_RESEND_FROM`). */
const RESEND_FROM = "worker-message-resend";
export const RESEND_FROM = "worker-message-resend";
const RECEIVED_ENTRY = "onMessageReceived";
const ROSTER_FLOW = "workforce-roster";
/** Every send here is a plain message: a call (FIX-2239) parks the herald's turn on the reply, which no sub-leg grades. */
const NO_WAIT = "Send it as a plain message: don't wait for a reply.";
/** How long a takeover from a crashed taker may take: the engine's stale-heartbeat window, then one backoff step (32 s). */
const TAKEOVER_MS = 120_000;
export const TAKEOVER_MS = 120_000;

type SessionSummary = { id: string; flowKind: string };
type Request = Record<string, any>;
Expand All @@ -63,14 +63,14 @@ export interface Servers {
const fired = (servers: Servers, fault: FaultName, since: number): FaultLine[] => faultLines(servers.faultLog).filter((l) => l.fault === fault && l.at >= since);

/** The `onMessageReceived` requests for message `id` in `sessionId`, oldest first. */
async function requestsFor(who: Connected, sessionId: string, id: string): Promise<Request[]> {
export async function requestsFor(who: Connected, sessionId: string, id: string): Promise<Request[]> {
return (await who.routes.requests(sessionId))
.filter((r) => (r.actionName ?? r.action) === RECEIVED_ENTRY && r.input?.messageId === id)
.sort((a, b) => Number(a.createdAt ?? 0) - Number(b.createdAt ?? 0));
}

/** The block a request's dispatch stamp names as its sender, and the session it came from. */
const senderOf = (r: Request | undefined) => ({
export const senderOf = (r: Request | undefined) => ({
block: r?.metadata?.dispatch?.from?.block as string | undefined,
session: r?.metadata?.dispatch?.from?.sessionId as string | undefined,
});
Expand All @@ -81,7 +81,7 @@ async function rowOf(who: Connected, id: string): Promise<MessageRow | undefined
}

/** What a reader of "took it" needs: the row, its received items, and the requests for it. */
interface Took {
export interface Took {
ok: boolean;
why: string;
row: MessageRow | undefined;
Expand All @@ -90,7 +90,7 @@ interface Took {
}

/** Whether the recipient took message `id`, as the file header defines it. */
async function took(who: Connected, id: string): Promise<Took> {
export async function took(who: Connected, id: string): Promise<Took> {
const row = await rowOf(who, id);
if (row === undefined) return { ok: false, why: `no row for ${id}`, row, requests: [], delivering: undefined };
const items = (await receivedIn(who, row.toSession)).filter((m) => m.id === id);
Expand All @@ -103,7 +103,7 @@ async function took(who: Connected, id: string): Promise<Took> {
}

/** Poll {@link took} until it holds, or the last reading after `timeoutMs`. */
async function tookWithin(who: Connected, id: string, timeoutMs: number): Promise<Took> {
export async function tookWithin(who: Connected, id: string, timeoutMs: number): Promise<Took> {
const got = await until(async () => {
const t = await took(who, id);
return t.ok ? t : undefined;
Expand Down
2 changes: 1 addition & 1 deletion goals/shift-manager/workers-message-each-other/legs.mts
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ export async function leg1(world: World): Promise<LegResult> {
const told = await talk(turns, "1", alice, SHIFT_COORDINATOR, shiftCoordinator, `The team's codename is ${codename}. Any worker on the team may ask you for it, and you should tell them. Reply only with "Noted."`);
if (told.status !== "completed") r.failures.push(`1:setup — the Shift Coordinator's turn on the codename ${told.status}: ${told.reply.slice(0, 300)}`);

const asked = await talk(turns, "1", alice, RESEARCHER, researcher, `Ask the Shift Coordinator (worker id ${SHIFT_COORDINATOR}) what the codename is, and tell me.`);
const asked = await talk(turns, "1", alice, RESEARCHER, researcher, `Ask the Shift Coordinator (worker id ${SHIFT_COORDINATOR}) what the codename is with a message, without waiting for the reply (no wait), and tell me once its answer arrives.`);
const sent = asked.calls.filter((c) => c.args.to === SHIFT_COORDINATOR && typeof c.output?.sent === "string");
if (sent.length === 0) {
r.failures.push(`1:sent — Researcher's turn sent the Shift Coordinator no message: its calls ${show(asked.calls.map((c) => ({ args: c.args, output: c.output })))}; reply: ${asked.reply.slice(0, 200)}`);
Expand Down
49 changes: 16 additions & 33 deletions goals/shift-manager/workers-message-each-other/run.mts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@
* Legs: GOAL_LEGS=1,1b,2,3b,3,4,6,7,8,9,10,10b,10c,5 (default: all, in that order)
* GOAL_LEG9=<sub-leg,...> runs only those of leg 9 (legs-delivery.mts names them)
*/
import { execFileSync, spawnSync } from "node:child_process";
import { spawnSync } from "node:child_process";
import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, statSync } from "node:fs";
import { tmpdir } from "node:os";
import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url";
import { pathToFileURL } from "node:url";
import { REPO_ROOT, RUN_STAMP, goalTmpDir, keysServing, runGoal } from "../../lib/index.mts";
import { RUN_STAMP, goalTmpDir, keysServing, runGoal } from "../../lib/index.mts";
import { assertPatched, describePatches, modulePatchEnv } from "../../lib/module-patch.mts";
import { launchChromium } from "../../lib/playwright.mts";
import { buildShiftManagerPages, openShiftManager, personPage, startShiftManager, type ServedShiftManager } from "../../lib/shift-manager.mts";
Expand Down Expand Up @@ -43,6 +42,7 @@ import { leg10, leg10b, leg10c, WAIT_DEFAULT_MS } from "./legs-calls.mts";
import { leg6, leg7, leg8, setupTargets, type Targets } from "./legs-targets.mts";
import { leg9, SUB_LEGS, type Servers, type SubLeg } from "./legs-delivery.mts";
import { faultPatches, type FaultName } from "./faults.mts";
import { checkoutFor } from "./checkout.mts";

const SCRATCH = goalTmpDir("workers-message");
const ORDER = ["1", "1b", "2", "3b", "3", "4", "6", "7", "8", "9", "10", "10b", "10c", "5"] as const;
Expand All @@ -69,52 +69,35 @@ const subLegs = new Set(
) as Set<SubLeg>;
for (const s of subLegs) if (!(SUB_LEGS as readonly string[]).includes(s)) throw new Error(`unknown sub-leg "${s}" in GOAL_LEG9`);

/** The tree a run serves: this checkout, or another commit's own tree and install. */
function checkoutFor(commit: string | undefined): { root: string; commit: string; describe: string } {
const git = (...args: string[]) => execFileSync("git", ["-C", REPO_ROOT, ...args], { encoding: "utf8" }).trim();
if (commit === undefined || commit === "") {
const head = git("rev-parse", "HEAD");
const dirty = git("status", "--porcelain", "--", ".", ":(exclude)goals").length > 0;
return { root: REPO_ROOT, commit: head, describe: `this checkout, \`${head.slice(0, 9)}\`${dirty ? " with uncommitted changes outside goals/" : ""}` };
}
const sha = git("rev-parse", `${commit}^{commit}`);
const root = join(tmpdir(), "fsd-goal-messages-trees", sha.slice(0, 12));
if (!existsSync(join(root, "package.json"))) {
mkdirSync(root, { recursive: true });
execFileSync("sh", ["-c", `git -C "${REPO_ROOT}" archive --format=tar ${sha} | tar -x -C "${root}"`]);
}
if (!existsSync(join(root, "node_modules"))) {
say(`installing ${sha.slice(0, 9)} in ${root}`);
const installed = spawnSync("pnpm", ["install", "--frozen-lockfile", "--prefer-offline"], { cwd: root, encoding: "utf8", timeout: 900_000 });
if (installed.status !== 0) throw new Error(`setup: ${sha} did not install: ${(installed.stdout + installed.stderr).slice(-1500)}`);
}
return { root, commit: sha, describe: `\`${sha.slice(0, 9)}\` (GOAL_COMMIT=${commit}), its own tree and install` };
}

/** The names FIX-2238 removed, as Workforce wrote them. `replyTo` only where the message field lived. */
const REMOVED = /\b(onWorkerMessage|messageWorker|MESSAGE_WORKER_TOOL|WORKER_MESSAGE_ENTRY|workerMessageEntry|workforceRelayTo|takes_tasks_only|no_turn|takesWorkerMessages|sendWorkerMessage|answerTo)\b/;
const REMOVED_FIELD = /\breplyTo\b/;
/** The names FIX-2070 removed: the vocabulary sweep's two rows (FIX-2242 D2), so there is one list. */
type RetiredRow = { id: string; files: RegExp; pattern: RegExp };
const RULES = new URL("../../vocabulary/one-word-per-thing/rules.mjs", import.meta.url).href;
const { RETIRED } = (await import(RULES)) as { RETIRED: RetiredRow[] };
const REMOVED_ROWS = RETIRED.filter((r) => r.id === "message-names" || r.id === "message-reply-to");

/** `sweep`: no package's source names a removed name. */
/** `sweep`: no package's source names a removed name, each row at its own scope. */
function sweep(root: string): string[] {
if (REMOVED_ROWS.length !== 2) return ["sweep — setup: the vocabulary sweep's message rows are missing"];
const hits: string[] = [];
const walk = (dir: string, field: boolean) => {
const walk = (dir: string) => {
for (const name of readdirSync(dir)) {
const path = join(dir, name);
if (statSync(path).isDirectory()) walk(path, field);
if (statSync(path).isDirectory()) walk(path);
else if (/\.(ts|tsx|mts)$/.test(name)) {
const rel = path.slice(root.length + 1);
const rows = REMOVED_ROWS.filter((r) => r.files.test(rel));
readFileSync(path, "utf8")
.split("\n")
.forEach((line, i) => {
if (REMOVED.test(line) || (field && REMOVED_FIELD.test(line))) hits.push(`${path.slice(root.length + 1)}:${i + 1}: ${line.trim().slice(0, 120)}`);
if (rows.some((r) => r.pattern.test(line))) hits.push(`${rel}:${i + 1}: ${line.trim().slice(0, 120)}`);
});
}
}
};
const packages = join(root, "packages");
for (const pkg of readdirSync(packages)) {
const src = join(packages, pkg, "src");
if (existsSync(src)) walk(src, pkg === "workforce" || pkg === "shift-manager");
if (existsSync(src)) walk(src);
}
return hits.length === 0 ? [] : [`sweep — removed names are still in package source: ${hits.slice(0, 8).join(" | ")}`];
}
Expand Down
Loading
Loading