Files
Alessandro 039efe4198 Keep model prose as thoughts and retry silently
Preserve free text and reasoning-only output in the current generation
and retry without intermediate warning rows. Require an explicit response
tool call to finish in both API modes, including after provider built-in
actions.

Keep history metadata, Responses state, tool validation and the
consecutive-failure stop intact. Allow core retries when Context Doctor
and its prompts are unavailable.

Validation: 411 backend tests and 2 Chromium live/replay grouping tests
passed; live runtime health check passed.
2026-11-01 06:50:49 +01:00
..
2026-08-24 19:51:30 +03:00

Context Doctor

Repairs model tool call JSON before sending it to history and tool processing.

Behavior

  • Uses json_repair on completed model output, including missing brackets, braces and unfinished arguments.
  • Selects a repaired Agent Zero tool call (tool_name and object tool_args) or preserves model-authored thoughts and headlines.
  • Stores repaired tool calls as compact JSON; log kvps retain streamed reasoning and add transformed fields.
  • Expands blank-line-separated thoughts into separate entries after repair when the split strategy is enabled.
  • Core first attempts conversion of complete alternate-format XML/DSML/native calls. Unconverted text still reaches Context Doctor's normal repair path.
  • With Update log content off (default), View Details keeps the original model output, including recovered XML/DSML. Turn it on to show repaired JSON instead. Recovery notices use the UTL badge and follow Show utility messages.
  • When no valid tool call is present, prose in either API mode and model-authored thoughts/headlines stay in the current generation as thoughts. The agent retries silently with an internal tool-call reminder; only an explicit response-tool call delivers the final answer. Unusable XML-like output is suppressed by default; turning suppression off keeps it as thoughts. The configured consecutive-failure limit still stops recovery with a visible notice.
  • Repaired calls use normal tool dispatch and permissions. Native transport calls and earlier output-limit handling retain their existing paths.