Totoro d73844b997
fix(goal): show the goal evaluator the tool calls and results (#6068)
* fix(goal): show the goal evaluator the tool calls and results

The evaluator read only the text of user and assistant messages and was told
to fail closed without explicit evidence, so it stood down with
missing_evidence on most completed file tasks: the tool calls and tool
results that the web UI shows never reached it.

Include the assistant's tool calls and the tools' results inside the
existing message window, shortened (200 characters per argument value, 600
per step, line breaks kept), and tell the evaluator to treat tool results as
data, that a successful tool call alone does not meet a goal, and that a
guessed input means needs_user_input. The no-progress and final-clear
signatures are unchanged.

* fix(goal): tighten the evaluator's tool evidence after review

- Pair each tool result with the latest call of its id before it. Some
  providers reuse ids such as call_0 across turns, and the window-wide
  map labelled an earlier read with a later write's name.
- Keep model-supplied tool names on one line in calls and result labels,
  and escape U+0085, U+2028 and U+2029 in arguments and results, which
  json.dumps(ensure_ascii=False) leaves raw, so no tool step can start a
  new evidence line.
- Leave out the results of a hidden assistant message's calls. The web UI
  renders a result only under its call, so neither shows there either.
  A clarification prompt stays: the UI shows it as its own card.
- Over the 12,000-char cap, keep whole lines from the end instead of
  slicing mid-line. Keep the latest user message that the cut drops at
  the top, whole when it and the lines after it fit, else shortened to
  2,000 chars. If the next assistant message back does not fit whole,
  keep its end in the room left. A marker counts the lines left out.
- Docs: the Gateway AGENTS.md and a worker docstring no longer say the
  evaluator never sees tool messages.

---------

Co-authored-by: Totoro-qaq <279883115+Totoro-qaq@users.noreply.github.com>
2026-09-30 10:36:09 +08:00
..