Frequent hangs when run from OpenClaw via background PTY
Resolved 💬 4 comments Opened Feb 14, 2026 by niceysam Closed Mar 17, 2026
Environment
- Claude Code: v2.1.42
- Invocation: OpenClaw
exec pty:true background:true - Model: us.anthropic.claude-opus-4-6-v1 (Bedrock us-east-1)
- Runtime: EC2 t3.medium (4GB RAM), Amazon Linux 2023
Problem
Claude Code frequently hangs (no output) or gets killed (signal 9) when run from OpenClaw as background PTY process on complex tasks.
Reproduction
Working case (simple)
# From OpenClaw
exec pty:true background:true command:"source ~/.bashrc && claude -p 'Summarize package.json'"
# Output: Success after ~30 seconds
Failing case (complex)
# From OpenClaw
exec pty:true background:true command:"source ~/.bashrc && claude --max-turns 50 -p 'Analyze codebase architecture'"
# Result: No output for 8 minutes → signal 9 (SIGKILL)
Pattern
- ✅ Simple 1-turn tasks: OK
- ❌ Complex multi-turn analysis: hang or signal 9
- ❌ Large directory analysis: hang or signal 9
Logs
Process shows "running" but no output in process action:log:
Process still running (pid 577007).
(no output yet)
After 8-48 minutes: signal 9 (killed by OS, not Claude Code).
Questions
- Does Claude Code buffer output until completion? (may explain "no output yet")
- Memory usage on large codebase analysis?
- Recommended flags for OpenClaw background PTY usage?
Workaround tried
--dangerously-skip-permissions: no effect--max-turns N: still hangs- Simple tasks only: works but defeats purpose
Expected
Either complete successfully or fail gracefully with error message, not silent hang.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗