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
49 changes: 49 additions & 0 deletions docs/coder-loop.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,16 @@ The causes were in the loop, not only in prompt wording:
comment on the pull request, and the ledger records who moved it in.
(`incidents::sl_scope_decided_once`)

What people say decides scope as they say it (`Ledger::take_people`).
When the ledger is seeded, and on each round's comments (the habits check
and the planned-work rounds), an out-of-scope entry that a person's answer
or comment asks for moves into scope and records who asked. No
`Scope change:` line is needed. From then on, a diff that takes that work
out is a breach that goes back to be put back. A comment that keeps the
item out moves nothing. One run replied "Understood" to a reviewer's answer
and then reverted the work the answer asked for
(`incidents::sn_person_answer_moves_scope`).

10. **The description describes the head.**
On every push the description is rebuilt from the head's facts
(`description::build`; Problem, Changes, Risk, Verification). The written
Expand All @@ -221,6 +231,45 @@ The causes were in the loop, not only in prompt wording:
that asks an open product question.
(`incidents::sm_description_of_the_head`)

11. **A bug is reproduced before it is planned.**
For a bug, the planner has `reproduce_on_base` (`passes::reproduce`). The
tool runs one call or command in the sandbox on the base branch's head, in
the run's test environment, and returns its exit code and output. Each run
is kept.

design.md has a `## Reproduce` section (`common::repro_first::reproduce_gaps`)
with these fields:
- `Inputs:` lists the ticket's ids and names, with every stored variant a
read-only lookup found, and says where they came from.
- `Ran on base:` is a command this run ran with the tool.
- `Output:` quotes what that command printed.
- `Wrong line:` names the `path:line` where the existing code goes wrong.

A run that tried and can't reproduce writes `Unverified:` with why. It is
kept as unverified, never skipped silently.

The fix goes in the mechanism the wrong line is in (`reuse_gaps`).
`## Smallest change` names it, or says why it can't hold the fix. A plan
that adds a new resolution path beside it (a keyword match, a new
resolver) goes back.

A question the plan decides with a default goes back unless it carries
`Looked up: <what it showed>` or `No lookup settles it: <why>`. This
applies when a page load or a query would answer it (`question_gaps`).

After the build:
- **Diff size.** A diff that changes more than 40 lines of code (map and
list entries aside) for a ticket that names 1 to 12 records goes back to
be narrowed (`minimal_change::whole_path`). A `Wider than the ticket:`
line keeps it, with the reason.
- **Fail on the base.** Each new test runs on the base and on the head the
way CI runs it. That includes a CI loop such as `for t in tests/test_*.py;
do python "$t"` (`TestEnv::file_command`, `habits_check::file_cmd`). A
bug fix that no test was shown to fail on the base for says `Unverified:`
in its description.

(`incidents::rp_reproduce_before_planning`)

## What is deterministic

Everything above except the model's own writing: the searches, section checks,
Expand Down
31 changes: 31 additions & 0 deletions docs/incidents/rp_reproduce_before_planning.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# rp. `rp_reproduce_before_planning`

**What happened:** A data-pipeline ticket named four camps that were filed under the wrong sport. The pipeline already had an overrides table for exactly this case, with entries for those camps. Its lookup matched exact names, though, and the vendor appends "-Half Day" or "-Full Day", so the entries never matched: the lookup returned nothing for each of the ticket's names on the base.

The run's notes said so, then planned a keyword step beside the table. The diff was +595/-186 across the pipeline: a moved extractor, keyword matching, new logging and a fixture. It also moved other programs to another lookup, which its own reviewer flagged as out of scope, and it asked two questions on the pull request that one page load answered.

The new test was never run on the base. The repository's CI runs each test file in a `python "$t"` loop, which CoderHelm couldn't narrow to one file, so the test was recorded as not run and the description said nothing about it. The right change stripped the suffix in the lookup and added two entries (+49/-1, mostly a test of the exact stored names), and that test fails on the base.

Across the 53 runs audited:
- 8 of the 10 bug tickets that wrote code ran nothing before their first edit;
- 6 diffs of 300 lines or more answered a ticket that named 1 to 10 records;
- none of the 17 runs whose tests were checked had a test shown to fail on the base.

**The guarantee:**
- **Reproduce first.** A bug plan has a `## Reproduce` section with:
- the ticket's exact inputs and their stored variants, with where they came from;
- a command this run ran on the base with `reproduce_on_base`, with its output quoted;
- the line where the existing code goes wrong.

A run that tried and couldn't reproduce writes `Unverified:` with why.
- **Fix the mechanism found.** The fix goes in the mechanism that the wrong line is in. A new resolution path beside it goes back to the planner.
- **Look questions up first.** A question that a page load or a query answers is looked up before it is decided with a default.
- **Size the diff to the ticket.** A diff that rewrites a code path for a few named records goes back to be narrowed, unless a `Wider than the ticket:` line gives the reason.
- **Fail on the base.** Each new test runs on the base and on the head, the way CI runs it, even when CI runs it in a loop. A bug fix with no test shown to fail on the base says `Unverified:` in its description.

**Where it's enforced:**
- `common::repro_first`;
- `passes::reproduce` (the tool, and `plan_gaps` in the plan check);
- `minimal_change::whole_path`;
- `common::test_env::TestEnv::file_command`;
- `habits_check::file_cmd` and `UNVERIFIED_FIX`.
7 changes: 7 additions & 0 deletions docs/incidents/sn_person_answer_moves_scope.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# sn. `sn_person_answer_moves_scope`

**What happened:** A plan left a page type out of scope, decided with a default. A reviewer answered on the pull request that those pages should cover both rows. The run replied "Understood", then reverted the work on those pages as out of scope. The scope ledger was seeded only from the ticket's acceptance criteria and the plan, and a person's comment counted only when the coder itself wrote a `Scope change:` line quoting it.

**The guarantee:** What people say decides scope as they say it. When the ledger is seeded, and on every round's comments, an out-of-scope entry that a person's answer or comment asks for moves into scope and records who asked. From then on, a diff that takes that work out is a breach that goes back to be put back. A comment that keeps the item out moves nothing.

**Where it's enforced:** `common::scope_ledger::Ledger::take_people`, `scope_ledger::breaches` (reverted items), `passes::scope_ledger::{people, load_or_seed, held, load_with_people}`.
1 change: 1 addition & 0 deletions services/common/src/agent_policy/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ pub const BUILTIN: &[(&str, Risk)] = &[
("restore_file", Risk::Write),
("run_codegen", Risk::Write),
("run_checks", Risk::Write),
("reproduce_on_base", Risk::Write),
// A team skill's own script in the sandbox (read-only GitHub token at
// most), and the run's outputs kept in CoderHelm.
("run_skill_script", Risk::Write),
Expand Down
3 changes: 3 additions & 0 deletions services/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,9 @@ pub mod pr_template;
pub mod preview;
/// What a fix must show before it is committed and pushed.
pub mod push_gate;
/// A bug reproduced on the base before code is planned, fixed in the
/// mechanism the reproduction lands in, questions looked up first.
pub mod repro_first;
pub mod run_prs;
/// Scope decided once at plan time, held in every round and in the
/// description.
Expand Down
Loading
Loading