Commit Graph
3 Commits
Author SHA1 Message Date
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 89a4853310 Surface provider refusals and stop automatic retries
Raise ContentPolicyViolationError for Chat Completions content_filter and
refusal finish reasons in both streaming and non-streaming responses.
Blocked output now reaches the existing visible critical-error handler
instead of being treated as an empty response.

Exclude provider refusals from the error-retry plugin so they do not
trigger repeated requests, repair-history injection, or media removal.
Add regression coverage for blocked tool output, stream cleanup, no
retry, and user-visible error logging; document the transport contract.

Validation: focused transport, retry, architecture, and prompt checks
passed across this change and the accompanying Anthropic adaptation
(125 tests). Replaying the original Opus 5.5 request in the live framework
surfaced the provider refusal.
2026-09-23 15:19:12 +02:00