Skip to content

Live execution output gets stuck on 'Waiting for execution output...' #68

Closed

Description

@vybe

Problem

Live execution output in ExecutionDetail.vue gets stuck showing "Waiting for execution output..." spinner indefinitely. The SSE streaming mechanism has a race condition and lacks fallback recovery.

Root Cause Analysis

Race Condition (async mode)

  1. Backend creates execution record with status="running" and spawns background task via asyncio.create_task(_execute_task_background(...))
  2. Backend returns execution_id immediately to frontend
  3. Frontend navigates to /executions/{id}, sees status="running", starts SSE streaming
  4. Frontend SSE fetch → backend proxies to http://agent-{name}:8000/api/executions/{id}/stream
  5. But the background task may not have delivered /api/task to the agent yet, or the agent hasn't started the subprocess and registered it in the process registry
  6. Agent returns 404 → backend proxy sends error + stream_end → frontend calls handleStreamEnd() → sets isStreaming=false → loads execution (still "running") and log (empty) → no further action

No Retry/Polling Fallback

After handleStreamEnd(), there is no mechanism to:

  • Retry streaming connection
  • Poll for execution status changes
  • Re-initiate streaming when the agent catches up

Proxy Hang Scenario

If the agent container is slow/unresponsive (not 404, just hanging), httpx.AsyncClient(timeout=None) blocks indefinitely. The backend proxy has no connect timeout. No keepalive is sent from the proxy layer (keepalives only exist in the agent-side generator). Frontend fetch sits waiting forever → permanent "Waiting for execution output..." spinner.

Error Swallowing

ExecutionDetail.vue:547-549 — when receiving {"type": "error"} from the stream, it only logs to console and continues. No user-visible feedback.

Affected Files

Component File
Frontend streaming UI src/frontend/src/views/ExecutionDetail.vue (lines 293-295, 500-579)
Backend SSE proxy src/backend/routers/chat.py (lines 1378-1439)
Agent SSE endpoint docker/base-image/agent_server/routers/chat.py (lines 300-374)
Process registry docker/base-image/agent_server/services/process_registry.py

Proposed Fixes

1. Add polling fallback when stream ends prematurely

In handleStreamEnd(), if execution status is still "running", start a setInterval that:

  • Polls execution status every 5s
  • Retries streaming connection when execution is confirmed running on the agent
  • Stops when execution completes or fails

2. Add connect timeout to backend SSE proxy

Replace httpx.AsyncClient(timeout=None) with a proper timeout config:

timeout = httpx.Timeout(connect=10.0, read=None, write=None, pool=None)
async with httpx.AsyncClient(timeout=timeout) as client:

3. Add keepalive in backend proxy

Send keepalive comments from the backend proxy layer if no data received from agent within 30s, preventing frontend fetch from timing out.

4. Surface stream errors to user

Instead of just console.error, show a toast/notification when stream errors occur, and provide a "Retry" button.

Activity

  1. added
    bug
    priority-p1
    on Mar 5, 2026
  2. added
    status-in-progress
    on Mar 14, 2026
  3. added a commit that references this issue on Mar 14, 2026
  4. removed
    status-in-progress
    on Mar 14, 2026
  5. added
    complexity-low
    on Jun 3, 2026
  6. added a commit that references this issue on Jul 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcomplexity-lowpriority-p1

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions