Skip to content

A Goal completion request overtaken by a queued turn start is never evaluated #1998

Closed

Description

@yyhhyyyyyy

What happens

When a queued user input starts the next turn at a report turn's end before Goal's turn-end decision for that end runs, the completion request is never evaluated. No evaluator is created, the goal keeps writing continuations, and it later pauses with no_progress.

Reproduction

Deterministic, in the product profile: a fake model calls goal_update inside a real Loop and ToolExecutor turn, and a test hook holds Goal's turn-end decision before it reads the fold.

  1. Set a goal with judge="evaluator".
  2. Submit tool:goal_update {"status":"completed"} as a queued input.
  3. While the report turn runs, submit another queued input.
  4. Hold the report turn's turn-end decision before it reads the fold, and let the queued input's turn/start be folded first.
  5. Release the decision.

Observed sequence on the working branch:

 44 turn/end           (report turn)
 45 goal op=completed   (the request)
 54 turn/end           (the held decision)
 56 turn/start         (the queued input)
 65 turn/end
 66 continuation count=1
 76 continuation count=2
 86 continuation count=3
 96 state paused reason=no_progress

No branch/create is written.

Code

decide_evaluation (crates/dim-goal/src/fold.rs) requires !turn_open(). The request is only read by request_in_turn, whose window is the turn that ends at the decision's sequence, and retain_requests drops a request that is no longer in the current turn. Once the next turn/start is folded, the later decision for the earlier turn end cannot see the request any more.

Design

docs/design/plugins/Pursuit.md §4.1 creates the evaluator at turn/end N when the turn contains a completed block, §5 says N is the request's turn end, and the working-branch section says that while the evaluator works the working branch behaves as any active goal. None of these describe a request that is skipped: the request is simply not evaluated.

Scope

Found while fixing the stale-continuation failure in #1989. PR #1970 does not change this race.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions