aws / aws/amazon-q-developer-cli

bug: use_subagent returns EmptyResponse in --no-interactive mode

Open
#3,835 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
2k
Forks
439
PR merge metrics
No merged PRs in 30d

Description

### Checks

- [x] I have searched [github.com/aws/amazon-q-developer-cli/issues](https://github.com/aws/amazon-q-developer-cli/issues?q=) and there are no duplicates of my issue
- [x] I have run `q doctor` in the affected terminal session
- [x] I have run `q restart` and replicated the issue again

### Operating system

- kiro-cli 2.6.0 - Linux (WSL2 Ubuntu 24.04, glibc 2.39)

### Expected behaviour

Orchestrating Agent call subagent successfully

### Actual behaviour

While building an agent evaluation system (parent agent orchestrating specialized sub-agents), we discovered that sub-agent responses are lost when running in `--no-interactive` mode. The sub-agent executes fully (reads files, writes results), but its final text response is never returned to the parent agent.

### Steps to reproduce

## Reproduce
```bash
kiro-cli chat --agent repro-parent --no-interactive "call the child agent to process /tmp/repro_input.txt"
```

## Expected
Parent receives child's text response (analysis + confirmation)

## Actual
Parent reports EmptyResponse. But `/tmp/repro_output/result.json` IS written correctly by the child.

See `repro_output.log` for full output.

## Key Findings

| Mode | Child Response Type | Result |
|------|-------------------|--------|
| `--no-interactive` | Multi-line text after fs_write | ❌ EmptyResponse (100%) |
| `--no-interactive` | Single short line after fs_write | ✅ Works (0% failure) |
| Interactive (tty) | Multi-line text after fs_write | ✅ Works (0% failure) |
| `--no-interactive` | Multi-line text without fs_write | ✅ Works (0% failure) |

The bug requires ALL of:
1. `--no-interactive` mode (no tty)
2. Sub-agent uses `fs_write` tool
3. Sub-agent responds with multi-line text after writing

## Workaround
Change child prompt ending from:
```
IMPORTANT: You MUST write the result file AND respond with a natural language confirmation. Do not respond with only JSON.
```
To:
```
IMPORTANT: After writing the result file, respond with ONLY this exact text: 'DONE:case-001:PASS'. Nothing else.
```
See `repro_output_short_reply.log` for successful output with workaround.

## Files
- `repro-parent.json` — minimal parent agent (only use_subagent tool)
- `repro-child.json` — child agent that triggers bug (fs_read + fs_write + multi-line response)
- `repro_output.log` — output showing EmptyResponse (bug)
- `repro_output_short_reply.log` — output showing success (workaround)

### Environment

```yaml

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.