agent-zero/extensions/python
wgnr-ai 663d4b5e79 fix: prevent silent chat death and reduce streaming overhead
Three-factor compound failure causing chat sessions to silently stall:

1. Silent Exception Death (helpers/defer.py):
   DeferredTask._on_task_done() captures exceptions in Future but
   no code reads it. Chat sessions die with zero UI feedback.
   Fix: Log exceptions and notify AgentContext on task failure.

2. O(n²) Per-Chunk DirtyJson Parsing (agent.py):
   stream_callback runs extract_json_root_string() + json_parse_dirty()
   on EVERY streaming chunk with growing string length.
   Fix: Only parse when full.rstrip() ends with } or ].

3. Indefinite History Compression Wait:
   organize_history_wait has await task.result() with no timeout.
   Fix: Wrap with asyncio.wait_for() 30s timeout.

Amplifier: All chats share one EventLoopThread singleton,
making concurrent sessions particularly affected.
2026-04-10 02:17:22 +00:00
..
_functions refactor(chat_branching): ID-based log ↔ history linking for precise branch trimming 2026-03-24 03:04:09 -07:00
agent_init refactor(chat_branching): ID-based log ↔ history linking for precise branch trimming 2026-03-24 03:04:09 -07:00
banners Add unzip to Docker base packages, refactor API key handling, improve self-update system 2026-03-24 17:17:19 +01:00
before_main_llm_call refactor(chat_branching): ID-based log ↔ history linking for precise branch trimming 2026-03-24 03:04:09 -07:00
error_format BIG PYTHON REFACTOR 2026-03-05 17:28:11 +01:00
hist_add_before Refactor extensions to async/sync API 2026-03-06 11:32:08 +01:00
hist_add_tool_result Refactor extensions to async/sync API 2026-03-06 11:32:08 +01:00
job_loop refactor: add file system watchdog support for API handlers, extensions, and plugins 2026-03-18 21:07:33 +01:00
message_loop_end BIG PYTHON REFACTOR 2026-03-05 17:28:11 +01:00
message_loop_prompts_after feat: Standalone preset storage, override permission hardening & bug fixes 2026-03-18 06:49:54 -07:00
message_loop_prompts_before fix: prevent silent chat death and reduce streaming overhead 2026-04-10 02:17:22 +00:00
message_loop_start BIG PYTHON REFACTOR 2026-03-05 17:28:11 +01:00
monologue_end BIG PYTHON REFACTOR 2026-03-05 17:28:11 +01:00
monologue_start refactor: remove browser model, use chat model for browser; update extension references 2026-03-14 20:06:43 -07:00
process_chain_end BIG PYTHON REFACTOR 2026-03-05 17:28:11 +01:00
reasoning_stream BIG PYTHON REFACTOR 2026-03-05 17:28:11 +01:00
reasoning_stream_chunk BIG PYTHON REFACTOR 2026-03-05 17:28:11 +01:00
reasoning_stream_end BIG PYTHON REFACTOR 2026-03-05 17:28:11 +01:00
response_stream refactor(chat_branching): ID-based log ↔ history linking for precise branch trimming 2026-03-24 03:04:09 -07:00
response_stream_chunk BIG PYTHON REFACTOR 2026-03-05 17:28:11 +01:00
response_stream_end BIG PYTHON REFACTOR 2026-03-05 17:28:11 +01:00
startup_migration refactor: migrate extension system to use deep directory paths based on module and qualname 2026-03-22 21:48:01 +01:00
system_prompt refactor: use @extensible decorator on build_prompt functions 2026-03-20 12:48:26 +08:00
tool_execute_after BIG PYTHON REFACTOR 2026-03-05 17:28:11 +01:00
tool_execute_before BIG PYTHON REFACTOR 2026-03-05 17:28:11 +01:00
user_message_ui BIG PYTHON REFACTOR 2026-03-05 17:28:11 +01:00
util_model_call_before BIG PYTHON REFACTOR 2026-03-05 17:28:11 +01:00
webui_ws_connect refactor: rename state_sync namespace to webui and simplify handler event registration 2026-03-20 15:34:59 +01:00
webui_ws_disconnect refactor: rename state_sync namespace to webui and simplify handler event registration 2026-03-20 15:34:59 +01:00
webui_ws_event refactor: rename state_sync namespace to webui and simplify handler event registration 2026-03-20 15:34:59 +01:00
.gitkeep BIG PYTHON REFACTOR 2026-03-05 17:28:11 +01:00