Commit Graph
23 Commits
Author SHA1 Message Date
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
Alessandro e7e79bdd0c Preserve raw recovery logs and DSML call headlines
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 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
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 9bc33fe761 Let Responses text reach the core response dispatcher
Keep usable Responses output text intact in Context Doctor so core can
complete it through the normal response tool and policy path. Continue
repairing recognizable tool intent and retrying plain Chat Completions text.

Verified 100 focused tests and direct Docker framework dispatch. Live Codex
preset terminal tasks used native calls with 79% and 78% cache hits; the same
chat switched to Venice and completed its Chat Completions terminal task.
2026-09-06 18:57:45 +02:00
Alessandro b41f0e53f6 Preserve native tool calls through Context Doctor
Leave canonical function calls and their accompanying text untouched by
text repair. Otherwise a valid native call with plain-text output can enter
the fallback branch and skip normal tool dispatch. Apply this to both
Responses and Chat Completions while retaining the existing execution
policy gate and text-only repair behavior.

Cover plain text, XML-like output, and a textual second call, including
metadata preservation and single native dispatch. Update the plugin
contract. All 144 focused tests pass; two live Codex OAuth terminal tasks
completed with final cache hits of 77% and 76% in the context viewer.
2026-09-06 17:20:57 +02:00
linkliti 73ba1bb0cc Fix raw-text fallback classification
Move raw thoughts wrapping after repair selection so fallback warnings and retry handling run for plain text. Cover the Hello there… regression and align tool-args display assertions with response exclusion and reserved-key filtering.
2026-09-05 15:18:13 +03:00
linkliti 093b9106ef Tighten context doctor usable-response detection
Guard empty/whitespace LLM responses so context_doctor defers to _20_empty_response instead of polluting history with {thoughts:[]}. Require looks_like_tool_call to find at least one A0 key with a usable non-empty value (non-empty list of non-empty strings for thoughts, non-empty string for headline/tool_name, non-empty dict for tool_args). Update AGENTS.md contract and add regression tests for empty/blank/wrong-type rejections.
2026-09-04 18:33:01 +03:00
linkliti 60073f283a Add LLMResult.non_llm sentinel and apply frdel review findings
Add LLMResult.non_llm classmethod for non-LLM AI turns (greeting, intervention progress) so stored metadata does not claim a Responses-API turn. Rename is_thoughts_fallback to looks_like_tool_call (inverted polarity: True when valid A0 response JSON). Rework check to accept any dict containing at least one A0 key (thoughts/headline/tool_name/tool_args); empty dicts and non-A0 dicts fall through to the raw-text fallback branch. Fix drawMessageAgent kvps order to thoughts, tool_name, tool_args keys (reserved keys skipped), then step; reserved keys (thoughts, step, reasoning, tool_name, tool_args, args, headline) win over colliding tool_args keys. Document Hello! seeding turns as few-shot example, drawMessageDefault as deprecated, and plugin get_log_object duplication as intentional. Align context_doctor DOX kvps sentence with code (reasoning only, not thoughts).
2026-09-04 17:44:40 +03:00
linkliti 891191ba10 Update fallback log kvps with transformed thoughts
Fallback turns now refresh the generating log item kvps with the transformed thoughts JSON and preserved reasoning, matching the non-fallback path so View Details shows the repaired content. Add assertions covering kvps, reasoning retention, and raw content.
2026-09-04 00:49:37 +03:00
linkliti 19da9a07e3 Own fallback turn retry in Context Doctor
Context Doctor now persists the transformed thoughts JSON via hist_add_ai_response before emitting the fallback warning, matching the RepeatResponse retry pattern. Simplify is_thoughts_fallback to check tool_name absence so split multi-paragraph and native thoughts JSON are detected. Remove the core stop-unusable-response-loop counter for plugin-owned fallback warnings. Delete unreachable skip_default_processing block after the early fallback return.
2026-09-04 00:20:43 +03:00
linkliti fb84e46c69 Add split-thoughts repair strategy to context doctor
Extracts value selection into _select_value helper, mutates _split_thoughts in place, and applies the split once after repair. Adds a split_thoughts config (default on) with a Strategies section in the plugin settings UI, regression tests for blank-line splitting in repaired JSON, raw-text fallback, and disabled mode. Keeps reasoning-only kvps retention and the raw-text fallback claim path.
2026-09-03 03:53:38 +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 77e5515261 Revert escalating reasoning to thoughts kvp
Revert the stream-end copy of reasoning into thoughts, the context-doctor preservation of thoughts through log refresh, the related regression tests, and the AGENTS.md wording. thoughts is no longer auto-populated from reasoning when absent.
2026-09-03 03:37:59 +03:00
Alessandro dcf5c1500e Preserve native reasoning as thoughts
Promote native reasoning summaries after response streaming completes and keep the normalized thoughts through Context Doctor log refreshes. Add regression coverage for both lifecycle boundaries.
2026-08-27 08:54:47 +02:00
linkliti 51a02bd4f5 Context Doctor polish
Improve code quality of context doctor. Add handling of Reasoning kvps. Bump json_repair version
2026-08-26 13:14:12 +00:00
Alessandro 519f2c2a62 Install Context Doctor dependency after self-update
Read the pinned json_repair requirement from the root requirements file and install it into the active framework interpreter when the package is missing or stale.

Invoke the plugin hook during startup migration so self-updated installations converge without rebuilding the image.

Add focused coverage for version checks, install command construction, and startup dispatch.
2026-08-25 23:40:31 +02:00
linkliti e970e1e894 Pass through JSON objects with thoughts or headline
After repair, return a recovered JSON object that already contains thoughts or headline as compact JSON instead of wrapping the raw response in another thoughts envelope.
2026-08-25 09:26:04 +00:00
linkliti e85842c5dc Improve Context Doctor output handling
Repair completed non-tool output into compact thoughts JSON, preserve schema-guided selection of the most complete repaired tool call, refresh log fields, and create a response log only for response tool calls using text. Suppress XML-shaped malformed responses as configured.

Cover raw fallback, repaired-call selection, and response-log handling.
2026-08-24 21:43:30 +03:00
linkliti dac39537c9 Add Context Doctor plugin
Repair malformed Agent Zero tool-call JSON before default dispatch, then persist repaired compact response in WebUI log. Pin json_repair, retain targeted installed-parser patch, and expose XML suppression and log-detail settings.
2026-08-24 19:51:30 +03:00