Commit graph

20 commits

Author SHA1 Message Date
Alessandro
e7e79bdd0c Preserve raw recovery logs and DSML call headlines
Some checks are pending
Build And Publish Docker Images / plan (push) Waiting to run
Build And Publish Docker Images / build (push) Blocked by required conditions
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.
2026-10-28 17:30:49 +01:00
Alessandro
345571ca0e Restore Context Doctor repair before retrying malformed calls
Some checks are pending
Build And Publish Docker Images / plan (push) Waiting to run
Build And Publish Docker Images / build (push) Blocked by required conditions
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.
2026-10-27 22:19:53 +01:00
Alessandro
e10635aea0 fix: restore Context Doctor handling before tool retries
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.
2026-10-27 21:58:28 +01:00
Alessandro
b13fb41291 fix: keep rejected tool syntax out of model history
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.
2026-10-27 21:48:56 +01:00
Alessandro Frau
31ceafa2c1
Merge pull request #1966 from linkliti/feat/promote-plugins-v2
feat: Tool improvements
2026-10-27 18:24:19 +01:00
Alessandro
1373009168 Simplify leaked tool recovery and log completed responses 2026-10-23 18:18:56 +02:00
lazy
3a2e26981a Fix leaked tool-call recovery before result dispatch 2026-10-23 17:58:23 +02:00
linkliti
ebac0eb836 fix(ui): drop agent prefix from warning log rows
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
2026-10-21 23:37:32 +03:00
Alessandro
675e7d051d Guard truncated native calls and preserve stream finish metadata
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.
2026-10-13 20:50:30 +02:00
Mohammad Hijjawi
2f8a06515e Surface output-limit truncation instead of misformat retries
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
2026-10-13 19:38:05 +02:00
Alessandro
27b7df8917 Restore full-response repeat checks for native tool calls
Some checks are pending
Build And Publish Docker Images / plan (push) Waiting to run
Build And Publish Docker Images / build (push) Blocked by required conditions
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.
2026-10-06 18:49:30 +02:00
Alessandro
55aee9d857 Display native commentary as streamed thoughts
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.
2026-09-15 15:06:04 +02:00
Alessandro
5602d5c4be Preserve native calls in assistant history and repeat checks
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.
2026-09-06 20:10:46 +02:00
linkliti
4634070e95 Own Responses-API state advancement in hist_add_ai_response
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.
2026-09-04 16:12:38 +03:00
linkliti
296c7095ea Polish DOX prose to match frdel imperative-contract pattern
Diary verbs and packed bullets in AGENTS.md updates converted to imperative contracts and parallel ownership lines matching e138e33c baseline.
2026-09-04 15:09:34 +03:00
linkliti
0bd5f34848 Handle reasoning-only and plain-text fallback responses
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.
2026-09-03 03:37:59 +03:00
linkliti
ade1489790 Count empty responses toward unusable-response limit
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.
2026-08-25 02:54:56 +00:00
linkliti
84ed5bfb5c Keep empty response warnings out of history
Log empty-response retries without adding a warning message to model context.
2026-08-24 22:47:44 +03:00
linkliti
85baf6616d Document unusable response loop extensions
Describe empty-response and repeated-response message-loop handlers, including their prompt-backed history and UI warning text.
2026-08-24 22:12:47 +03:00
linkliti
fd30f33d52 Add result extension point and migrate repeat handling
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.
2026-08-24 19:51:30 +03:00