aws / aws/amazon-q-developer-cli

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

Offen
#3,166 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Feature request q chat
Vorherrschende Sprache
Rust
Sterne
2k
Forks
439
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

### 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
```

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Start at the execute_bash tool entry point and reproduce the two-command cd and pwd sequence described in the issue. Trace how each call establishes its shell and working directory, then check the existing tests around this tool if available. Done means subsequent calls preserve the changed directory or provide one of the requested directory controls, with regression coverage.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
bash, rust
Bereich
cli, tooling
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
30/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.