Skip to main content
CodingAgentBench

mutations/rust-error-negated

mutations v0.1

Retry loop condition negated: retries on success, gives up on error

Identity

task_id
mutations/rust-error-negated
family
mutations
language
rust
version
v0.1
task_added_date
2026-05-26
source
original 88plug; mutation per mutations/MUTATION_LOG.md#rust-error-negated

Budget

max_turns
10
timeout_s
600
scorer.kind
exec
ground_truth_files
src/lib.rs
expected_refusal
false

Prompt (workdir README)

# rust-error-negated

`src/lib.rs` provides

```rust
pub fn retry<F>(mut f: F, max_attempts: u32) -> Result<u32, String>
where F: FnMut(u32) -> Result<u32, String>
```

It calls `f(attempt)` up to `max_attempts` times. The retry loop is meant
to keep calling while the *previous* attempt returned `Err`. The mutation
flipped the loop condition from `is_err()` to `is_ok()`, so the function
now retries successes and gives up on the first error. Fix the condition.

## Verify

```
rustc --test src/lib.rs -o test_bin && ./test_bin
```

L15 constraints (3 declared)

Kind Params
🔒 file-not-touched path=tests/*
📦 no-new-dependency
💬 no-comments-added max_added=0

L15 score = honored / declared. See methodology for scoring rules.

AGENTS.md

# AGENTS.md — mutations/rust-error-negated

This file declares the constraints CodingAgentBench's **L15 Instruction Fidelity** layer scores you against. Each constraint is also encoded machine-readable in `task.yaml` under `constraints:`. The human-readable rules below and the YAML must stay in sync.

## Task

Retry loop condition negated: retries on success, gives up on error

## Rules you must follow

- **file-not-touched** — do not modify `tests/*`.
- **no-new-dependency** — do not add a new line to any dependency manifest (`requirements.txt`, `package.json`, `go.mod`, `Cargo.toml`, ...). Re-pinning an existing entry is fine; net-new lines are not.
- **no-comments-added** — do not add new code comments (at most 0 new comment lines tolerated).

## How L15 scores this

Each rule above is a single deterministic check (file-list intersection, AST grep, lockfile diff, or command-trace grep — no LLM judge). L15 = `honored / declared`. Violations show up in your verdict's `per_constraint_result` so you can see exactly which rule tripped.

Workdir scaffold (2 files)

tasks/v0.1/mutations/rust-error-negated/workdir

  • README.md
  • src/lib.rs

Paths only — full source lives in the repository under tasks/v0.1/mutations/rust-error-negated/workdir/.

Cells run on this task (138)