agent-zero icon indicating copy to clipboard operation
agent-zero copied to clipboard

Post-task LLM consolidation failure crashes run_ui and prevents UI reconnection

Open WallaceWebster opened this issue 2 months ago • 1 comments

Environment:

Agent Zero v2.11, Docker container, Ubuntu 24.04 VPS: 2 vCPU / 4GB RAM (KVM hypervisor, Hostinger) Supervisord managing run_ui, run_cron, run_tunnel_api Sequence of events:

Complex multi-file task completed successfully by Agent Zero (confirmed in docker logs — full response delivered) Immediately after task completion, docker logs showed: Warning: LLM consolidation analysis failed: LLM response is not a valid JSON object WebSocket disconnected: Info: WebSocket disconnected: namespace=/ws sid=... run_ui crashed — supervisord auto-restarted it (confirmed by uptime of 0:37:34 when discovered) Agent Zero web UI displayed a persistent red disconnect indicator with no content loading Hard browser refresh did not resolve the disconnected state despite run_ui being confirmed RUNNING via supervisorctl System state after crash/restart (vmstat):

Metric Value Normal baseline us (user CPU) 47% ~4% pre-v2.11 sy (system CPU) 26% ~1% id (idle) 23% ~90% cs (context switches/sec) 32,000 ~440 st (steal) 4–7% 0% The context switch rate of 32,000/sec is approximately 70x the normal baseline. Combined with us+sy consuming ~73% of CPU, the system was too loaded to serve the UI even though run_ui was running.

What was NOT resolved by:

Browser hard refresh (Ctrl+F5) Waiting for run_ui to settle after supervisord restart Opening a new browser tab Resolution required:

Direct docker cp to extract completed files from container to host filesystem SCP to retrieve files to local machine Manual supervisorctl stop run_ui to prevent further CPU accumulation Three distinct bugs observed:

LLM consolidation failure crashes run_ui — the memory consolidation step after a complex task produces an invalid JSON response from the LLM, which causes run_ui to crash rather than gracefully log and continue UI cannot reconnect after supervisord-triggered restart — after auto-restart, the web UI is permanently stuck in a disconnected state and cannot be recovered without stopping and starting run_ui manually Post-task context switch thrashing — after the task + crash, cs jumps to ~32,000/sec (from ~440 baseline), consuming sy=26% on top of the existing us=47% asyncio baseline from #1875, making the system effectively unresponsive Relationship to #1875: The 47% idle us CPU from #1875 is the pre-existing condition that makes this crash particularly damaging — when the consolidation failure triggers a restart and post-task thrashing, there is no CPU headroom to recover. On a properly idle system (pre-v2.11 ~4% us), this crash would be a minor inconvenience. On a v2.11 (or v2.12 for that matter as these issues remain) system it makes the platform unusable.

Request:

Fix the LLM consolidation failure to handle invalid JSON gracefully without crashing run_ui Add UI reconnection capability after supervisord-triggered restarts (without requiring manual stop/start) Investigate the post-task context switch spike — something in the cleanup/consolidation path after complex tasks is thrashing

WallaceWebster avatar Sep 21 '26 03:09 WallaceWebster

I'm working on this and will open a PR against ready for review. — Aditya Deore

AdityaxDeore avatar Nov 04 '26 09:11 AdityaxDeore