aws / aws/amazon-q-developer-cli

bug: execute_bash tool doesn't maintain working directory state between calls

Open
#3,166 1 comment 0 reactions 0 assignees View on GitHub
Feature request q chat
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

wsl - ubuntu 24

### Expected behaviour

When using execute_bash tool, cd commands should persist the working directory for subsequent bash commands, allowing normal directory navigation workflow.

The execute_bash tool starts each command in a fresh shell session, causing cd commands to not persist between calls. This leads to:

- Constant confusion about current working directory
- Need to use full absolute paths for all file operations
- Frequent errors when working across multiple repositories
- Assistant reading files from wrong directories

Expected Behavior:
Either:
1. Maintain working directory state between bash calls, OR
2. Add a working_directory parameter to execute_bash, OR
3. Provide a separate set_working_directory function

Current Workaround:
Must use full absolute paths like:
/path/to/file1

This significantly impacts productivity when working with multiple repositories/dirs.

Labels/Category:
enhancement, tools, mcp

### Actual behaviour

Each execute_bash call starts in a fresh shell session, so cd commands don't carry over to the next command. The working directory resets every time.

### Steps to reproduce

1. Use execute_bash to run: cd /some/directory && pwd
2. Use execute_bash to run: pwd
3. Observe that step 2 shows the original directory, not /some/directory
4. This forces using full absolute paths for all file operations

This significantly impacts productivity when working across multiple repositories, causing frequent errors where the assistant reads files from wrong directories due to working directory confusion.

### Environment

```yaml
[q-details]
version = "1.17.1"
hash = "52301a3b0f81abff5ecde04a02481734c5c7ecc4"
date = "2025-09-30T22:29:46.266086Z (13d ago)"
variant = "full"

[system-info]
chip = "11th Gen Intel(R) Core(TM) i5-1145G7 @ 2.60GHz"
total-cores = 4
memory = "39.17 GB"

[system-info.os.linux]
kernel_version = "6.6.87.2-microsoft-standard-WSL2"
id = "ubuntu"
name = "Ubuntu"
pretty_name = "Ubuntu 24.04 LTS"
version_id = "24.04"
version = "24.04 LTS (Noble Numbat)"

[environment]
cwd = "/home/USER"
cli-path = "/home/USER"
os = "Linux"
shell-path = "/usr/bin/bash"
shell-version = "5.2.21"
install-method = "unknown"
in-wsl = true
```

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.