ductor icon indicating copy to clipboard operation
ductor copied to clipboard

bug: InterAgentBus async fails silently when named session ID is stale (after CLI update/cache clear)

Open alexeymorozua opened this issue 8 months ago • 2 comments

Summary

When Claude CLI is updated or its session cache is cleared, named session IDs stored in named_sessions.json become invalid. The InterAgentBus attempts to resume these stale sessions and fails silently — the calling agent receives no response and no error.

Steps to Reproduce

  1. Use ask_agent_async.py to send a message between agents (e.g., main → sonic)
  2. Update Claude CLI or clear its session cache
  3. Send another async message — it appears to succeed (returns task_id) but no response is ever delivered

Observed Behavior

  • ask_agent_async.py returns a task_id immediately (looks like success)
  • Bus internally attempts claude --resume <stale_session_id>
  • Claude CLI outputs: No conversation found with session ID: <id>
  • Bus exits with empty output (exit=1), delivers nothing to the caller's Telegram chat
  • No error or warning is shown to either agent

Expected Behavior

When No conversation found with session ID is returned, the bus should:

  1. Discard the stale session ID
  2. Start a fresh session (without --resume)
  3. Deliver the response normally

Workaround

Manually reset session_id to "" in:

  • ~/.ductor/named_sessions.json — sessions from main agent
  • ~/.ductor/agents/<name>/named_sessions.json — sessions from each sub-agent

After reset, the next call creates a fresh session automatically.

Environment

  • Ductor: v0.15.0
  • Claude CLI: updated from 2.1.76 → 2.1.79 (triggered the issue)
  • Multi-agent setup: main + sonic agents

Impact

All async inter-agent communication breaks silently after any Claude CLI update. The only symptom visible to the user is that async responses never arrive.

Co-Authored-By: Claude Sonnet 4.6 [email protected]

alexeymorozua avatar Mar 19 '26 21:03 alexeymorozua

Fixed in v0.16.0 (commit 9782e32). InterAgentBus.send_async now detects SessionNotFound-class errors from the provider CLI, falls back to a fresh session, and emits a visible warning instead of failing silently. Recovery is capped at one retry (v0.16.0 MED fix) so there's no silent cascade — if the retry also fails, you get an explicit session.recovery_failed message in your chat language.

PleasePrompto avatar Apr 21 '26 10:04 PleasePrompto

Fixed in v0.16.0 (commit 9782e32).

InterAgentBus.send_async now detects SessionNotFound-class errors from the provider CLI, falls back to a fresh session, and emits a visible warning instead of failing silently. No more mysterious no-ops after a CLI cache clear / update. The recovery is per-attempt (not retry-forever), so you'll see a warning in logs once, the fresh session starts, and the message is delivered. A v0.16.0 late-stage fix also added a circuit-breaker: recovery is capped at one retry, so if the retry also fails you get an explicit user-facing error instead of silent cascade.

PleasePrompto avatar Apr 21 '26 10:04 PleasePrompto