Skip to content

CAI hangs indefinitely when a single turn issues multiple tool_calls (not covered by #370 idle-timeout) #469

Description

@mallangmollangquokka

Environment

  • cai-framework version: 0.5.10 (latest on PyPI, confirmed no newer version available)
  • OS: Windows 11 + WSL2 (Ubuntu 24.04, native ext4 filesystem, not /mnt/c)
  • Model: deepseek/deepseek-v4-flash and deepseek/deepseek-v4-pro (both reproduced)
  • Agent: default one_tool_agent

Summary

When the model returns multiple tool_calls in a single assistant turn, CAI sometimes hangs indefinitely with no output, no error, and no timeout — even well past the 10s idle-kill added in #360 / PR #370. The process just sits there until an external wrapper timeout (we used a 500s timeout wrapper) kills it.

I want to flag upfront: I have not isolated a minimal reproduction case, and I'm not 100% sure this is a distinct bug vs. some interaction with our specific setup (WSL2, DeepSeek provider, long-running session with many prior turns). Posting in case it's useful signal / matches something you're already tracking.

What we observed

Across ~9 separate long-running sessions solving a CTF challenge, the hang consistently coincided with turns where the assistant issued 2+ tool_calls at once, e.g.:

  • Two generic_linux_command calls in one turn (ls -la /tmp/ + ls -la ~/challenge/) — hung ~500s, no idle-kill message, no output.
  • A generic_linux_command using a python3 << 'EOF' ... EOF heredoc alongside another call in the same turn — same symptom.

By contrast, single-command turns (including ones that legitimately trigger the existing idle-timeout, e.g. find / scanning a slow mount) behaved correctly and printed [Terminated: idle 10s, likely waiting for input] as expected from PR #370.

This suggests whatever coordinates multiple tool_calls within one turn may not be covered by the per-command idle-detection added in #370 (which looks like it's scoped to a single command's I/O loop).

Expected behavior

Either:

  • The same idle-detection/timeout protection applies uniformly regardless of how many tool_calls are in a turn, or
  • Multiple tool_calls in one turn are executed strictly sequentially with each one individually protected by the existing idle timeout.

Notes

  • Confirmed unrelated to /mnt/* (9p) slowness — reproduced on pure native WSL2 filesystem.
  • Confirmed not model-specific to us, though we only tested DeepSeek; noting CAI hangs when using Anthropic provided Claude model #401 ("CAI hangs when using Anthropic provided Claude model") looked like it could be the same underlying class of issue with a different provider.
  • Happy to share full JSONL session logs if useful.

Thanks for the great project — apologies in advance if this turns out to be a config issue on our end rather than a CAI bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions