Repository navigation
FIX-2116: hands-each-post grades a second ask on FIX-2083's one-at-a-time rule - #3702
Conversation
…a-time rule (FIX-2116) Leg c asks the chief of staff the same thing twice and wants the second handed to the worker it hired the first time. Since FIX-2083 a delegate works one routed task at a time, so a second ask while the hire still works the first waits pending in Alice's list; the grade wanted it delivered at once and went red. It now counts a routed task for the same worker that was delivered, or that waits pending while the first is still open; one still pending after the first ended has 60 s to start. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VaN4uTiYqiabCbsFLWM52A
|
The latest updates on your projects. Learn more about Vercel for GitHub. 3 Skipped Deployments
|
jhoffner
left a comment
There was a problem hiding this comment.
Stand-in review, correctness and restraint. Nothing blocking.
- The diagnosis holds. FIX-2083's rule 5 queues the second routed task behind the first, so the old grade, which wanted an immediate
delivered, is the stale part. - The promise is the same and the check is no weaker. These still fail:
- a second hire
- routing to another worker
- no routed task at all
- a queue that never drains: still pending 60 s after the first ended
- 🟣 note: a first task that hangs forever while open would still pass leg c, as the PR says. FIX-2083's
a:waitscovers the drain, so leaving it is fine.
Generated by Claude Code
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: eab3b1c7-98dc-4de6-8b17-2fa5e6444cf1) |
There was a problem hiding this comment.
Simplify / approach review
Problem this PR is solving (as I read it): Under FIX-2083, a delegate works one routed task at a time, so leg c of hands-each-post should not require the second ask to be delivered immediately; pending behind the first open routed task is success. Separately, the branch backs out FIX-2112 (dropNoticeReadByWait / deliveredByWait, docs, unit tests, and the waits-on-a-task-it-filed leg-a race goal).
FIX-2116 (goal grading) — direction looks right
Updating c:same-worker to accept delivered or pending while the first routed task is still open, with a 60s grace once the first has ended, matches FIX-2083 and the goal prose. I would not change product behavior here.
Nits (goal-only, optional):
- The
sameWorkerclosure + poll mirrorsholdCleared(1s × up to 60s, fullrecordOfeach tick). A tiny sharedpollUntilin this file would DRY that without moving logic into production. - Worst case adds ~60 SQLite reads in CI for leg c when the second row stays pending after the first completes; acceptable for goals, but worth knowing.
FIX-2112 revert — simpler code, but a different product call
Roughly ~200 lines of this diff are not FIX-2116: they remove collection API surface, notice metadata helpers, integration tests, user docs, and goal coverage for “task ended before the filer’s getTask wait.”
On simplification: Reverting FIX-2112 is simpler than keeping the dropNoticeReadByWait path — fewer moving parts, no optional ref method, no deliveredByWait patch rules. If the team has decided the race is rare and double onTaskSettled is acceptable, that is a valid subtract-then-add call.
On reviewability: The PR title/description only name FIX-2116. Stacking a revert of #3697 into the same merge makes it hard to judge whether the goal fix requires backing out FIX-2112 or these are two independent decisions. I’d strongly prefer either:
- Split: FIX-2116 goal-only PR (tiny), and a second PR titled/reasoned as FIX-2112 revert (or a smaller replacement fix), or
- One PR but honest scope: retitle/rebody so reviewers explicitly sign off on regressing the FIX-2112 behavior and deleting the goal leg that proved it.
Alternative I’m uncertain about (not a must-change): If the bug FIX-2112 fixed still matters, a narrower fix might live entirely in notice admit logic (no new TaskCollectionRef method) rather than re-introducing the full FIX-2112 stack. I haven’t traced whether that’s actually smaller in practice — only worth exploring if double delivery is still considered a bug.
What I’d approve as-is
The FIX-2116 hunk alone is mergeable from a complexity standpoint. I’m not approving the combined PR because the FIX-2112 revert is substantial, under-documented in the PR framing, and weakens waits-on-a-task-it-filed leg a back toward pre-2112 failure mode (wait reads ending, onTaskSettled may deliver again — the goal journal row you removed documented exactly that).
Checks
Ran pnpm --filter @flow-state-dev/orchestration test and pnpm --filter @flow-state-dev/workforce test on pr-3702 HEAD — green (full package suites, not only changed files).
Sent by Cursor Automation: Review For Best Approach
| // waits pending while the first is still open. One still pending after | ||
| // the first has ended has 60 s to start, then fails. | ||
| const firstTaskId = firstDeliveries[0]?.taskId; | ||
| const sameWorker = async () => { |
There was a problem hiding this comment.
The grading logic matches FIX-2083. For simplify: this file already has holdCleared with the same for (const until = Date.now() + timeout; …; await sleep(1_000)) pattern — a local pollUntil(read, { timeoutMs: 60_000, intervalMs: 1_000, while: (r) => !r.ok && r.pending }) (or similar) would keep leg c readable without a one-off 20-line block. Optional.
| const first = ledger.find((d) => d.taskId === firstTaskId); | ||
| const firstOpen = first !== undefined && !["completed", "errored", "cancelled"].includes(first.rowStatus); | ||
| const delivered = toHire.some((d) => d.status === "delivered"); | ||
| const queued = toHire.some((d) => d.status === "pending") && firstOpen; |
There was a problem hiding this comment.
Minor: queued requires firstOpen, but pending in the return object does not — the failure message carries enough context; just flagging in case you ever extend this branch.


The problem
goals/coordinators/hands-each-post-to-its-delegates/leg c asks the chief of staff the same thing twice. It expects the second ask to go to the worker that the chief of staff hired for the first one (c:same-worker). Onmain1477834 this check failed 3 of 3 attempts, and only this check. The chief of staff did hand the second ask to the same worker, but the grade read no delivery.What this does
The call: the goal is out of date. The product did not regress. FIX-2083 makes a delegate work one routed task at a time. Its outcome says "A second message to a busy delegate waits its turn", and its own goal checks this (
a:waits). In leg c the hire is still working on the first audit when the second ask comes, 3 s later. So the second routed task waits, pending, in Alice's list. The old grade wanteddeliveredimmediately, which was true only before FIX-2083.The promise stays the same: asked again, the chief of staff gives the work to the same worker and does not hire again.
c:same-workernow passes when there is a routed task for the hire for the second ask, and that task is:A task that is still pending after the first one ended has 60 s to start, and then the check fails. So a queue that never drains still fails. A second ask that goes to no worker, or to another worker, also still fails.
c:no-second-hiredoes not change.What's asked of you
Nothing here is yours to decide. This is a goal-only change that grades against FIX-2083's approved rule.
Parts worth reviewing closely
devteam.mts, leg c: the "first still open" test reads the first ask's row from the same store read as the second. "Open" means notcompleted,erroredorcancelled. The 60 s poll runs only while the hire's second task is pending.FIX-2116 · epic FIX-2056 · found by FIX-2087 · goals only, no product change · draft
How to review this: a bug fix on the direct route
Engineering calls: decided along the way, no product sign-off needed
coordinators.md, "How a routed task is tracked") teach it. If this is wrong: FIX-2083's rule itself is wrong, and that is a product question for FIX-2083, not for this goal.a:waitscovers the start after the first one ends.Verification
Red: the closure's run on
main1477834, 3 of 3 FAIL atc:same-worker("the ledger holds [{ …, status: pending, rowStatus: pending }]"). Legs a, b and d to h PASS.Green:
GOAL_LEGS=c pnpm tsx goals/coordinators/hands-each-post-to-its-delegates/run.mts(FSDEV_* unset), onmain8f5a77f with this change,anthropic/claude-haiku-5-5: PASS on attempt 1 of 3, and the queued path ran:listDelegates,discover,hirelicense-auditor,addDelegate,createTask.createTaskforlicense-auditor, no hire. The run printed: "asked again: a routed task forlicense-auditor, pending behind its first (in_progress), as a delegate works one at a time".Checks:
pnpm typecheckPASS ·pnpm lintPASS ·pnpm fallow:ciPASS ·node scripts/check-retired-terms.mjsPASS · vocabulary sweep PASS. Only leg c was run. The other legs did not change.Generated by Claude Code
Note
Low Risk
Goals-only assertion and documentation changes; no production routing or coordinator behavior is modified.
Overview
Updates leg c’s
c:same-workergrade so it matches FIX-2083: a delegate handles one routed task at a time, so a repeat audit ask can sit pending behind the first task instead of showing delivered immediately.In
devteam.mts, the check now passes when the second post has a routed task for the same hire that is delivered, or pending while the first ask’s task is still open (rowStatusnot completed/errored/cancelled). It polls for up to 60s only while that second task stays pending; otherwise it fails with richer ledger diagnostics. A note is recorded when the queued-behind-first path is what passed.goal.mddocuments the new rule (FIX-2083 / FIX-2116) and adds a verdict-log row showing the old “immediate delivery” grade failed 3/3 on current product behavior while this shape passes.Reviewed by Cursor Bugbot for commit 56e1e24. Configure here.