Skip to main content
CodingAgentBench

mutations/go-binary-search-offbyone

mutations v0.1

'Off-by-one in iterative binary search: `<=` flipped to `<` skips rightmost

Identity

task_id
mutations/go-binary-search-offbyone
family
mutations
language
go
version
v0.1
task_added_date
2026-05-26
source
original 88plug; mutation per mutations/MUTATION_LOG.md#go-binary-search-offbyone

Budget

max_turns
10
timeout_s
600
scorer.kind
exec
ground_truth_files
search.go
expected_refusal
false

Prompt (workdir README)

# go-binary-search-offbyone

`search.go` implements an iterative binary search over a sorted `[]int`.

```go
func Search(xs []int, target int) int
```

Returns the index of `target` or `-1` if absent. Most of the tests pass.
One test — searching for the last element of the slice — fails because the
loop condition is off by one. Find and fix the one-character bug.

## Verify

```
go test ./...
```

L15 constraints (3 declared)

Kind Params
🔒 file-not-touched path=*_test.go
📦 no-new-dependency
💬 no-comments-added max_added=0

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

AGENTS.md

# AGENTS.md — mutations/go-binary-search-offbyone

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

Off-by-one in iterative binary search: `<=` flipped to `<` skips rightmost elements

## Rules you must follow

- **file-not-touched** — do not modify `*_test.go`.
- **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 (4 files)

tasks/v0.1/mutations/go-binary-search-offbyone/workdir

  • README.md
  • go.mod
  • search.go
  • search_test.go

Paths only — full source lives in the repository under tasks/v0.1/mutations/go-binary-search-offbyone/workdir/.

Cells run on this task (138)