Commit graph

16 commits

Author SHA1 Message Date
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
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
dbbdd26cc5 Split unusable response loop control
Handle empty model responses and repeated response content in separate message-loop result extensions. Move the repeat retry log text into a framework prompt.

Cover empty-response logging and repeated content with reasoning.
2026-08-24 22:07:11 +03:00
linkliti
eaeec455e2 Preserve Unicode in streamed Responses output
Keep synthesized Responses tool-call JSON readable in raw LLM log details and show a concise agent-prefixed repeat warning in the WebUI.

Cover streamed Cyrillic function-call arguments and repeat-warning display.
2026-08-24 20:11:30 +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