Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
3d7effe
test(FIX-2087): the closure's goal and the task-surface sweep in CI
claude Oct 23, 2026
63da04f
test(FIX-2087): the closure's first verdicts
claude Oct 23, 2026
f6d06f1
test(FIX-2087): the sweep reads tools and endings by symbol; controls…
claude Oct 23, 2026
b6f75bf
test(FIX-2087): a forwarder exempts only its forwarding; every block …
claude Oct 23, 2026
fdb18c5
Merge remote-tracking branch 'origin/main' into fix/FIX-2087
claude Oct 23, 2026
b76f76b
test(FIX-2087): j1 counts only notice requests that ran a turn; j1:he…
claude Oct 23, 2026
e7c24c7
Merge remote-tracking branch 'origin/main' into fix/FIX-2087
claude Oct 23, 2026
7e07954
Merge remote-tracking branch 'origin/main' into fix/FIX-2087
claude Oct 23, 2026
deaccbd
test(FIX-2087): row 3 grades the closure's own findings
claude Oct 23, 2026
1ba899d
test(FIX-2087): classify the closure goal in FIX-1792's census
claude Oct 23, 2026
89217e4
test(FIX-2087): the closure's verdict on main with every closure fix …
claude Oct 23, 2026
024a259
Merge remote-tracking branch 'origin/main' into fix/FIX-2087
claude Oct 23, 2026
5e5ee0e
test(FIX-2087): row 3 grades FIX-2123, FIX-2135 and FIX-2136
claude Oct 23, 2026
455b3fb
test(FIX-2087): a hearing is a notice admitted, not a request started
claude Oct 23, 2026
1defdcc
Merge remote-tracking branch 'origin/main' into fix/FIX-2087
claude Oct 23, 2026
e51ac8b
test(FIX-2087): row 3 runs FIX-2138's regression test
claude Oct 23, 2026
cde0a95
test(FIX-2087): round 3's verdicts
claude Oct 23, 2026
46a6629
Merge origin/main into fix/FIX-2087
claude Oct 23, 2026
4ec08e6
test(goals): grade FIX-2147, FIX-2149 and FIX-2150 in the closure's r…
claude Oct 23, 2026
8a5ed55
refactor(goals): fold the shorter one-task notes from #3790 (083cef8a…
claude Oct 23, 2026
77dd49e
fix(goals): the closure fails closed, and grades a word-for-word foll…
claude Oct 23, 2026
683c151
fix(goals): every control's tags must go red, and the door rule reads…
claude Oct 23, 2026
9a35628
fix(goals): read a control's red from its tagged failures, and bring …
claude Oct 24, 2026
b6516a8
docs(goals): the closure's goal states how a control is read and what…
claude Oct 24, 2026
eb33735
docs(goals): round 4's verdicts in the closure's log (FIX-2087)
claude Oct 24, 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
Prev Previous commit
Next Next commit
fix(goals): the closure fails closed, and grades a word-for-word foll…
…ow-up as judgment (FIX-2087)

From Codex's review of #3692:
- row 3 fails (children:cant-tell) when the live Linear set can't be read:
  no key, an HTTP error, GraphQL errors or no relations in the answer;
- a closure control that leaves its tag green fails the run (control:broken);
- the sweep reads a claim-passing cancel through .call, .apply, element
  access and destructuring, and counts one handed on by .bind; --control
  plants each shape, and the same shapes with no claim, which must not be
  reported (17 plants, 23 lines);
- row 4 passes a gaps row only when every check it names ran in the same
  closure run and passed (a goal, its named controls, a test file, a row-1
  assertion whose leg passed, the sweep); a stale or unrun label fails.

From round 4's walk: writer's follow-up turn wrote the original draft word
for word, so the two result lines read alike and a:lands-once, a:once and
a:follow-up failed on a correct run. a:follow-up now wants a turn of
writer's after the follow-up was filed; the new version is judgment
(a:follow-up-differs); lines that read alike are told apart by when each
landed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VaN4uTiYqiabCbsFLWM52A
  • Loading branch information
claude committed Oct 23, 2026
commit 77dd49ebd98dbf001940e4e33e75199ddb492989
35 changes: 28 additions & 7 deletions goals/workforce-coordination/runs-on-one-task/children.mts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Plan row 3: every child's own goal or check, with its controls, on the closure's commit. The
* set is every child of FIX-2056 blocking FIX-2087 when the run starts, read from Linear (with
* `LINEAR_API_KEY`; without it, the set below, said so), and printed as read. A child with no
* `LINEAR_API_KEY`; when it can't be read, row 3 runs the set below and fails), and printed as read. A child with no
* entry in {@link CHECKS} is a failure: the closure can't grade what it can't run.
*
* Plus every goal under `goals/coordinators/` and `goals/hand-offs/`, and FIX-2005's leg of
Expand Down Expand Up @@ -135,17 +135,21 @@ export const NAMED: Check[] = [
{ goal: "goal-seek-loop/replans-until-done", walked: "j3: a goal-seek loop that replans; refuses-a-board-built-wrong holds its delegation-board refusal" },
];

/** The children blocking FIX-2087, read from Linear. */
async function childrenFromLinear(): Promise<Array<{ id: string; title: string }> | undefined> {
/** The children blocking FIX-2087, read from Linear. Throws when the set can't be read: no key, a failed request, or an answer without the issue's relations. */
async function childrenFromLinear(): Promise<Array<{ id: string; title: string }>> {
const key = process.env.LINEAR_API_KEY ?? "";
if (key === "") return undefined;
if (key === "") throw new Error("LINEAR_API_KEY is unset");
const response = await fetch("https://api.linear.app/graphql", {
method: "POST",
headers: { authorization: key, "content-type": "application/json" },
body: JSON.stringify({ query: 'query { issue(id: "FIX-2087") { inverseRelations(first: 100) { nodes { type issue { identifier title parent { identifier } } } } } }' }),
});
if (!response.ok) throw new Error(`Linear answered HTTP ${response.status}`);
const body = (await response.json()) as any;
return (body.data?.issue?.inverseRelations?.nodes ?? [])
if (body.errors !== undefined) throw new Error(`Linear answered with errors: ${JSON.stringify(body.errors).slice(0, 300)}`);
const nodes = body.data?.issue?.inverseRelations?.nodes;
if (!Array.isArray(nodes)) throw new Error("Linear's answer holds no relations for FIX-2087");
return nodes
.filter((n: any) => n.type === "blocks" && n.issue.parent?.identifier === "FIX-2056")
.map((n: any) => ({ id: n.issue.identifier, title: n.issue.title }));
}
Expand All @@ -161,6 +165,14 @@ function checkBy(owner: string, check: Check, tags: readonly string[], failures:
if (stale.length > 0) failures.push(`children:${owner} — graded by ${stale.join(", ")}, which no run in this closure holds`);
}

/**
* Each run row 3 made and whether it passed, for row 4: a goal by its path, a control as
* `<path> GOAL_CONTROL=<name>` (passed when it went red as documented), a test file as
* `<package> <file>`. A run made twice passes only if both did.
*/
export const RAN = new Map<string, boolean>();
const record = (key: string, ok: boolean) => RAN.set(key, (RAN.get(key) ?? true) && ok);

/** Run one check (and its controls); push a failure per red run or control that stayed green. */
function runCheck(owner: string, check: Check, failures: string[], report: string[], say: (s: string) => void): void {
const runs: Array<{ control?: string; args: string[]; cmd: string }> = [];
Expand Down Expand Up @@ -190,9 +202,13 @@ function runCheck(owner: string, check: Check, failures: string[], report: strin
if (run.control === undefined) {
report.push(` ${out.status === 0 ? "PASS" : "FAIL"} ${label} (${secs}s)${check.walked ? ` · row 1 walks ${check.walked}` : ""}: ${verdict}`);
if (out.status !== 0) failures.push(`children:${owner} — ${label} ${verdict}: ${(/FAIL —[\s\S]{0,1200}/.exec(text)?.[0] ?? text.slice(-1200)).replace(/\n/g, " | ")}`);
if (check.goal !== undefined) record(check.goal, out.status === 0);
else if (check.script !== undefined) record(check.script, out.status === 0);
else for (const file of check.vitest!.files) record(`${check.vitest!.filter} ${file}`, out.status === 0);
} else {
const tags = check.controls![run.control]!;
const red = out.status === 1 && tags.some((t) => text.includes(t.endsWith(":") ? `- ${t}` : t) || text.includes(t));
Comment thread
jhoffner marked this conversation as resolved.
Resolved
record(`${check.goal} GOAL_CONTROL=${run.control}`, red);
report.push(` ${red ? "FAIL (expected)" : "CONTROL BROKEN"} ${label} (${secs}s): wanted one of ${tags.join(", ")} red; ${verdict}`);
if (!red) failures.push(`children:${owner} — control ${run.control} of ${check.goal} did not fail as documented (exit ${out.status}): ${text.slice(-800).replace(/\n/g, " | ")}`);
}
Expand All @@ -201,8 +217,13 @@ function runCheck(owner: string, check: Check, failures: string[], report: strin

/** Run row 3. `tags` are row 1's assertions, which a check's `by` may name. */
export async function runChildren(failures: string[], report: string[], say: (s: string) => void, tags: readonly string[]): Promise<void> {
const read = await childrenFromLinear().catch(() => undefined);
const blocking = read ?? Object.keys(CHECKS).map((id) => ({ id, title: "(not read: LINEAR_API_KEY unset)" }));
// Without the live set, row 3 can't tell a child it has no check for: it still runs the
// built-in set, and fails.
const read = await childrenFromLinear().catch((error: unknown) => {
failures.push(`children:cant-tell — the children blocking FIX-2087 weren't read from Linear (${error instanceof Error ? error.message : String(error)}), so a child with no check here would go unseen`);
return undefined;
});
const blocking = read ?? Object.keys(CHECKS).map((id) => ({ id, title: "(not read from Linear)" }));
// A child with a check here that Linear doesn't list as blocking still runs: a closure fix
// filed without the blocking relation is still a fix the closure rests on.
const unlisted = Object.keys(CHECKS).filter((id) => !blocking.some((c) => c.id === id));
Expand Down
52 changes: 51 additions & 1 deletion goals/workforce-coordination/runs-on-one-task/engine.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,8 @@ export function sweepTaskSurface({ repo, plants = [], tracked: given, table: tab
// ---- endings · read by type ---------------------------------------------------------------
// A task collection is any value whose type has the collection's lifecycle: claim, complete,
// fail and cancel. Its `complete` or `fail` called, or its `cancel` called with the caller's
// own claim, is an ending; so is a call of a pass-through helper.
// own claim (in any shape: `.call`, `.apply`, element access, destructured), is an ending; so
// is a cancel handed on (`.bind`, passed as a value), and a call of a pass-through helper.
const isCollection = (type) => {
const t = checker.getApparentType(checker.getNonNullableType(type));
return ["claim", "complete", "fail", "cancel"].every((p) => t.getProperty(p) !== undefined);
Expand Down Expand Up @@ -323,6 +324,51 @@ export function sweepTaskSurface({ repo, plants = [], tracked: given, table: tab
};
const ENDS = ["complete", "fail"];
const onCollection = (receiver, name) => isCollection(checker.getTypeAtLocation(receiver)) || (name !== undefined && declaredOnCollection(name));
/**
* Whether `expr` is a task collection's `cancel` in a shape other than `x.cancel`: `x["cancel"]`,
* or a name destructured from a collection (`const { cancel: c } = x`). A cancel is an ending
* only under the caller's own claim, so the call's claim argument decides, as for `x.cancel(...)`.
*/
const isCancelRef = (expr) => {
if (ts.isElementAccessExpression(expr)) return ts.isStringLiteralLike(expr.argumentExpression) && expr.argumentExpression.text === "cancel" && isCollection(checker.getTypeAtLocation(expr.expression));
if (!ts.isIdentifier(expr)) return false;
return (checker.getSymbolAtLocation(expr)?.declarations ?? []).some(
(d) => ts.isBindingElement(d) && ts.isObjectBindingPattern(d.parent) && (d.propertyName ?? d.name).getText() === "cancel" && isCollection(checker.getTypeAtLocation(d.parent)),
);
};
/** `x.cancel` or {@link isCancelRef}: any reference to a task collection's cancel. */
const isAnyCancel = (expr) => (ts.isPropertyAccessExpression(expr) && expr.name.text === "cancel" && onCollection(expr.expression, expr.name)) || isCancelRef(expr);
/**
* The ending a call of a collection's cancel makes, through `.call`/`.apply` or a shape
* {@link isCancelRef} reads (`x.cancel(...)` itself is read below, with the removed members).
* `.apply` with an argument list it can't read counts, since its claim can't be told apart.
*/
const cancelCallEnding = (node, sf) => {
const callee = node.expression;
if (isCancelRef(callee)) return passesClaim(node.arguments[2]) ? `${callee.getText(sf)}() under the caller's own claim` : undefined;
if (!ts.isPropertyAccessExpression(callee) || !isAnyCancel(callee.expression)) return undefined;
const how = callee.name.text;
if (how === "call") return passesClaim(node.arguments[3]) ? `${callee.getText(sf)}() under the caller's own claim` : undefined;
if (how === "apply") {
const list = node.arguments[1];
if (list !== undefined && ts.isArrayLiteralExpression(list)) return passesClaim(list.elements[2]) ? `${callee.getText(sf)}() under the caller's own claim` : undefined;
return `${callee.getText(sf)}() with arguments it can't read`;
}
return undefined;
};
/**
* A collection's cancel handed on rather than called (`.bind`, passed as a value): what is
* done with it later can't be read, so it counts as an ending, as a handed-on complete or fail does.
*/
const cancelHandedOn = (node) => {
if (!isAnyCancel(node)) return false;
const p = node.parent;
if (ts.isCallExpression(p) && p.expression === node) return false;
if (ts.isPropertyAccessExpression(p) && p.expression === node && ["call", "apply"].includes(p.name.text)) return false;
if (ts.isIdentifier(node) && ts.isPropertyAccessExpression(p) && p.name === node) return false;
if ((ts.isVariableDeclaration(p) && p.name === node) || ts.isBindingElement(p)) return false;
return true;
};
const recorders = {};
for (const sf of ownFiles) {
const path = rel(sf);
Expand All @@ -343,6 +389,9 @@ export function sweepTaskSurface({ repo, plants = [], tracked: given, table: tab
} else if (ts.isBindingElement(node) && ts.isObjectBindingPattern(node.parent)) {
const prop = (node.propertyName ?? node.name).getText(sf);
if (ENDS.includes(prop) && isCollection(checker.getTypeAtLocation(node.parent))) ending = `${prop} destructured from a task collection`;
} else if ((ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node) || ts.isIdentifier(node)) && cancelHandedOn(node)) {
ending = `${node.getText(sf)} (a task collection's cancel, handed on)`;
forwards = true;
}
if (ts.isCallExpression(node)) {
if (ts.isPropertyAccessExpression(node.expression)) {
Expand All @@ -356,6 +405,7 @@ export function sweepTaskSurface({ repo, plants = [], tracked: given, table: tab
if (method === "cancel" && passesClaim(node.arguments[2])) ending = `${node.expression.getText(sf)}() under the caller's own claim`;
}
}
ending ??= cancelCallEnding(node, sf);
const helper = passThroughOf(node.expression);
if (helper !== undefined) {
if (helper !== "advisoryCancel" || passesClaim(node.arguments[3])) ending = `${node.expression.getText(sf)}() (${helper})`;
Expand Down
74 changes: 67 additions & 7 deletions goals/workforce-coordination/runs-on-one-task/gaps.mts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@
* Plan row 4's map: each of the 31 in-scope rows of `docs/internal/design/workforce-coordination-gaps.md`
* (every phase 1 and phase 3 row), the child whose Linear scope line cites it, and the checks
* that read it. A row is matched by its target's opening words, so a row renamed or added on the
* page is a row this map doesn't hold, and the run says so. The verdict of each check is in
* rows 1 to 3; this prints the map and fails a row no check reads.
* page is a row this map doesn't hold, and the run says so. Each check names a run of this
* closure: `closure <tags>` row 1's assertions, `sweep: …` the sweep, `<package> <file>.test.ts`
* a regression test row 3 runs, or a goal path row 3 runs, then its legs and `(control …)`.
* A row passes only when every run it names ran in this closure run and passed (a goal and each
* control it names, as row 3 graded them; an assertion, as its leg's last attempt): a label
* naming no such run, or one not run here, fails, as a stale `by` does. Leg letters after a goal
* are where in it the row is read; the goal's own verdict covers them.
*
* Four rows hold a half other epics own (FIX-2056 D2, (f)); the carved half is printed beside
* its row and does not gate the closure.
Expand Down Expand Up @@ -49,7 +54,7 @@ export const ROWS: Row[] = [
{ target: "Recurring work is a schedule that files an ordinary task", owners: "FIX-2085", checks: ["scheduled-work/recurring-work-files-a-task"] },
{ target: "A dependency stays within one board", owners: "FIX-2080", checks: ["task-board/runs-by-its-filing-settings"] },
{ target: "Cancelling, retrying or failing a task cancels its open tasks", owners: "FIX-2080", checks: ["task-board/runs-by-its-filing-settings d (control no-cascade)"] },
{ target: "A failed or cancelled dependency cancels its dependents", owners: "FIX-2080", checks: ["task-board/runs-by-its-filing-settings d (control no-cascade)", "closure c:dependent-cancelled (control no-cascade)"] },
{ target: "A failed or cancelled dependency cancels its dependents", owners: "FIX-2080", checks: ["task-board/runs-by-its-filing-settings d (control no-cascade)", "closure c:dependent-cancelled"] },
{ target: "Five task tools", owners: "FIX-2081, FIX-2083", checks: ["task-tools/five-tools-one-rule-per-field a", "coordinators/routes-each-message-as-a-task d:one-check", "sweep: the tools rule", "closure j1:tools"], carved: "`sendMessage` among the model's tools is FIX-2070's" },
{ target: "The task tools are public actions a screen calls as the user", owners: "FIX-2081", checks: ["task-tools/five-tools-one-rule-per-field", "closure a:routed-listed, j2:cancelled"], carved: "answering a question by public action is FIX-2058's" },
{ target: "A worker declares its roles", owners: "FIX-2084", checks: ["workers/roles-checked-at-hire a (control no-role-check)"] },
Expand All @@ -66,17 +71,72 @@ function pageRows(): string[] {
.filter((target) => target !== "FIX-2056 (one epic)");
}

/** Print the map; a page row this map doesn't hold, or one with no check, is pushed as a failure. */
export function printGaps(report: string[], failures?: string[]): void {
/** What this closure run ran, and each run's verdict, for resolving a row's checks. */
export interface Ran {
/** Row 1's assertion tags. */
tags: readonly string[];
/** Each walk leg run, and whether its last attempt passed (`j1:` and `j2:` are leg a's). */
legs: ReadonlyMap<string, boolean>;
/** The sweep's verdict, plain and `--control` both, if it ran. */
sweep: boolean | undefined;
/** Row 3's goals (`goals/<path>`), its controls (`<path> GOAL_CONTROL=<name>`) and its test files, each with whether it passed (a control: went red as documented). */
checks: ReadonlyMap<string, boolean>;
}

/** Why one check label isn't a run that passed here, or undefined when it is. */
function unresolved(label: string, ran: Ran): string | undefined {
if (label.startsWith("closure ")) {
for (const tag of label.slice("closure ".length).split(/,\s*/)) {
if (!ran.tags.includes(tag)) return `${tag} is no row-1 assertion`;
const leg = /^j[12]:/.test(tag) ? "a" : tag.split(":")[0]!;
const passed = ran.legs.get(leg);
if (passed === undefined) return `leg ${leg}, which holds ${tag}, didn't run`;
if (!passed) return `leg ${leg}, which holds ${tag}, failed`;
}
return undefined;
}
if (label.startsWith("sweep:")) return ran.sweep === undefined ? "the sweep didn't run" : ran.sweep ? undefined : "the sweep failed";
const test = /^\S+ (\S+\.test\.ts)$/.exec(label)?.[1];
if (test !== undefined) {
const hits = [...ran.checks].filter(([k]) => k.endsWith(`/${test}`));
if (hits.length === 0) return `${test} didn't run`;
return hits.every(([, ok]) => ok) ? undefined : `${test} failed`;
}
const goal = label.split(" ")[0]!;
const passed = ran.checks.get(goal);
if (passed === undefined) return `${goal} didn't run`;
if (!passed) return `${goal} failed`;
for (const name of (/\(controls? ([^)]+)\)/.exec(label)?.[1] ?? "").split(/,\s*/).filter(Boolean)) {
const red = ran.checks.get(`${goal} GOAL_CONTROL=${name}`);
if (red === undefined) return `${goal}'s control ${name} didn't run`;
if (!red) return `${goal}'s control ${name} didn't go red as documented`;
}
return undefined;
}

/**
* Print the map, each check with whether it ran and passed here. A page row this map doesn't
* hold, one with no check, and a check naming no run that passed in this closure run are each
* pushed as a failure.
*/
export function printGaps(report: string[], failures: string[], ran: Ran): void {
const page = pageRows();
report.push(`row 4: ${page.length} in-scope gaps rows on the page, ${ROWS.length} mapped`);
let green = 0;
for (const target of page) {
const row = ROWS.find((r) => target.startsWith(r.target));
if (row === undefined || row.checks.length === 0) {
Comment thread
jhoffner marked this conversation as resolved.
Resolved
failures?.push(`gaps — no check reads the row "${target.slice(0, 90)}"`);
failures.push(`gaps — no check reads the row "${target.slice(0, 90)}"`);
report.push(` UNMAPPED ${target.slice(0, 90)}`);
continue;
}
report.push(` ${row.owners.padEnd(18)} ${row.target.slice(0, 60).padEnd(60)} ← ${row.checks.join(" · ")}${row.carved ? ` [carved: ${row.carved}]` : ""}`);
const misses = row.checks.flatMap((c) => {
const why = unresolved(c, ran);
return why === undefined ? [] : [`${c}: ${why}`];
});
if (misses.length === 0) green += 1;
else failures.push(`gaps — the row "${row.target.slice(0, 60)}" names checks that didn't pass in this run: ${misses.join("; ")}`);
report.push(` ${misses.length === 0 ? "PASS" : "FAIL"} ${row.owners.padEnd(18)} ${row.target.slice(0, 60).padEnd(60)} ← ${row.checks.join(" · ")}${row.carved ? ` [carved: ${row.carved}]` : ""}`);
}
report.push(`row 4: ${green} of ${page.length} rows with every check run and passed here`);
}
Loading