anthropics / anthropics/claude-code

Passing --add-dir suppresses the initial positional prompt; the session opens and never starts a turn

Đang mở
#92,930 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
area:cli area:tui bug has repro platform:linux
Ngôn ngữ chính
Python
Star
145k
Fork
23.1k
Chỉ số merge pull request
Chỉ số pull request đang chờ

Mô tả

Passing `--add-dir` stops a session from submitting its initial positional prompt. The session opens, the prompt sits in the composer, and no turn starts. Removing `--add-dir` and changing nothing else makes the same prompt submit immediately.

This breaks any wrapper that starts a session on a prompt and grants a directory in the same command: the session looks healthy and never does any work.

## Environment

- Claude Code 2.1.259 and 2.1.263, both affected
- Installed as an npm global package
- Linux x86_64, Node 20.19.2

## Steps

With a prompt file at `/prompt.md` holding one line, and the working directory somewhere other than ``:

| # | Command | Result |
|---|---|---|
| 1 | `claude @/prompt.md` | Submits, answers |
| 2 | `claude "reply with the single word ready, then stop"` | Submits, answers |
| 3 | `claude --add-dir @/prompt.md` | Opens, no turn starts |
| 4 | `claude --add-dir "reply with the single word ready, then stop"` | Opens, no turn starts |
| 5 | `claude --bg @/prompt.md` | Starts working |

1 and 3 differ only by `--add-dir`. 2 and 4 differ only by `--add-dir`. The prompt form does not matter: a text argument and an `@` reference behave the same way in each pair.

## Expected

3 and 4 submit their prompt and start a turn, as 1 and 2 do.

## Actual

The session opens and waits indefinitely. Submitting the prompt by hand works normally, so the session itself is healthy.

## Notes

- Not version-specific across the range tested: 2.1.259 and 2.1.263 behave identically, with background auto-updates disabled to hold the version steady.
- An `@` reference outside the working directory is read without `--add-dir`, so the grant is not what makes the prompt reachable in case 1.
- The failure is silent. The process starts, the interface renders, and nothing distinguishes it from a slow first turn, so a calling process sees a healthy child that never works.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

Reproduce the two failing commands with --add-dir and compare them with the equivalent commands without it and with --bg. Trace the CLI startup handling for --add-dir alongside the initial positional prompt, then add a regression check if the project’s existing CLI tests cover these commands. Done means both prompt forms submit and begin a turn while the existing cases continue to work.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
node.js
Lĩnh vực
cli
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Sôi nổi
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
58/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.