Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
13 changes: 13 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,19 @@ jobs:
- name: The lint gate can fail
run: node --test scripts/lint-gate.test.mjs

# One task surface (FIX-2087). Here rather than beside "One word per thing"
# in Process guards: the endings rule reads callers by type, so it needs the
# TypeScript this job installs. The goal's rules.mjs owns the allow lists;
# its goal.md says why.
- name: One task surface
run: node goals/workforce-coordination/runs-on-one-task/sweep.mjs

# Every plant must be reported, and nothing else, or the sweep above could
# pass because it stopped reading a rule. It runs even when the sweep is red.
- name: The task-surface sweep reports its plants
Comment thread
jhoffner marked this conversation as resolved.
Resolved
if: ${{ !cancelled() }}
run: node goals/workforce-coordination/runs-on-one-task/sweep.mjs --control
Comment thread
jhoffner marked this conversation as resolved.
Resolved

# The package tests, split across runners by scripts/test-shards.mjs. Each
# shard runs its packages one at a time, as `pnpm test` does: two at once on
# one runner oversubscribe it and tests start timing out.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
**Controls:** each is scratch patches to Workforce modules, applied as the process under test loads them (`goals/lib/module-patch.mjs` through `NODE_OPTIONS`); printed in full by the run, and refused when they never reached the code.

- `GOAL_CONTROL=unpartitioned`: one ledger for all of a user's conversations (`conversation-board/ledger.ts`: the partition the board's drain claims in, and every other read or write of the ledger at whatever partition its caller names; and the task entry's check that a task session works only its own conversation's partition). Patching each caller instead missed the ones FIX-1802 P2 added, and the control went green (FIX-1992). Leg c must fail **`c:runs-its-own`** (the first conversation's assign and dispatch reach the other's task, and its board runs it) and **`c:lists-its-own`** (each list holds every task: a control that leaves the lists apart never merged the ledger). `c:found-its-own` goes red with them. `c:drain-returns` goes red too, but not on the wait: the task it measures ran under the other conversation, so it was never running when the measure starts. It has no isolating red state.
- `GOAL_CONTROL=no-follow-up`: a task's ending reaches the conversation that filed it and nothing follows, no line and no turn (orchestration's `tasks/notice/task-notice.ts`); a retried attempt still runs again. Legs a and e must fail **`a:one-notice`** and **`e:one-notice`**. In leg e, `e:refiled` and `e:reply-names` go red with it: no turn, so nothing is filed again.
- `GOAL_CONTROL=no-follow-up`: a task's ending reaches the conversation that filed it and nothing follows, no line and no turn (orchestration's `tasks/notice/task-notice.ts`, and the two places Workforce's `conversation-board/task-settled.ts` maps that decision to a turn or a line itself, for a turn-filed failure and an unrouted one); a retried attempt still runs again. Legs a and e must fail **`a:one-notice`** and **`e:one-notice`**. In leg e, `e:refiled` and `e:reply-names` go red with it: no turn, so nothing is filed again.

**Before-state:** `GOAL_COMMIT=84e9e072e` is `main` just before FIX-1794's second PR merged (#2935, merge `1854a84f0`). Every leg must fail there.

Expand Down
8 changes: 8 additions & 0 deletions goals/coordinators/files-tasks-down-the-owners-chain/run.mts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,14 @@ const CONTROLS: Record<string, Control> = {
from: String.raw`return policy === "judgment" \? \{ act: "wake-turn" \} : \{ act: "line" \};`,
to: 'return { act: "none" };',
},
{
// Workforce's conversation board maps the decision to a turn or a line itself for a
// turn-filed failure (FIX-2115) and an unrouted one (FIX-2122), so `none` there read as a
// line, and leg e's failure was still said: both maps say nothing too.
module: "packages/workforce/src/conversation-board/task-settled.ts",
from: String.raw`const act = (unrouted && )?decideNotice\(notice, options\.policy\(ctx\)\)\.act === "wake-turn" \? "wake-turn" : "line";`,
to: 'const act = "none" as const;',
},
],
does: "a task's ending reaches the conversation that filed it, and nothing follows: no line and no coordinator turn (a retried attempt still runs again)",
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ export type StoredRequest = {
createdAt: number;
/** When it ended, or its last write while it runs. */
updatedAt: number;
/** Its result's output, once it has one. */
output?: unknown;
};

export type StoredItem = Record<string, any> & { type: string; requestId: string };
Expand Down Expand Up @@ -99,7 +101,7 @@ export function sessions(file: string): StoredSession[] {
export function requests(file: string): StoredRequest[] {
return open(file, (db) =>
(db.prepare("SELECT id, session_id, flow_kind, status, created_at, updated_at, data FROM requests ORDER BY created_at").all() as Array<Record<string, any>>).map((row) => {
const data = JSON.parse(row.data) as { actionName?: string; source?: string; finalizedAtMs?: number };
const data = JSON.parse(row.data) as { actionName?: string; source?: string; finalizedAtMs?: number; result?: { output?: unknown } };
return {
id: row.id,
sessionId: row.session_id ?? null,
Expand All @@ -109,6 +111,7 @@ export function requests(file: string): StoredRequest[] {
source: data.source,
createdAt: row.created_at,
updatedAt: data.finalizedAtMs ?? row.updated_at,
...(data.result?.output !== undefined ? { output: data.result.output } : {}),
};
}),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
* worker's defaults, not the conversation's list. Leg d must fail on *the
* reply equals the list*.
* - `no-self-choice`: best fit never offers the coordinator itself. Leg h
* must fail on *a hire reaches the chief of staff's own turn*: the EM, its
* one choice, is picked at full confidence.
* must fail on one of its own-job asks: the EM, its one choice, takes
* whichever the evaluation places on it (the hire, when this was written;
* the project since).
* - `no-floor`: a delegate pick below `minConfidence:` is used. Leg e must
* fail on *a pick below the floor goes to the fallback*, and nothing else:
* a pick with no confidence is still a miss.
Expand Down Expand Up @@ -48,6 +49,8 @@ export interface Control {
leg: "a" | "d" | "e" | "f" | "h";
/** The assertion, by name, that must go red. */
assertion: string;
/** When which assertion goes red is best fit's call: any one of these, `assertion` among them. */
anyOf?: readonly string[];
/** The module, from the checkout root. */
module: string;
from: string;
Expand Down Expand Up @@ -88,6 +91,9 @@ export const CONTROLS: Record<ControlName, Control> = {
name: "no-self-choice",
leg: "h",
assertion: "h:hire-turn",
// Which of leg h's asks best fit now places on the EM is the evaluation's call: on
// 2026-10-24 it was the project ask, 4 of 4 runs, and the hire missed back to the turn.
anyOf: ["h:hire-turn", "h:fire-turn", "h:who-turn", "h:project-turn"],
module: "packages/workforce/src/coordinator/coordinator-flow.ts",
from: String.raw`const offersSelf = post\.round === 0 && worker\.description !== null;`,
to: "const offersSelf = false;",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
- `GOAL_CONTROL=no-round-limit`: a coordinator whose `rounds:` is above 0 runs to the ceiling of 3 (`coordinator-flow.ts`, the worker's config read). Leg e must fail **`e:four-then-none`**, and nothing else: the patch leaves `rounds: 0` alone.
- `GOAL_CONTROL=no-delegate-read`: the delegate read answers from the worker's defaults, not the conversation's list (`delegates/worker-delegates.ts`). Leg d must fail **`d:reply-equals-list`** (*the reply equals the list*), with `d:read-equals-list`.

- `GOAL_CONTROL=no-self-choice`: best fit never offers the coordinator itself (`coordinator-flow.ts`). Leg h must fail **`h:hire-turn`**: the EM, its one choice, takes the hire.
- `GOAL_CONTROL=no-self-choice`: best fit never offers the coordinator itself (`coordinator-flow.ts`). Leg h must fail one of its own-job asks (**`h:hire-turn`**, `h:fire-turn`, `h:who-turn`, `h:project-turn`): the EM, its one choice, takes whichever the evaluation places on it. That was the hire when this was written; on 2026-10-24 it was the project, 4 of 4 runs, with the hire missing back to the coordinator's turn.
- `GOAL_CONTROL=no-floor`: a delegate pick below `minConfidence:` is used (`best-fit.ts`); a pick with no confidence is still a miss. Leg e must fail **`e:below-floor`**, and nothing else.
- `GOAL_CONTROL=turn-after-route`: the coordinator's own turn also runs on a post best fit placed (`coordinator-flow.ts`). Leg a must fail **`a:no-turn`**.

Expand Down
9 changes: 5 additions & 4 deletions goals/coordinators/hands-each-post-to-its-delegates/run.mts
Original file line number Diff line number Diff line change
Expand Up @@ -314,11 +314,12 @@ await runGoal(async () => {
failures.push(...r.failures);
}
if (control !== undefined) {
const named = failures.some((f) => f.startsWith(`${control.assertion} `));
const wanted = control.anyOf ?? [control.assertion];
const named = wanted.find((a) => failures.some((f) => f.startsWith(`${a} `)));
failures.unshift(
named
? `control ${control.name}: leg ${control.leg} failed on ${control.assertion}, as it must`
: `control ${control.name}: leg ${control.leg} did NOT fail on ${control.assertion}, so the check can't see what the control removes`,
named !== undefined
? `control ${control.name}: leg ${control.leg} failed on ${named}, as it must`
: `control ${control.name}: leg ${control.leg} did NOT fail on ${wanted.join(" or ")}, so the check can't see what the control removes`,
);
}
return { failures, evidence: `legs ${[...legs].sort().join(", ")} PASS; ${evidence.join("; ")}` };
Expand Down
2 changes: 1 addition & 1 deletion goals/task-board/a-worker-plans-its-own-steps/goal.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

**Run:** `pnpm tsx goals/task-board/a-worker-plans-its-own-steps/run.mts`. `GOAL_LEGS=a1,a2` runs some legs. On demand only, never a CI gate.

**Controls:** `GOAL_CONTROL=no-plan` is today's `main` as a scratch patch applied as the process loads (`goals/lib/module-patch.mts`): the agent's turn runs without its plan, and a filing naming the worker is a task handed to a session of its own. Leg a1 must fail **`a1:steps-in-task-session`** and **`a1:no-child-session`**.
**Controls:** `GOAL_CONTROL=no-plan` is today's `main` as a scratch patch applied as the process loads (`goals/lib/module-patch.mts`): the agent's turn runs without its plan, and a filing naming the worker is a task handed to a session of its own. Leg a1 must fail **`a1:steps-in-task-session`**. `a1:no-child-session` goes red with it when the planless model files steps for itself, as it did on 2026-10-21; on 2026-10-24 it answered in one turn instead (4 of 4 runs), so it isn't required.

A step that fails, and the answer naming it, is proven in CI by `packages/workforce/test/worker-plans-its-steps.test.ts`: a real model won't fail a step on cue. FIX-2080 had not landed when this did, so a failed attempt's open steps stay open for the next attempt rather than ending `cancelled`; that assertion joins this leg with FIX-2080.

Expand Down
4 changes: 3 additions & 1 deletion goals/task-board/a-worker-plans-its-own-steps/run.mts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ const CONTROLS: Record<string, { patches: ModulePatch[]; assertions: string[] }>
// Today's main: the agent's turn runs without its plan, and a filing that
// names the worker is a task like any other, handed to a session of itself.
"no-plan": {
assertions: ["a1:steps-in-task-session", "a1:no-child-session"],
// `a1:no-child-session` goes red with it only when the model, planless, files for itself;
// since 2026-10-24 it mostly answers in one turn instead (4 of 4 runs), so it isn't required.
assertions: ["a1:steps-in-task-session"],
patches: [
{
module: "packages/workforce/src/agent-worker-flow.ts",
Expand Down
28 changes: 28 additions & 0 deletions goals/task-board/every-ending-reaches-its-filer/controls.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* This goal's named control and its kill point, as scratch patches (`goals/lib/module-patch.mts`).
* Exported so a goal that composes this one (FIX-2087's closure walk) reuses them rather than
Comment thread
jhoffner marked this conversation as resolved.
Resolved
* copying them.
* FIX-2087's closure imports these `from`/`to` anchors for its `GOAL_CONTROL` legs: renaming one breaks that run too.
*/
import type { ModulePatch } from "../../lib/index.mts";

/** Each named control, by its `GOAL_CONTROL` name. */
export const PATCHES: Record<string, ModulePatch[]> = {
// The sweeper fires no wake: only a fast path or a touch pays a debt. The
// patch skips the fire of each due wake. The wake step still resumes waits
// past their deadline (FIX-2082), a debt this goal does not grade.
"no-sweeper-payment": [
{
module: "packages/engine/src/durability/durability-sweeper.ts",
from: String.raw` if \(fireWake === undefined\) continue;`,
to: " continue;"
}
]
};
/** Leg b's second process dies the moment an ending's delivery would send a notice it owes. */
export const KILL_AFTER_ENDING: ModulePatch = {
module: "packages/orchestration/src/tasks/notice/delivery.ts",
// The first line of the delivery's send half, after the ending's write.
from: String.raw` const notices = owedNotices\(row, board\.collectionId, rows, filerOf\);`,
to: ' if (process.env.GOAL_KILL === "after-ending" && Object.keys(row.metadata ?? {}).some((k) => k.startsWith("noticeOwed:"))) process.exit(0); const notices = owedNotices(row, board.collectionId, rows, filerOf);'
};
21 changes: 1 addition & 20 deletions goals/task-board/every-ending-reaches-its-filer/run.mts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ import {
silentLogger,
type ModulePatch
} from "../../lib/index.mts";
import { KILL_AFTER_ENDING, PATCHES } from "./controls.mts";

const USER = "u_every_ending";
const ORG = "org_every_ending";
Expand All @@ -90,26 +91,6 @@ const INTAKE = join(SCRATCH, "intake.ndjson");
const KILL_DB = join(SCRATCH, "kill.sqlite");
const KILL_PLAN = join(SCRATCH, "kill-plan.json");

const PATCHES: Record<string, ModulePatch[]> = {
// The sweeper fires no wake: only a fast path or a touch pays a debt. The
// patch skips the fire of each due wake. The wake step still resumes waits
// past their deadline (FIX-2082), a debt this goal does not grade.
"no-sweeper-payment": [
{
module: "packages/engine/src/durability/durability-sweeper.ts",
from: String.raw` if \(fireWake === undefined\) continue;`,
to: " continue;"
}
]
};
/** Leg b's second process dies the moment an ending's delivery would send a notice it owes. */
const KILL_AFTER_ENDING: ModulePatch = {
module: "packages/orchestration/src/tasks/notice/delivery.ts",
// The first line of the delivery's send half, after the ending's write.
from: String.raw` const notices = owedNotices\(row, board\.collectionId, rows, filerOf\);`,
to: ' if (process.env.GOAL_KILL === "after-ending" && Object.keys(row.metadata ?? {}).some((k) => k.startsWith("noticeOwed:"))) process.exit(0); const notices = owedNotices(row, board.collectionId, rows, filerOf);'
};

if (CONTROL !== "" && PATCHES[CONTROL] === undefined) {
console.error(`unknown GOAL_CONTROL "${CONTROL}"; known: ${Object.keys(PATCHES).join(", ")}`);
process.exit(2);
Expand Down
24 changes: 24 additions & 0 deletions goals/task-board/runs-by-its-filing-settings/controls.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
* This goal's named control, as scratch patches (`goals/lib/module-patch.mts`). Exported so a
* goal that composes this one (FIX-2087's closure walk) reuses it rather than copying it.
* FIX-2087's closure imports these `from`/`to` anchors for its `GOAL_CONTROL` legs: renaming one breaks that run too.
*/
import type { ModulePatch } from "../../lib/index.mts";

/** Each named control, by its `GOAL_CONTROL` name. */
export const PATCHES: Record<string, ModulePatch[]> = {
// Both cascades off: no ending records the debt, so nothing pays one, and a
// touch doesn't sweep for dependents an ending missed.
"no-cascade": [
{
module: "packages/orchestration/src/tasks/collection/internal.ts",
from: String.raw` if \(recording\?\.owesCascade\?\.\(row as Task, ending\) !== true\) return row;`,
to: " return row;"
},
{
module: "packages/orchestration/src/tasks/collection/cascade.ts",
from: String.raw` await cancelDeadDependents\(writes, now\);`,
to: ""
}
]
};
17 changes: 1 addition & 16 deletions goals/task-board/runs-by-its-filing-settings/run.mts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ import {
untilIdle,
type ModulePatch
} from "../../lib/index.mts";
import { PATCHES } from "./controls.mts";

const USER = "u_filing_settings";
const ORG = "org_filing_settings";
Expand All @@ -81,22 +82,6 @@ const KILL_PLAN = join(SCRATCH, "kill-plan.json");
/** How long a filed piece's worker runs: long enough to still be open when its parent ends. */
const PIECE_MS = 6000;

const PATCHES: Record<string, ModulePatch[]> = {
// Both cascades off: no ending records the debt, so nothing pays one, and a
// touch doesn't sweep for dependents an ending missed.
"no-cascade": [
{
module: "packages/orchestration/src/tasks/collection/internal.ts",
from: String.raw` if \(recording\?\.owesCascade\?\.\(row as Task, ending\) !== true\) return row;`,
to: " return row;"
},
{
module: "packages/orchestration/src/tasks/collection/cascade.ts",
from: String.raw` await cancelDeadDependents\(writes, now\);`,
to: ""
}
]
};
/** The kill leg's second process dies the moment an ending's own pass would pay its cascade. */
const KILL_PATCH: ModulePatch = {
module: "packages/orchestration/src/tasks/collection/cascade.ts",
Expand Down
Loading
Loading