Keep the original model response in turn-local repair data so Context Doctor
honors Update log content: off retains raw XML/DSML in View Details, while
on shows repaired JSON. Mark successful recovery notices as utility messages
so they follow the existing UTL visibility preference.
Accept an outer headline alongside DSML tool_args and preserve it through
normalization. Keep parallel calls, nested arguments and command escaping
intact, with normal repair fallback and dispatch unchanged.
Add regression coverage for both transports, log-setting states, disabled
Context Doctor, repeated repair hooks and outer versus nested headlines.
Update the owning documentation and include the reported DSML fixture.
Validation: 263 focused tests passed locally and in the Docker framework
runtime. The live instance restarted successfully and its health check passed.
Let unconverted alternate-format output reach Context Doctor's existing JSON
repair path. Remove the leaked-call rejection state, retry hook and prompts
so missing delimiters and other repairable output can execute in the same
turn, restoring the behavior from before PR #1920.
Keep complete XML/DSML/native-text conversion, normal tool permissions,
Context Doctor's XML history cleanup and existing output-limit handling.
Update integration tests and ownership documentation for the restored flow.
Validation: 504 targeted tests passed both locally and in the Docker framework
runtime, including actual agent-loop tests for missing brackets and braces.
Historical comparisons matched pre-PR behavior in 48 cases and confirmed
12 additive format-conversion cases. Restarted the local runtime and verified
its health and extension discovery.
Separate leaked-call classification from retry handling so Context Doctor
can apply XML suppression, thought splitting, and log settings before the
history entry is saved. Keep rejected calls out of JSON repair and tool
dispatch; disabling XML suppression retains them only as thoughts.
Core still owns bounded retries and history insertion, defaults to {} when
the plugin is disabled, and clears replayable Responses output and pending
continuation state. Update plugin settings guidance and ownership docs.
Validation: 455 focused tests passed locally and in Docker's framework
runtime. Restarted the idle live app, verified health and actual extension
ordering, and found no startup error markers.
Store a neutral {} for rejected or incomplete leaked calls so retries do
not reinforce malformed XML or JSON. Keep the original result available
for diagnostics and preserve the existing warning and retry limits.
Remove replayable output items from the history copy and clear the
Responses continuation after normal history insertion. Retain recorded
turn IDs and usage while forcing the next request to use cleaned history.
This works with Context Doctor enabled or disabled.
Validation: 349 focused parser, dispatch, history, Responses, streaming,
Context Doctor, and retry-limit tests passed for this standalone change.
Framework warning log rows no longer repeat the agent name before the message text, covering tool and execution errors, the misformat notice, and the truncated, empty, repeat and fallback response warnings. A source-level regression test keeps the warning rows prefix-free, and the message-loop and context-doctor DOX and tests stop expecting the removed prefix.
Validation: pytest tests/test_warning_log_prefixes.py tests/test_tool_action_contracts.py tests/test_message_loop_result.py plugins/_context_doctor/tests/test_context_doctor.py
Reject incomplete native-call argument JSON during output-limit recovery
while allowing complete calls to proceed. Publish observed finish reasons
and canonical calls before terminal or flushed stream output reaches
callbacks, so early cancellation preserves the original result metadata.
Cover sync and async installed-SDK streams, callback stops, incomplete and
mixed native-call batches, and result/history metadata compatibility.
Update the owning extension and transport documentation.
Validation: 327 focused tests passed in the Docker framework runtime;
333 tests and 11 subtests passed in the updated local environment.
Live localhost:32081 checks passed with Codex Responses and Opus Chat
Completions through the Agent Zero LLM API. A real 64-token Opus cutoff
produced the dedicated length warning and recovered in one retry.
Record the Chat Completions finish_reason on LLMResult and add a
message_loop_result extension that, when a turn stopped at the output
token limit (finish_reason "length"/"max_tokens") without a complete
tool request, retries with a warning naming truncation as the cause
rather than the generic misformat message. The warning counts toward
the existing unusable-response loop limit.
Context Doctor now leaves results already handled by an earlier
extension untouched, so truncated envelopes are not repaired and
dispatched with cut-off arguments.
Fixes#1836
Compare public commentary together with canonical function calls when
recording and checking the previous response. This restores the historical
full-message policy for native turns, so changed or missing commentary
can distinguish otherwise identical calls.
Keep canonical call history, masking, provider metadata and state
advancement intact. Exclude provider IDs and separate reasoning from the
comparison; identical public text and calls remain guarded.
Cover commentary changes and absence, call changes and batches, provider
metadata round trips, and legacy thoughts/headline behavior. Update the
owning contracts. Verified with 177 passing tests, four recorded Mac
warning replays and a live two-call drill using the Codex II preset.
Show public commentary alongside native tool calls in generation logs while preserving separate reasoning summaries. Request commentary without a sentence limit and retain canonical calls when Chat Completions also returns text.
Use display-only previews for agent turns and reconcile completed output without changing legacy callbacks, native dispatch or provider metadata.
Validated with parser, streaming and prompt regression tests, plus live Codex II ordinary and parallel tool chats.
Store canonical function-call content through the existing assistant history and masking path, preserving original provider metadata. Compare that same content when detecting repeated responses so accompanying commentary cannot hide distinct calls.
Validated with 87 focused architecture, result, logging and Context Doctor tests plus a framework runtime history/repeat probe. Native history replay remains a separate change.
Make llm_result required in hist_add_ai_response and move _remember_llm_result_state inside so plugin authors cannot silently break response_id chaining. Drop manual state calls in main loop and _30_repeat_response. Pass empty LLMResult() for greeting and intervention progress. Document invariant in root AGENTS.md and affected extension DOX.
Reasoning-only turns now retry with an agent-facing fw.msg_reasoning_only.md history warning and a separate fw.msg_reasoning_only_response.md user notice, counted by the stop-unusable-response-loop extension instead of falling through to the unclear misformat path. Context Doctor detects raw-text fallback conversions and claims the turn with fw.msg_thoughts_fallback.md agent warning and fw.msg_thoughts_fallback_response.md user notice, also counted by the stop loop. Both cases set skip_default_processing so the model gets a clear retry instruction.
Track consecutive empty model responses in the empty-response handler so the agent stops once the configured unusable-response limit is reached, matching repeat and misformat recovery. Log the empty-response warning for under-limit iterations and switch to the framework limit warning when the loop is forced to stop.
Let extensions normalize or consume each completed model result before default history and tool processing. Move repeat detection into loop control and add a dedicated empty-response warning so one turn produces one UI warning.