aws / aws/amazon-q-developer-cli
Q CLI shell detection incorrectly identifies own binary as shell in Ghostty terminal
- 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
macOS 15.7.1 (24G231)
### Expected behaviour
Q CLI doctor should detect the actual shell (/bin/zsh) and pass compatibility checks
### Actual behaviour
Q CLI doctor reports shell path as /Users/USER/.toolbox/tools/q/1.17.1/Amazon Q.app/Contents/MacOS/qchat (its own binary) causing compatibility check failure
```
That's an interesting shell compatibility issue specific to Ghostty terminal. Let me investigate what's causing this difference and help you resolve it.
[Tool uses: execute_bash]
[Tool uses: execute_bash]
Interesting! I can reproduce the issue now. The problem is that Q CLI is detecting the shell path incorrectly. Let me check what's happening with the shell detection:
[Tool uses: execute_bash]
The issue is clear now. Q CLI is incorrectly detecting the shell path as the Q CLI binary itself (`/Users/xxxxxxx/tools/q/1.17.1/Amazon Q.app/Contents/MacOS/qchat`) instead of the actual shell (`/bin/zsh`).
Let me try the suggested fix:
[Tool uses: execute_bash]
[Tool uses: execute_bash]
[Tool uses: execute_bash]
Now let me run the doctor again to see if this helped:
[Tool uses: execute_bash]
The issue persists. Let me check what Q CLI thinks the shell should be:
[Tool uses: execute_bash]
The problem is clear now. Q CLI's shell detection is incorrectly identifying its own binary as the shell. This appears to be a bug in how Q CLI detects the parent shell process, particularly in certain terminal environments like Ghostty.
## Shell Compatibility Issue Analysis
**Problem**: Q CLI is misidentifying its own binary path as the shell instead of detecting the actual shell (`/bin/zsh`).
**Root Cause**: The shell detection logic in Q CLI is incorrectly parsing the process tree or environment, causing it to report its own executable path instead of the parent shell.
**Why it varies by terminal**:
- Different terminals may set different environment variables or process hierarchies
- Ghostty might have a different process spawning pattern than macOS Terminal or Tabby
**Immediate Solutions**:
1. **Report the bug** (recommended):
\```bash
q issue
\```
2. **Workaround**: The telemetry and core functionality still work despite this diagnostic error. The shell compatibility check is primarily for shell integration features.
3. **Temporary fix**: You can continue using Q CLI normally - this appears to be a diagnostic false positive rather than a functional issue.
**Impact**: This is likely a cosmetic diagnostic issue that doesn't affect:
- Telemetry functionality (confirmed working)
- Core Q CLI commands
- AWS connectivity
- Chat functionality
The shell compatibility error seems to be a detection bug rather than an actual compatibility problem, since Q CLI is working fine in your environment.
[Tool uses: none]
(...truncated)
```
### Steps to reproduce
1. Use Ghostty terminal on macOS
2. Run `q doctor`
3. Observe shell compatibility error
4. Run `q _ get-shell` to confirm incorrect detection
Note: Issue does not occur in macOS Terminal or Tabby terminal
### Environment
```yaml
[q-details]
version = "1.17.1"
hash = "b0ef39f91625c36c2ed6f065628e7165fae9012c"
date = "2025-09-30T22:01:25.726592Z (7d ago)"
[system-info]
os = "macOS 15.7.1 (24G231)"
chip = "Apple M2 Pro"
total-cores = 10
memory = "16.00 GB"
[environment]
cwd = "/Users/USER"
cli-path = "/Users/USER"
install-method = "unknown"
[env-vars]
PATH = "/Users/USER/.local/bin:/Users/USER/.toolbox/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Users/USER/.local/bin:/Users/USER/Library/Application Support/JetBrains/Toolbox/scripts:/Applications/Visual Studio Code.app/Contents/Resources/app/bin"
QTERM_SESSION_ID = "8837066f718d4b4aac422ea29967264b"
Q_SET_PARENT_CHECK = "1"
Q_TERM = "1.17.1"
SHELL = "/bin/zsh"
TERM = "xterm-256color"
__CFBundleIdentifier = "org.tabby"
[chat-settings]
[chat-trusted_tools]
use_aws=trusted
execute_bash=trusted
[chat-failed_request_ids]
none
[chat-context]
current_profile=default
profile_context=none
files=none
```
Contributor guide
Assessment
This issue has not been assessed yet.