Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
c8600eb
wip(FIX-2080): substrate slice
claude Oct 21, 2026
d2cdf84
wip(FIX-2080): orchestration tests
claude Oct 21, 2026
d62aea0
wip(FIX-2080): workforce
claude Oct 21, 2026
356cc00
wip(FIX-2080): direct filed cascade
claude Oct 21, 2026
2302506
wip(FIX-2080): ui and goals vocabulary
claude Oct 21, 2026
2f0d88a
wip(FIX-2080): filing-settings goal
claude Oct 21, 2026
28eb765
wip(FIX-2080): docs, goal verdicts, filing-settings goal.md
claude Oct 21, 2026
7052203
wip(FIX-2080): changeset; devtool finds a board's tools without block…
claude Oct 21, 2026
0d5a235
fix(FIX-2080): retired-term wording in tests; unexport module-interna…
claude Oct 21, 2026
98db332
fix(FIX-2080): break the cascade/ledger import cycle by handing the l…
claude Oct 21, 2026
76a057a
Merge origin/main into fix/FIX-2080 (FIX-2076 lands first)
claude Oct 21, 2026
d414662
fix(FIX-2080): release a retried legacy blocked row; keep its reason …
claude Oct 21, 2026
af73d28
fix(FIX-2080): a dependency that ends while its dependent is written …
claude Oct 21, 2026
966252f
fix(FIX-2080): a late filed-cascade payment cancels only the ending's…
claude Oct 21, 2026
1cdb63a
test(FIX-2080): a refused Workforce batch files none of its rows
claude Oct 21, 2026
5578448
fix(FIX-2080): a batch row filed already ended counts as a dead depen…
claude Oct 21, 2026
fef68ec
fix(FIX-2080): refuse a Workforce batch that names one id twice
claude Oct 21, 2026
767e85f
fix(FIX-2080): a piece added after its task ended is cancelled by its…
claude Oct 21, 2026
898357f
fix(FIX-2080): a touch cancels dependents an ending in another proces…
claude Oct 21, 2026
92406a5
fix(FIX-2080): updateTask releases last, after a reassignment lands
claude Oct 21, 2026
a7e4e37
fix(FIX-2080): refuse a follow-up of a task that never ran; rename it…
claude Oct 21, 2026
397137a
fix(FIX-2080): a replan naming a failed task skips it instead of fail…
claude Oct 21, 2026
e02bfb8
docs(FIX-2080): a held task keeps a board from finishing; batch and t…
claude Oct 21, 2026
efe6a5c
test(FIX-2080): reword a test goal off a retired term
claude Oct 21, 2026
1602e62
fix(FIX-2080): keep the dead-dependents sweep module-internal
claude Oct 21, 2026
d4e601d
test(FIX-2080): the filing-settings goal files its pieces for a helper
claude Oct 21, 2026
b194f86
fix(FIX-2080): pay a drain's owed cascades after its workers, not bef…
claude Oct 21, 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(FIX-2080): refuse a Workforce batch that names one id twice
The dependency ordering kept only the first row for a repeated id, so the
batch reported success with a row missing. assertUniqueIds refuses it as
duplicate_task_id before anything is written (Codex review, board.ts).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VaN4uTiYqiabCbsFLWM52A
  • Loading branch information
claude committed Oct 21, 2026
commit fef68ecc8ef516489211ddd9ffb34fa4b609f976
24 changes: 23 additions & 1 deletion packages/orchestration/src/tasks/collection/filing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ export type TaskFilingRule =
/** A conversation-result task has one attempt. */
| "conversation_result_one_attempt"
/** A setting only a conversation may choose, filed from a task's session. */
| "setting_not_from_task_session";
| "setting_not_from_task_session"
/** A batch names one task id twice. */
| "duplicate_task_id";

/**
* A filing, or an edit of one, refused at the board (FIX-2080). Nothing was
Expand Down Expand Up @@ -153,6 +155,26 @@ function reaches(from: readonly string[], target: string, depsOf: DepsOf): boole
return false;
}

/**
* Refuse a batch that names one task id twice: one of the two would be lost.
*
* @throws {TaskFilingRefusedError} with rule `duplicate_task_id`.
*/
export function assertUniqueIds(batch: readonly { readonly id?: string }[]): void {
const seen = new Set<string>();
for (const { id } of batch) {
if (id === undefined) continue;
if (seen.has(id)) {
throw new TaskFilingRefusedError({
rule: "duplicate_task_id",
taskId: id,
detail: `the batch names task "${id}" twice. Give each task its own id. Nothing was written.`,
});
}
seen.add(id);
}
}

/**
* Refuse a batch of filings whose dependencies this board can't run: an id
* that names no task on this board or in the batch, a dependency already
Expand Down
1 change: 1 addition & 0 deletions packages/orchestration/src/tasks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export {
assertDepsFileable,
assertFilingCallerContext,
assertFilingSettings,
assertUniqueIds,
type TaskFilingCallerContext,
type TaskFilingRule,
type TaskSettingsSupport,
Expand Down
2 changes: 2 additions & 0 deletions packages/workforce/src/conversation-board/board.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ import {
assertDepsFileable,
assertFilingCallerContext,
assertFilingSettings,
assertUniqueIds,
hasStarted,
isClaimable,
isTerminalStatus,
Expand Down Expand Up @@ -758,6 +759,7 @@ export function defineConversationBoard(options: ConversationBoardOptions) {
// batch's dependencies (its own ids count) and every row's place in
// the chain come first. A reservation a later refusal strands lapses
// with its lease. Then each row is added after the rows it depends on.
assertUniqueIds(inits);
const batch = dependencyOrder(inits.map((init) => ({ ...init, id: init.id ?? newTaskId() })));
for (const init of batch) checkFiling(init);

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should-fix: assertFollowUpHasRun misses a follow-up whose root is in the same batch, so the earlier finding 7 still reproduces through addTasks.

checkFiling looks the root up with ref.get. A root filed in the same batch isn't stored yet, so the lookup returns undefined, and the rule leaves it "to the caller's own lookup". By the time the follow-up is added, the root has already been added, so that lookup passes too.

Evidence: I ran the new follow_up_of_unrun test with h.controls.batch.add("s1") and an assignee on the follow-up. Nothing was refused. The root stayed held, and "Polish the brief" ran to completed in the root's session. Filed one at a time, the same rows are refused. The changeset says the rule holds "from the tools and from the board's ref alike".

Fix: give the batch check a lookup that sees the batch rows. A follow-up whose root is a row in the same batch has never run, so refuse it. For example, pass (id) => batchById.get(id) ?? ref.get(id) and let the run === undefined test refuse it.


Generated by Claude Code

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in #3639 (FIX-2096), commit b234f0d. The guarded batch passes its own rows to assertFollowUpHasRun (filedWith.get(id) ?? ref.get(id)), so a root filed in the same batch reads as never run and the follow-up is refused follow_up_of_unrun. The whole batch files nothing. New test in conversation-board-filing-settings.test.ts, which failed on main.


Generated by Claude Code

assertDepsFileable(batch, (id) => ref.get(id));
Expand Down
22 changes: 22 additions & 0 deletions packages/workforce/test/conversation-board-filing-settings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,28 @@ describe("filing settings on a conversation's board (FIX-2080)", () => {
}
});

it("refuses a batch that names one id twice, and files none of it", async () => {
const h = bootSplitHost();
try {
h.controls.plans.s1 = [
{ goal: "Draft the agenda", assignee: "eng.tasker", id: "task_agenda" },
{ goal: "Draft the agenda again", assignee: "eng.tasker", id: "task_agenda" }
];
h.controls.batch.add("s1");
const conversation = await h.open("alice", "s1");
await h.turn("alice", conversation);
await h.settled();

const refused = h.controls.refusals.filter((r) => r.worker === "s1");
expect(refused).toHaveLength(1);
expect(refused[0]!.message).toMatch(/^duplicate_task_id: .*"task_agenda"/);
expect(await h.rowsNamed("alice", "Draft the agenda")).toHaveLength(0);
expect(await h.rowsNamed("alice", "Draft the agenda again")).toHaveLength(0);
} finally {
await h.dispose();
}
});

it("gives a conversation-result task one attempt", async () => {
const h = bootSplitHost();
try {
Expand Down