Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: flag-tasks
name: find-flawed-tasks
description: Find the flawed and ambiguous tasks of a benchmark from finished Nullius runs and propose them as pending task flags for a person to accept. Use it when the user asks which tasks of a benchmark are broken, unfair, flawed or ambiguous, why no agent passes some tasks, whether the expected answers can be trusted, or wants task flags proposed for the filtered score.
---

Expand All @@ -23,7 +23,7 @@ Two rules hold throughout:
- **A flag never carries the expected outcome.** Its evidence is one short sentence that points to the problem.

Below, `REPO` is the absolute path of the checkout this skill is in, `S` is
`REPO/.agents/skills/flag-tasks/scripts/flags.py` and `WORK` is a new folder outside the checkout and the runs, agreed
`REPO/.agents/skills/find-flawed-tasks/scripts/flags.py` and `WORK` is a new folder outside the checkout and the runs, agreed
with the user. Run `S` with the Python that runs Nullius.

## 1. Agree on the runs
Expand Down Expand Up @@ -105,7 +105,7 @@ readers gave it. The others are:
- `unread`: fewer than two readers voted on it.

Read `WORK/report.md`. Open each flagged case and its quotes yourself, and check that no line of evidence in
`WORK/flag-tasks.json` gives an expected outcome away.
`WORK/find-flawed-tasks.json` gives an expected outcome away.

## 6. Hand over

Expand All @@ -115,7 +115,7 @@ write to a run. Then, for each job, look at what it holds and import:

```bash
PYTHONPATH=REPO/app python3 -m nullius flags list <root> <job id>
PYTHONPATH=REPO/app python3 -m nullius flags import <root> <job id> --from WORK/flag-tasks.json --by flag-tasks
PYTHONPATH=REPO/app python3 -m nullius flags import <root> <job id> --from WORK/find-flawed-tasks.json --by find-flawed-tasks
```

The flags arrive **pending**, filled in on the trial page's User judge tab, and change no score until a person accepts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ def merge(args):
lines += [f" - {flat(q['file'])}: \"{flat(q['text'])}\"" for q in v["quotes"]]
if notes:
lines += ["", "## Not counted", ""] + [f"- {n}" for n in notes]
write(args.out, "flag-tasks.json", {"flags": flags})
write(args.out, "find-flawed-tasks.json", {"flags": flags})
write(args.out, "third.json", for_readers(third))
write(args.out, "report.md", "\n".join(lines) + "\n")
print(summary + (f"; {len(notes)} votes or flags not counted, see report.md" if notes else ""))
Expand Down
145 changes: 145 additions & 0 deletions .agents/skills/fix-flawed-tasks/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
---
name: fix-flawed-tasks
description: Repair the flawed and ambiguous tasks of a benchmark into a new, versioned copy of the dataset, then measure the effect with a fixed-versus-original rerun. Use it after /find-flawed-tasks, when the user wants accepted task flags turned into fixes, a corrected benchmark version, or to know how much of an agent's score was lost to broken tasks.
---

# Fix tasks

Accepted task flags come in; a **fixed copy** of the dataset goes out, with every change justified by the benchmark's
own material and agreed by two independent readers. Then a rerun compares the fixed copy with the original, side by
side, with the same agent and grader. The original dataset is never touched.

Rules that hold throughout:

- **Documents decide.** A fix makes the task match what the benchmark's material requires. A point the material does
not settle gets no fix: report it as `no-fix` instead of inventing a rule.
- **Blind to results.** A fixer and a reviewer see the task and the material, never runs, scores or conversations. If a
round is chosen from an agent's failures, label it `evidence-informed` and report it on its own line.
- **Two readers agree.** A fix is applied only when a second, independent reader agrees; changes the reviewer asks for
go back to the first reader. Unsure stays unchanged.
- **The answers stay here.** Nothing this skill reads or writes reaches an agent that is scored on the same benchmark.
- **The fixed copy is an experiment.** It never replaces the benchmark's official dataset.
- **Frozen before any run.** Fixes, labels and checks are hashed before anything is measured; afterwards a fix is only
reverted by the rule in step 8, and both numbers are reported.
- **Code benchmarks are experimental.** A blind test on SWE-bench did not meet its marks. There the step 5 run check is
required, read per test.

Below, `REPO` is the absolute path of the checkout this skill is in, `S` is
`REPO/.agents/skills/fix-flawed-tasks/scripts/fix.py` and `WORK` a new folder outside the checkout and the runs, agreed with
the user. Run `S` with the Python that runs Nullius.

## 1. Agree on the input

The input is the **accepted** flags only (the status column of `nullius flags list <root> <job id>`; leave pending
ones out) or a list of tasks the user names. Find the dataset the runs used and read `references/<benchmark>.md` if it
exists: it says where the task, the expected outcome, the grader and the material live. Optional: mix in a few
unflagged tasks and a few known-flawed ones, unlabelled, to count how often the fixer changes a sound task and how
often it misses a broken one.

You build `WORK/material/`: the benchmark's documents a fixer may quote, such as its rules, policies and the task
texts. Copy, do not link. Every quote names its file by a path relative to this folder, as in /find-flawed-tasks step 4. It
is a different path from the file an edit changes, which is relative to the task folder.

## 2. Fix (first reader)

Give each task to a fixer: the strongest model you have, a separate subagent with its own folder. It gets this file,
`references/patch.md`, the task folder, `WORK/material/` and the brief below, and writes `WORK/proposals/<task>.json`
in the format of `references/patch.md`. A `sound` verdict gets no patch; list the task by name in the report.

1. From the material alone, decide `sound`, `flawed` (the expected outcome is wrong or cannot be reached) or
`ambiguous` (the material supports more than one outcome, or the outcome depends on something the task leaves open).
2. If not sound, propose the smallest change, preferring the most local one: the expected outcome; a missing fact in
the instructions of another party (a simulated user); stored data the task uses; accepting several outcomes (only
when each one is supported by the material and the grader can accept several); or `no-fix`.
3. Quote the sentence that justifies the change, copied exactly, with its file.
4. A fix makes the task correct, not easier. A new line for a simulated party states a fact, never what the agent
should do; it avoids words that name a tool option or argument; and the expected outcome must stay right if that
party never says the line.
5. Label it: `strict` (outcome or data corrected), `clarifying` (missing fact stated), `lenient` (several outcomes
accepted), `easier` (the fix also removes a hurdle or changes what is tested), `no-fix`.

## 3. Review (second reader)

A different strong model, same material, never the fixer's reasoning first: it forms its own verdict, then reads the
proposal and answers `agree`, `partly` (with the exact change) or `disagree`. Write `WORK/reviews/<task>.md`.
`partly` goes back to the fixer, who accepts or rejects each point in `decisions`; the revised patch goes back to the
reviewer once. If the answer is still `partly`, treat it as `disagree`. Only a patch the reviewer finally agrees with
gets `"review": "agree"` and goes to `WORK/patches/`. On `disagree` there is no patch, the task stays unchanged and it
is reported by name. A `no-fix` the reviewer disputes is reported the same way. `apply` refuses a patch without an
agreed review, a quote under 15 characters, and with `--material WORK/material` a quote that is not in the file it
names.

## 4. Apply

```bash
python3 S apply <dataset folder> WORK/fixed --patches WORK/patches --material WORK/material
```

The dataset is copied to `WORK/fixed`, then every edit is applied. An edit names a file inside the task folder and an
`old` text that must occur exactly once; if any edit fails, nothing is written. `WORK/fixed/APPLIED.json` lists every
task, its label, its round and its edits. A task can be fixed in several rounds, each in a new copy: every round is
kept, with the number of the copy it was applied in.

## 5. Check

Run the benchmark's own runner on `WORK/fixed` twice: once with its reference-solution agent and once with a
do-nothing agent (for Harbor, the agents `oracle` and `nop`). `references/<benchmark>.md` gives the command. Prepare
the commands; the user launches them.

- `oracle` must pass every task.
- `nop` must pass none, except tasks whose correct outcome is to change nothing (for example a request the rules
refuse). These are the nop exceptions: list them by name.
- A fixed task is `SAFE` if it passes `oracle` and fails `nop` (or is a nop exception), else `UNSAFE`. Where there is
no reference solution, the task is unchecked.

Write the results into the copy as `WORK/fixed/CHECKS.json`, before freezing, so the manifest covers them:

```json
{"results": {"<task>": "SAFE"}, "nop_exceptions": ["<task>"], "unchecked": ["<task>"]}
```

All three keys are required; the lists may be empty. A task is either in `results` or in `unchecked`, not both.
`freeze` needs a result or an unchecked entry for every fixed task, and refuses a copy with an `UNSAFE` task: that
fix is blocked. It goes back to step 2, and the next `apply` writes to a new folder (`WORK/fixed2`): a copy is never
edited in place.

This check is required for every benchmark. Passing it is necessary, not sufficient: it cannot show that a fix is
right, that a flaw was missed, or that a change to text the control agents never read (a task description, a customer
script) is needed. For code benchmarks it is the only check that runs an edited test: read the result per test, not
per task, confirm from the test log that the edited test ran, and that it fails on the unchanged code.

## 6. Freeze

```bash
python3 S freeze WORK/fixed
```

Writes `WORK/fixed/MANIFEST.json`: a hash per file, one hash for the whole copy, every round of each task (label,
round, copy) and the checks. Quote the hash in every report and run recipe. Refuses to overwrite an existing manifest:
a new round is a new copy (`apply` from the frozen copy keeps the earlier records and needs new checks). Before any run
and after it, check nothing moved:

```bash
python3 S verify WORK/fixed
```

## 7. Measure

One run, two arms, same window: the agent on the fixed copy and the same agent on the original dataset, same agent
build and settings, same grader in both, the same number of tries per task. A try is one attempt of an agent at a
task; pass^k is the share of tasks where k tries all pass. Prepare the recipe; the user launches it.
Re-run attempts that failed for infrastructure reasons in both arms alike and report the counts.

## 8. Report

- The primary number, fixed in advance: the paired difference of pass^1 over all tasks, with its standard error over
per-task differences. Also pass^k.
- Split by label, so that lenient and easier fixes do not inflate the headline: `strict` + `clarifying` is the
headline split; unchanged tasks are the control and should show no difference.
- Any task that moves by half its tries or more, in either direction, gets a cause check. A fix is reverted only if
its own change caused a drop. A revert is a new patch, applied from the frozen copy into a new folder, checked
(step 5) and frozen again; the as-run number is always reported beside the new one.
- How often each new line for a simulated party was actually said.

Hand over: the manifest hash, the counts per label, by name the sound, no-fix, disagreed and disputed tasks, the nop
exceptions and the unchecked tasks, the models used, and that the fixed copy is an experiment.
26 changes: 26 additions & 0 deletions .agents/skills/fix-flawed-tasks/references/patch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Patch format

One file per task in `WORK/patches/`, named anything ending in `.json`:

```json
{"task": "<task folder name in the dataset>",
"label": "strict | clarifying | lenient | easier | no-fix",
"round": "blind | evidence-informed",
"review": "agree",
"quotes": [{"file": "<material file>", "text": "a sentence copied exactly"}],
"decisions": ["one line per reviewer point: accepted or rejected, and why"],
"edits": [{"file": "<path inside the task folder>", "old": "exact text, once", "new": "replacement"}]}
```

- `review` is set to `agree` only after the second reader agreed; `apply` refuses anything else.
- `task` is the task's folder name, one level, no path.
- `round` is optional; the default is `blind`.
- `quotes` are required for every label except `no-fix`. Each `text` is at least 15 characters (the same minimum as
/find-flawed-tasks). It is matched with whitespace ignored, so line breaks may differ. `quotes[].file` is relative to
`WORK/material/`; `edits[].file` is relative to the task folder.
- A fix needs at least one edit; a `no-fix` patch has none and records that the material does not settle the task.
- Every edit has `file`, `old` and `new`. `new` is always text. `old` is required: text that occurs exactly once in
the file, or `null` to create a file that does not exist yet.
- Edits are plain text, so they work for any task format. When one fact lives in several files of a task (for example
a copy of the task for the grader and one for another service), edit every copy; `references/<benchmark>.md` says
where they are.
31 changes: 31 additions & 0 deletions .agents/skills/fix-flawed-tasks/references/tau3-banking.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Fixing τ³-bench banking (banking_knowledge) tasks

- **How the dataset is built.** Each task folder is a copy made by the Harbor adapter from tau2-bench. The task is
copied into `tests/config.json`, `environment/runtime-server/task_config.json` and `solution/`; the stored data
(`db.json`) is not copied, it comes from the image.
- **The task is stored three times** in each task folder: `tests/config.json` (`task`, used by the grader),
`environment/runtime-server/task_config.json` (`task`, used by the simulated customer and the tools) and
`solution/solve.sh` (the actions the `oracle` agent replays). A fix to the expected actions or the customer's
instructions edits all three; `expected_actions` and `reward_basis` in both JSON files follow
`task.evaluation_criteria`.
- **The customer's script** is `task.user_scenario.instructions`. A new line states a fact the customer knows; the
simulated customer may still not say it.
- **Stored data** (`db.json`) is inside the image, built from tau2-bench. A data fix adds the corrected file to
`environment/` and `environment/runtime-server/` and a `COPY` line to both Dockerfiles, replacing
`/opt/tau2-bench/data/tau2/domains/banking_knowledge/db.json`. Other tasks that use the same records must be
checked and listed.
- **Grading:** with `DB` in `reward_basis` the expected actions are replayed and the final databases compared, so an
argument the tool stores (amounts, names, free text) must match exactly. With `ACTION`, each expected action only has
to appear once; order, count and success are not checked. `COMMUNICATE` checks that given texts were said to the
customer. `NL_ASSERTION` is graded by an LLM judge in `tests/evaluate.py`; its model comes from
`TAU2_NL_ASSERTIONS_MODEL`, so keep that the same in both arms.
- **Several accepted outcomes** (`lenient`): the grader above accepts one set of expected actions. A lenient fix is
expressed as alternative accepted actions, for example a second action list that is also a pass. It needs a grader
that supports it: a change to `tests/evaluate.py` in every task that uses it, written as an edit like any other and
checked in step 5. Without such a grader, a point with several right outcomes is `no-fix`.
- **Run check (step 5)** with Harbor, on the fixed copy:

```bash
harbor run -p WORK/fixed -a oracle
harbor run -p WORK/fixed -a nop
```
Loading