What version of Kimi Code is running?
0.29.2, reproduced from main at d88b3775c9816c15ae82dea8b34794b1e729b5d0.
Which open platform/subscription were you using?
Not applicable. This reproduces before model invocation with a fresh KIMI_CODE_HOME.
Which model were you using?
Not applicable.
What platform is your computer?
Linux 6.17.0-20-generic x86_64 x86_64, xterm-compatible PTY, 120 x 40 cells.
What issue are you seeing?
Pasting a shell command beginning with ! into an empty prompt enters bash mode only when the paste is at most 1,000 characters and at most 10 lines. A paste above either threshold is submitted as a normal model prompt instead of a shell command.
The boundary is deterministic:
| Pasted input |
Actual route |
1,000 characters beginning with ! |
bash |
1,001 characters beginning with ! |
prompt |
10 lines beginning with ! |
bash |
11 lines beginning with ! |
prompt |
In a fresh, logged-out test profile, the route is observable without executing either payload: the control reaches the shell path and reports Bash tool is not available, while the two large-paste cases reach the model path and report LLM not set, send "/login" to login.
What steps can reproduce the bug?
- Start Kimi Code in an interactive terminal with an empty prompt.
- As one paste operation, paste a valid shell command whose first character is
! and whose total length is 1,001 characters. A harmless example is !printf ok # followed by enough x characters to reach 1,001 characters.
- Press Enter.
- Observe that the input is handled as a normal prompt rather than a shell command.
- Repeat with exactly 1,000 characters as a control; it enters bash mode.
The same issue can be reproduced with an 11-line paste beginning with !; a 10-line paste is the control.
I reproduced the full route matrix twice through a real PTY. I also passed the bracketed-paste sequence through three stdin chunk patterns (one complete chunk, markers/content split across chunks, and fixed 37-character chunks); all retained the full expanded input and produced the same routing result.
What is the expected behavior?
When the expanded content pasted into an empty prompt begins with !, Kimi Code should enter bash mode regardless of whether the editor folds the paste for display. The leading ! should be removed from the expanded command exactly as it is for a short paste.
Additional information
The editor intentionally folds pastes over 10 lines or 1,000 characters into a [paste #...] marker (source). The custom editor checks this.getText().startsWith('!') only after that folding has happened (source), so it sees the marker rather than the expanded content.
Controls checked:
- Typing
! first and then pasting a large command remains in bash mode.
- A large ordinary prompt remains in prompt mode and its expanded content is preserved.
- Existing Kimi CLI editor/shell tests and the complete pi-tui test suite pass; the current tests cover short
! pastes but not the folding boundary.
What version of Kimi Code is running?
0.29.2, reproduced from
mainatd88b3775c9816c15ae82dea8b34794b1e729b5d0.Which open platform/subscription were you using?
Not applicable. This reproduces before model invocation with a fresh
KIMI_CODE_HOME.Which model were you using?
Not applicable.
What platform is your computer?
Linux 6.17.0-20-generic x86_64 x86_64, xterm-compatible PTY, 120 x 40 cells.What issue are you seeing?
Pasting a shell command beginning with
!into an empty prompt enters bash mode only when the paste is at most 1,000 characters and at most 10 lines. A paste above either threshold is submitted as a normal model prompt instead of a shell command.The boundary is deterministic:
!!!!In a fresh, logged-out test profile, the route is observable without executing either payload: the control reaches the shell path and reports
Bash tool is not available, while the two large-paste cases reach the model path and reportLLM not set, send "/login" to login.What steps can reproduce the bug?
!and whose total length is 1,001 characters. A harmless example is!printf ok #followed by enoughxcharacters to reach 1,001 characters.The same issue can be reproduced with an 11-line paste beginning with
!; a 10-line paste is the control.I reproduced the full route matrix twice through a real PTY. I also passed the bracketed-paste sequence through three stdin chunk patterns (one complete chunk, markers/content split across chunks, and fixed 37-character chunks); all retained the full expanded input and produced the same routing result.
What is the expected behavior?
When the expanded content pasted into an empty prompt begins with
!, Kimi Code should enter bash mode regardless of whether the editor folds the paste for display. The leading!should be removed from the expanded command exactly as it is for a short paste.Additional information
The editor intentionally folds pastes over 10 lines or 1,000 characters into a
[paste #...]marker (source). The custom editor checksthis.getText().startsWith('!')only after that folding has happened (source), so it sees the marker rather than the expanded content.Controls checked:
!first and then pasting a large command remains in bash mode.!pastes but not the folding boundary.