aws / aws/amazon-q-developer-cli
Shell integration adds ~1.3s to zsh startup (kiro-cli init subprocess called twice on every shell open)
- Lingua principale
- Rust
- Stelle
- 2k
- Fork
- 439
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
### 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
macOS 26.4.1 (25E253)
### Expected behaviour
Shell integration should add <50ms. Suggested fixes:
- Pre-generate init output to a static file and source it (no subprocess per shell)
- Gate expensive logic with env vars to no-op in nested/already-initialized shells
- Make kiro-cli-term PTY wrapping async or lazy
### Actual behaviour
The kiro-cli shell integration blocks shell startup by approximately 1.3 seconds, compared to a baseline of ~13ms without any rc files loaded:
# With kiro shell integration active:
zsh -i -c exit → 1.379s total
# Baseline (no rc files):
zsh --no-rcs -i -c exit → 0.013s total
That is a ~106x slowdown attributable to the kiro integration.
Root cause (observed)
zshrc.pre.zsh calls:
eval "$(~/.local/bin/kiro-cli init zsh pre --rcfile zshrc)"
zshrc.post.zsh calls:
eval "$(~/.local/bin/kiro-cli init zsh post --rcfile zshrc)"
Both run kiro-cli as a subprocess on every shell start, paying process spawn + execution cost twice. The init zsh post output alone is 37KB of shell code being eval'd synchronously. This includes PTY detection, session management, and figterm launch logic — all blocking the prompt.
### Steps to reproduce
1. Install kiro-cli 2.0.1 and let it inject its hooks into .zshrc
2. Add zmodload zsh/zprof at top of .zshrc and zprof at the bottom
3. Open a new terminal and observe the profiling output — kiro-cli init appears near the top
### Environment
```yaml
- kiro-cli: 2.0.1
- kiro (IDE): 0.11.131
- Shell: zsh on macOS Darwin 25.4.0
[system-info]
os = "macOS 26.4.1 (25E253)"
chip = "Apple M3 Pro"
total-cores = 11
memory = "18.00 GB"
[environment]
cwd = "/Users/USER"
cli-path = "/Users/USER"
os = "Mac"
shell-path = "/bin/zsh"
shell-version = "5.9"
terminal = "macOS"
install-method = "unknown"
```
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia con gli hook zshrc.pre.zsh e zshrc.post.zsh che invocano `kiro-cli init zsh pre/post`, quindi riproduci il problema con `zmodload zsh/zprof` e `zprof`. Traccia il motivo per cui entrambi i sottoprocessi vengono eseguiti durante l’avvio della shell e misura il risultato; il lavoro è completato quando l’integrazione della shell aggiunge meno di 50 ms senza modificare il comportamento di integrazione richiesto.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- zsh
- Ambito
- cli, performance
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Tranquilla
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 55/100