Repository navigation
Description
Summary
Executions triggered from the Chat UI fail with "Silent launch failure: no Claude session created within 60 seconds" even though the agent container is healthy, reachable, and has available capacity. The user sees the execution start in the UI (status changes to "running"), but no Claude session is ever created. The cleanup service eventually marks it as failed. Simple MCP-triggered tasks (e.g. a ping) succeed on the same agent moments before/after the failure.
Component
Backend / Chat Router / Execution Dispatch
Priority
P2
Error
Silent launch failure: no Claude session created within 60 seconds
Backend log shows the slot is acquired and background task starts, but no further activity:
[Slots] Agent 'agent-name' acquired slot 1/3 for execution EXEC_ID (TTL=1200s)
[Task Async] Started background task for agent 'agent-name', execution_id=EXEC_ID
No subsequent session creation, no error logged — the execution simply goes silent until the cleanup service kills it.
Observed Behavior
Timeline from a real incident (all times UTC):
- 16:31:40 — MCP ping task dispatched → succeeds in 8.5s (proves agent is healthy)
- 16:32:49 — Chat
/repurposetask dispatched → slot acquired, background task started - No further logs — no Claude session created, no error, no communication with agent container
- 16:38:15 — Cleanup service marks execution as failed: "no Claude session created within 60 seconds"
- 16:40:25 — Same task retried from Chat → succeeds (session created, model set)
The failed execution had claude_session_id: null and model_used: null. The successful retry had claude_session_id: "dispatched" and model_used: "claude-opus-4-5-20251101".
Reproduction Steps
- Have an agent running with available capacity slots
- Verify agent is healthy (MCP ping succeeds)
- Send a task from the Chat UI (especially a longer/complex task)
- Observe execution enters "running" state in the UI
- Wait 60+ seconds — execution fails with "Silent launch failure"
- Retry the same task — it may succeed on the next attempt
This is intermittent. In one session, 10 out of 11 executions failed this way. After agent container restart, the first Chat-triggered task failed but the second succeeded.
Root Cause
Investigation needed. The background task created by [Task Async] silently fails to communicate with the agent container's agent-server. No error is logged, suggesting the HTTP call to the agent container either hangs indefinitely or fails without being caught.
Possible causes:
- The async background task loses its HTTP connection context
- Agent-server inside the container is not ready or drops the connection
- Chat-specific dispatch path differs from MCP dispatch in a way that causes silent failures
- Race condition in the execution dispatch — task is queued but never actually sent to the agent
Suggested Fix
Investigation needed. Key areas to check:
- Chat dispatch path (
routers/chat.py) — compare with MCP dispatch path to find differences - Background task error handling — ensure exceptions in the async task are caught and logged
- Agent-server communication — add timeout and retry logic for the HTTP call to the agent container
- Session creation tracking — log explicitly when the backend attempts to create a Claude session and what response it gets
At minimum, the background task should log an error if it fails to communicate with the agent container, rather than silently dying.
Impact
- Users see executions "start" but silently fail — confusing UX
- Failed executions hold capacity slots until cleanup (up to 60s+ delay)
- Users retry repeatedly, filling all slots, making the agent appear completely stuck
- In the observed incident, 10 consecutive failures caused the agent to be at capacity (3/3) with no real work running
Environment
- Trinity version:
bc36011 - Agent container: healthy, running, reachable (131ms latency)
- Auth: subscription (OAuth) + API key
Related
- bug: Executions stuck in 'running' state due to scheduler/backend database split #90 (closed) — Original "executions stuck in running state" issue (scheduler/backend DB split)
- bug: APScheduler max_instances=1 causes skipped executions despite agent having parallel slots #132 — APScheduler max_instances=1 causes skipped executions
src/backend/routers/chat.py— Chat dispatch logicsrc/backend/services/cleanup_service.py— Silent launch failure detectionsrc/backend/services/slot_service.py— Slot acquisition/release
Activity
fix(chat): prevent silent launch failure on async task executions (#279)
fix(chat): prevent silent launch failure on async task executions (#279…
fix(chat): mark execution dispatched + persist real session_id (#686)
fix(chat): mark execution dispatched + persist real session_id (#686) (…