Repository navigation
test(goal): skip Goal's append inputs in the scripted model tail selection - #2208
Conversation
…ction A goal_update report commits its state record and completed trigger as append-mode inputs in one atomic batch ahead of its tool result, and inputs applied while a tool batch runs are consumed together with the batch's result. Under CPU load the input events land before the result commits, so the rendered request ends in a <dim-goal> user message rather than the tool result. The beta flow ScriptedModel read the tail through EchoModel::last_message, which skips runtime state and rule blocks but not <dim-goal> blocks, matched the held after-tool call as an ordinary user text, and the held invocation was never entered: the test's own 20 s bound expired on loaded Linux runners. The consumption order is the documented behavior, so the defect is in the test's reading of it. ScriptedModel::matches and last_user_text now share one tail selection that also skips Goal's append-mode inputs (state records, evaluator conclusions, the legacy status retirement blocks, and the completed/blocked/edit/pause/clear triggers) while driving inputs (set/resume, continuations, evaluations) keep their meaning. A deterministic regression test of the selection fails on main and passes here; beta_5 passes 20 consecutive runs on this head, and a probe of main reproducing the CI timing fails 5/5 without the fix and passes 5/5 with it. No production code changes; timeout constants and business assertions are unchanged. Refs #2203
eric8810
left a comment
There was a problem hiding this comment.
The fix matches Goal's input modes: the scripted model skips append-only state, status, report, and change blocks, while keeping set, resume, continuations, and evaluator cues. Using the same tail selector for the halt and its text fixes the ordering assumption without changing runtime behavior or increasing the timeout.
On exact-head Linux CI, both beta_5_edit_supersedes_the_request and scripted_matches_skip_goal_inputs_riding_a_tool_result passed. The overall gate is still red: exists_answers_loaded_unloaded_closed_and_deleted timed out during App Server startup with SqliteStorage Loading, before its assertions. That is a different failure from #2203, in a binary not touched by this patch. This approval is for the test fix, not a claim that the gate is green. I did not rerun the probe locally.
Simon-He95
left a comment
There was a problem hiding this comment.
Reviewed at 7b1103ad. Test-only: select_last shares one tail selection between matches and last_user_text and skips exactly the append-mode inputs Goal commits with a tool result (kind=state/report/status, and kind=goal with completed/blocked/edit/pause/clear), while keeping set, resume, continuations and evaluations as driving inputs. The new deterministic case covers both the riding-block and driving-input sides. No production behavior changes.
CI note: the verify (linux) failure at this head is the unrelated agents::sessions 10 s startup-budget timeout, addressed by #2231; rerun before merge. Code LGTM.
zerob13
left a comment
There was a problem hiding this comment.
Approved at 7b1103ad36c5c43124f630355f137a3d1f24182e.
The shared test selector skips append-only Goal blocks without dropping the inputs that drive the next response. The selector fixture and affected Goal edit flow pass in the tested merge. The unchanged Session-existence test hit a SQLite startup timeout that also occurred before this patch. #2231 later widened that test's allowance on main; no fresh CI for this PR has exercised the new base. ci-ok remains red.
Fixes #2203.
goal_beta_flow::beta_5_edit_supersedes_the_requesttimed out in the Linux verify job of an unrelated pull request: its 20 s bound on a held model call expired because the test'sScriptedModelnever recognized the turn it was told to hold.Root cause, in the test stub. When
goal_updateruns, Goal commits its state record and the completion trigger as append-mode inputs in one atomic batch, and inputs applied while a tool batch runs are consumed together with the batch's result, so under CPU load the rendered request ends in a<dim-goal>user message rather than the tool result. The stub selected the tail message throughEchoModel::last_message, which skips runtime state and rule blocks but not<dim-goal>blocks, matched the call as an ordinary user text instead of the after-tool halt, and the held invocation was never entered. This consumption order is the documented behavior, so the product is correct and only the test's reading of it is wrong. No production code changes: the diff is confined tocrates/dim-goal/tests/goal_beta_flow.rs, every timeout constant and business assertion is unchanged.The fix.
ScriptedModel::matchesandlast_user_textnow share one tail selection that, like the state and rule envelopes, also skips Goal's append-mode inputs:kind="state"records,kind="report"evaluator conclusions, thekind="status"retirement blocks that end a legacy status key, and thekind="goal"triggers whose op iscompleted,blocked,edit,pauseorclear. Driving inputs keep their meaning:op="set"andop="resume", continuations, evaluations, and plain user text.Evidence. A probe of main with a 50 ms delay inserted before the tool executor writes the batch result reproduced the CI failure deterministically: 5 of 5 runs failed with the job's exact signature,
the held model call: Elapsedafter 20 s. With only this test fix applied on the same probe, 5 of 5 runs pass. On this branch's head,beta_5passes 20 consecutive runs. The added deterministic regression test of the tail selection fails on main (Some(Text("<dim-goal kind=\"state\" ..."))where the after-tool halt is expected) and passes here.