Summary
When using Claude Code through the OpenCode compatibility layer (e.g. via Gigacode), sessions can appear to stall without any clear error or indication of what went wrong. After investigation, the root cause is not an actual stall but a UX gap: no events are emitted during long-running Bash command execution, making the UI appear frozen.
Investigation Findings
What looked like a stall
Session ses_1 appeared frozen in Gigacode. The last visible API event was a permission.resolved for cargo test --test sessions (evt_1247). No new events appeared for ~2.5 minutes.
What was actually happening
- Claude Code requested permission to run
cargo test --test sessions (5-minute timeout)
- The daemon auto-approved it (synthetic
permission.resolved, 0.4ms after request)
- The test binary was actively running (PID 1277960, 14-18% CPU)
- Once tests completed (~2.5 min), events resumed normally (evt_1248+)
The session was never stalled. The Bash command was executing, but sandbox-agent emits no intermediate events during Bash execution — so the UI had no way to show progress.
Transcript vs API event divergence
Comparing the session-ses_1.md transcript (generated from Claude Code's stream-json) with the sandbox-agent events API revealed:
|
API Events |
Transcript |
| Tool calls |
181 |
178 |
| Subagent (inner) calls |
117 (flattened inline) |
0 (collapsed into Task result) |
| Ordering |
All calls including subagent inner calls, flat |
Top-level calls only |
The ordering "mismatch" is because the API flattens subagent tool calls into the main event stream (each Read/Grep/Bash inside a Task appears as its own event with parent_tool_use_id), while the transcript collapses Task subagent activity into a single entry with a summary result.
This is not a bug — they're different views of the same activity. But it can be confusing when debugging.
Root Cause
No events emitted during Bash execution. When Claude Code runs a long command (e.g., cargo test with a 5-minute timeout), the sandbox-agent event stream goes silent until the command completes. There is no heartbeat, progress indicator, or "command still running" status event.
Suggested Improvements
- Emit periodic heartbeat/status events during long-running Bash commands (e.g.,
item.delta with a status content part like "Running: cargo test --test sessions (elapsed: 30s)")
- Surface Bash command start as a visible event so the UI can show "Executing command..." instead of appearing frozen
- Consider a timeout warning event when a command approaches its timeout limit
Environment
- Agent: Claude Code (via OpenCode compat layer)
- Interface: Gigacode
- Permission mode: default
- Model: claude-opus-4-6
Summary
When using Claude Code through the OpenCode compatibility layer (e.g. via Gigacode), sessions can appear to stall without any clear error or indication of what went wrong. After investigation, the root cause is not an actual stall but a UX gap: no events are emitted during long-running Bash command execution, making the UI appear frozen.
Investigation Findings
What looked like a stall
Session
ses_1appeared frozen in Gigacode. The last visible API event was apermission.resolvedforcargo test --test sessions(evt_1247). No new events appeared for ~2.5 minutes.What was actually happening
cargo test --test sessions(5-minute timeout)permission.resolved, 0.4ms after request)The session was never stalled. The Bash command was executing, but sandbox-agent emits no intermediate events during Bash execution — so the UI had no way to show progress.
Transcript vs API event divergence
Comparing the
session-ses_1.mdtranscript (generated from Claude Code's stream-json) with the sandbox-agent events API revealed:The ordering "mismatch" is because the API flattens subagent tool calls into the main event stream (each Read/Grep/Bash inside a Task appears as its own event with
parent_tool_use_id), while the transcript collapses Task subagent activity into a single entry with a summary result.This is not a bug — they're different views of the same activity. But it can be confusing when debugging.
Root Cause
No events emitted during Bash execution. When Claude Code runs a long command (e.g.,
cargo testwith a 5-minute timeout), the sandbox-agent event stream goes silent until the command completes. There is no heartbeat, progress indicator, or "command still running" status event.Suggested Improvements
item.deltawith a status content part like "Running: cargo test --test sessions (elapsed: 30s)")Environment