aws / aws/amazon-q-developer-cli

For certain existing files, Q chat erases most of the file unintentionally (uses 'create' instead of 'str_replace')

Open
#1,008 1 comment 0 reactions 0 assignees View on GitHub
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.3.2 (24D81)

### Expected behaviour

While making targeted code changes, Q should only edit required lines.

### Actual behaviour

While making targeted code changes, Q currently unintentionally removes lines that are required. For example, in a 300 line file, it wanted to added 2 lines near line 30. However, the diff removed all lines after that line.

On prompting, Q corrected itself.

```
> no this is a bad change, you are removing lines that are need

I apologize for the error. You're right - using the create command would replace the entire file, which is not what we want. Let's make
a more targeted change using str_replace instead.
```

### Steps to reproduce

_No response_

### Environment

```yaml

```

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.