aws / aws/amazon-q-developer-cli

kiro-cli acp fails with 'Bad file descriptor (os error 9)' in minimal variant on headless environments

Open
#3,800 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

## Bug Description

`kiro-cli acp` subcommand fails immediately with `error: Bad file descriptor (os error 9)` in the `minimal` variant when run in headless/non-TTY environments (code-server, kubectl exec).

## Root Cause

The `acp` subcommand incorrectly delegates to the bun/tui.js chat binary (`q_cli::cli:587: launching q chat binary`) instead of handling the stdio-based ACP protocol directly. The parent process creates an internal IPC pipe (fd 9) and passes it to the child bun process, but the child cannot use it in non-TTY contexts.

## Environment

- kiro-cli 2.3.0, variant: `minimal`
- Ubuntu 24.04 (container), kernel 6.12.79
- code-server 4.117.0 (VS Code 1.117.0), Node.js v22.22.1
- EFS/NFS home directory
- ACP extension: whatnick.acp-client-whatnick 0.1.6

## Reproduction

1. Install kiro-cli minimal variant in a container/headless environment
2. Run `kiro-cli acp` (or have code-server ACP extension spawn it)
3. Observe: `error: Bad file descriptor (os error 9)`, exit code 1

## Debug Trace

```
DEBUG q_cli::cli: 582: launching q chat binary
error: Bad file descriptor (os error 9)
```

stdin fd 0 is `/dev/null` or a pipe (not a TTY). The spawned bun/tui.js child fails on the IPC fd.

## Expected Behavior

`kiro-cli acp` should start an ACP stdio server that accepts JSON-RPC messages on stdin/stdout without requiring a TTY or spawning the TUI binary.

## Actual Behavior

Crashes with `Bad file descriptor (os error 9)` and exits with code 1.

## Diagnostic

```
[q-details]
version = "2.3.0"
hash = "a44742ad7a3acc79eac7459c2986103a8ad2b756"
variant = "minimal"
```

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.