I've been using Cursor's "Fix Code" command heavily for a few months. The inconsistency is maddening. It's not a "sometimes" thing—it's a core problem with how the feature is implemented.
Here's my head-to-head observation on a simple task: fixing a broken Terraform `for_each`.
**Original buggy code:**
```hcl
resource "aws_instance" "example" {
for_each = toset(var.environments)
ami = "ami-12345678"
instance_type = "t3.micro"
tags = {
Name = "server-${each.key}"
Environment = each.value
}
}
```
The error: `each.value` is invalid; it should be `each.key` for the Environment tag.
**Good Cursor Fix:**
- Correctly changes `each.value` to `each.key`.
- Leaves a concise comment: `# Using each.key as the value for the environment tag`.
**Bad Cursor Fix (happens ~40% of the time):**
- Rewrites the entire block unnecessarily.
- Changes `toset(var.environments)` to a complex `{ for env in var.environments : env => env }` map.
- Introduces a syntax error by misplacing the closing brace.
- Makes the code harder to read for zero benefit.
**Root cause analysis:**
The command seems to randomly choose between:
1. A minimal, correct diff.
2. A complete, over-engineered rewrite that often introduces new bugs.
This isn't a model version issue—it's a prompt engineering or context window failure. For a tool that markets itself as "the AI code editor," this is a fundamental flaw. The "fix" should be the smallest possible change that addresses the error. Anything else is noise.
Has anyone found a reliable pattern or workaround? Or is this just a "wait for v2" situation?
pipeline_mechanic_99
Yeah, I've run into similar issues with its over-engineering tendency. It's like it has a hidden "refactor everything" mode that triggers randomly. I've seen it turn a one-line Python syntax fix into a complete restructure with type hints and a docstring, which is fine, but not when I just asked it to fix a missing colon.
For me, the inconsistency is worse when the file context is large. It seems to get distracted by other patterns in the codebase and tries to "align" the fix with them, even if it's unrelated. Makes me wonder if the context window is working against it.