You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A Goal continuation can be written after the agent's completion request #1989
The Goal product flow sets a Goal with the evaluator judge, submits the agent's completion report, waits for the evaluator branch, and asserts that no continuation is written after the completion request (goal_product_flow.rs). The assertion failed on a run whose pull request changed only an unrelated CLI test, after the same assertion had failed once before on another unrelated change.
The turn-end decision reads the request inside the ending turn (do_turn_end and request_in_turn) and chooses between creating an evaluator and continuing (decide_evaluation). The completion request and the turn end are separate facts, and the decision runs as its own task after the turn end (branch.rs). If the request has not been folded when that task reads the state, the turn takes the continuation path and the evaluator is created later, so a continuation sits after the completion request.
The exact interleaving is not confirmed and is not reproduced here; the evidence is the failing assertion, the shape of the earlier hit, and the code path above.
Fix direction: let the turn-end decision observe the turn's request and turn end in one state, or order the decision after the turn's inputs are folded and re-check when a completion request arrives for a turn that already continued.
The Linux failure in goal_product_flow::goal_evaluator_judge_creates_an_evaluator_and_completes_on_done is a stale continuation, not a missing evaluator.
A deterministic run of the product profile reproduces it with a fake model that calls goal_update inside a real Loop and ToolExecutor turn. A test hook holds Goal's turn-end decision after it is taken and before its input is written. The set turn ends, Goal decides a continuation, the queued report commits and starts its turn, and only then the continuation is written behind it. Its own turn end writes another continuation after the completion request. The report turn's end does create the evaluator, so the earlier assertions in the test pass and only the no-continuation assertion fails.
That continuation violates Goal A.4 C4 and C5: when it was written, a new turn was open and a driving input was still pending.
PR #1970 fixes this shape in commit 992d2cb: Goal decides again after the Dispatcher reaches the facts committed at the decision's write, so a continuation overtaken by an input or a turn is not written.
One window remains: the second decision and the continuation write are separate steps, so a report input can still commit after the state lock is released and before the continuation commits. That window is a few instructions wide; the commit narrows it from the whole decision, the tool-call query and the Dispatcher wait, but does not close it, and the Timeline has no conditional append.
The same investigation found an independent race: when a queued user input starts the next turn at the report turn's end before Goal's decision for that turn end runs, decide_evaluation sees an open turn and skips the request, which is then never evaluated and the goal later pauses with no_progress. This race is tracked in #1998 and is not changed by PR #1970.
Reopening. #1970 merged commit 992d2cb, which narrows this race but does not close it, so its Fixes #1989 closed this issue too early.
Correction to my earlier comment: the remaining window is not a few instructions wide. As #1970 (review) points out, after Goal's second decision the continuation is written through Timeline::input_checked, which awaits a submission lookup before it takes the commit lock. A report input that commits during that await is not seen by the decision, so a continuation can still be written after the completion request. This comes from reading the source; it has not been reproduced yet.
The missed evaluation when a queued input starts the next turn first is a separate race, tracked in #1998.
Activity
fix(goal): drop a continuation a later turn overtook
test(goal): bound the continuation gate wait in the regression flow
yyhhyyyyyy commentedon Nov 22, 2026
The Linux failure in
goal_product_flow::goal_evaluator_judge_creates_an_evaluator_and_completes_on_doneis a stale continuation, not a missing evaluator.A deterministic run of the product profile reproduces it with a fake model that calls
goal_updateinside a real Loop and ToolExecutor turn. A test hook holds Goal's turn-end decision after it is taken and before its input is written. The set turn ends, Goal decides a continuation, the queued report commits and starts its turn, and only then the continuation is written behind it. Its own turn end writes another continuation after the completion request. The report turn's end does create the evaluator, so the earlier assertions in the test pass and only the no-continuation assertion fails.That continuation violates Goal A.4 C4 and C5: when it was written, a new turn was open and a driving input was still pending.
PR #1970 fixes this shape in commit 992d2cb: Goal decides again after the Dispatcher reaches the facts committed at the decision's write, so a continuation overtaken by an input or a turn is not written.
One window remains: the second decision and the continuation write are separate steps, so a report input can still commit after the state lock is released and before the continuation commits. That window is a few instructions wide; the commit narrows it from the whole decision, the tool-call query and the Dispatcher wait, but does not close it, and the Timeline has no conditional append.
The same investigation found an independent race: when a queued user input starts the next turn at the report turn's end before Goal's decision for that turn end runs,
decide_evaluationsees an open turn and skips the request, which is then never evaluated and the goal later pauses withno_progress. This race is tracked in #1998 and is not changed by PR #1970.yyhhyyyyyy commentedon Nov 22, 2026
Reopening. #1970 merged commit 992d2cb, which narrows this race but does not close it, so its
Fixes #1989closed this issue too early.Correction to my earlier comment: the remaining window is not a few instructions wide. As #1970 (review) points out, after Goal's second decision the continuation is written through
Timeline::input_checked, which awaits a submission lookup before it takes the commit lock. A report input that commits during that await is not seen by the decision, so a continuation can still be written after the completion request. This comes from reading the source; it has not been reproduced yet.The missed evaluation when a queued input starts the next turn first is a separate race, tracked in #1998.
docs(goal): state the conditional append's replay answer and mechanism