mirror of
https://github.com/agent0ai/agent-zero.git
synced 2026-10-14 22:07:00 +00:00
Count thoughts_fallback warning toward unusable-response limit
Context Doctor's fw.msg_thoughts_fallback.md warning was excluded from the core stop-unusable-response loop allowlist, so consecutive plain-text fallbacks never advanced the counter. Add it alongside misformat, repeat, empty_response, and reasoning_only, update the plugin DOX, and cover the behavior with a regression test.
This commit is contained in:
parent
891191ba10
commit
4a71f03768
3 changed files with 17 additions and 1 deletions
|
|
@ -24,6 +24,7 @@ class StopUnusableResponseLoop(Extension):
|
||||||
self.agent.read_prompt("fw.msg_repeat.md"),
|
self.agent.read_prompt("fw.msg_repeat.md"),
|
||||||
self.agent.read_prompt("fw.msg_empty_response.md"),
|
self.agent.read_prompt("fw.msg_empty_response.md"),
|
||||||
self.agent.read_prompt("fw.msg_reasoning_only.md"),
|
self.agent.read_prompt("fw.msg_reasoning_only.md"),
|
||||||
|
self.agent.read_prompt("fw.msg_thoughts_fallback.md"),
|
||||||
}:
|
}:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
- Repaired and fallback JSON is always minified.
|
- Repaired and fallback JSON is always minified.
|
||||||
- Nonempty non-tool output becomes `{"thoughts":[raw]}`; XML-like output becomes `{}` only when suppression is enabled.
|
- Nonempty non-tool output becomes `{"thoughts":[raw]}`; XML-like output becomes `{}` only when suppression is enabled.
|
||||||
- Blank-line-separated thoughts expand into separate entries after repair when the split strategy is enabled (default on).
|
- Blank-line-separated thoughts expand into separate entries after repair when the split strategy is enabled (default on).
|
||||||
- A raw-text fallback conversion emits a `fw.msg_thoughts_fallback.md` history warning and a separate `fw.msg_thoughts_fallback_response.md` user notice, refreshes the generating log and response item with the transformed thoughts JSON, then sets `skip_default_processing` so the retry advances the unusable-response counter. The warning prompts are plugin-owned and are not counted by the core stop-unusable-response loop.
|
- A raw-text fallback conversion emits a `fw.msg_thoughts_fallback.md` history warning and a separate `fw.msg_thoughts_fallback_response.md` user notice, refreshes the generating log and response item with the transformed thoughts JSON, then sets `skip_default_processing` so the retry advances the unusable-response counter. The fallback warning is counted by the core stop-unusable-response loop alongside `fw.msg_misformat.md`, `fw.msg_repeat.md`, `fw.msg_empty_response.md`, and `fw.msg_reasoning_only.md`.
|
||||||
- Log kvps retain streamed `reasoning` and `thoughts`, then add transformed output; `update_log` controls only View Details content.
|
- Log kvps retain streamed `reasoning` and `thoughts`, then add transformed output; `update_log` controls only View Details content.
|
||||||
- A repaired `response` tool call refreshes the response log item when streaming did not create it.
|
- A repaired `response` tool call refreshes the response log item when streaming did not create it.
|
||||||
- Runtime setup reads the `json_repair` pin from root `requirements.txt`; do not duplicate its version in plugin code.
|
- Runtime setup reads the `json_repair` pin from root `requirements.txt`; do not duplicate its version in plugin code.
|
||||||
|
|
|
||||||
|
|
@ -101,6 +101,21 @@ def test_reasoning_only_warning_counts_toward_the_limit(monkeypatch):
|
||||||
assert agent.loop_data.params_persistent[response_loop.STATE_KEY]["count"] == 1
|
assert agent.loop_data.params_persistent[response_loop.STATE_KEY]["count"] == 1
|
||||||
|
|
||||||
|
|
||||||
|
def test_thoughts_fallback_warning_counts_toward_the_limit(monkeypatch):
|
||||||
|
monkeypatch.setattr(
|
||||||
|
response_loop,
|
||||||
|
"get_settings",
|
||||||
|
lambda: {"max_consecutive_unusable_responses": 1},
|
||||||
|
)
|
||||||
|
agent = _agent()
|
||||||
|
extension = response_loop.StopUnusableResponseLoop(agent=agent)
|
||||||
|
|
||||||
|
data = _run(extension, agent, "thoughts fallback")
|
||||||
|
|
||||||
|
assert isinstance(data["exception"], HandledException)
|
||||||
|
assert agent.loop_data.params_persistent[response_loop.STATE_KEY]["count"] == 1
|
||||||
|
|
||||||
|
|
||||||
def test_general_settings_expose_the_default_failure_limit():
|
def test_general_settings_expose_the_default_failure_limit():
|
||||||
settings = get_default_settings()
|
settings = get_default_settings()
|
||||||
assert settings["max_consecutive_unusable_responses"] == 5
|
assert settings["max_consecutive_unusable_responses"] == 5
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue