Watch
0
0
Fork
You've already forked hyperhive
0

swarm-controller: the review classifier reads a diff with 25 lines of context, not 200

The wide diff's context drops from 200 to 25 lines, so a block's
enclosing gate stays in view when it opens within 25 lines above the
change (the forge's own diff carries 3). The fallback note, the doc and
the gate fixture (now 20 lines out, not 47) follow.
This commit is contained in:
atlas 2026-10-15 10:13:23 +02:00 • committed by mara
commit 4098fd6d35
3 changed files with 8 additions and 7 deletions

View file

@ -288,7 +288,7 @@ description and the task to classify the PR against it. The identical prefix
lets the runtime's prompt cache reuse it across questions.
The controller builds the diff itself, from each changed file at the PR's
merge base and at its head, with 200 lines of context around each change
merge base and at its head, with 25 lines of context around each change
rather than the 3 of the forge's `.diff`. That keeps a moved block's
enclosing gate in view, such as a `config = lib.mkIf …` or an option's
`default`, so a move that restates the gate doesn't read as adding one. The

View file

@ -10,9 +10,10 @@ use std::time::Duration;
use similar::TextDiff;
/// Lines of context around each change. In this repo's Nix modules a block's
/// enclosing `config = lib.mkIf …` sits up to 191 lines above it.
pub const CONTEXT_LINES: usize = 200;
/// Lines of context around each change. A block's enclosing
/// `config = lib.mkIf …` is in view when it opens within this many lines above
/// the block.
pub const CONTEXT_LINES: usize = 25;
/// The largest wide diff sent, in bytes, about 64k tokens of code. A larger
/// one gives way to the forge's `.diff`.
@ -172,8 +173,8 @@ mod tests {
change("nix/host-modules/glue-nats-wireguard.nix", None, Some(glue)),
change(
"nix/host-modules/swarm-nats.nix",
Some(&module(47, true)),
Some(&module(47, false)),
Some(&module(20, true)),
Some(&module(20, false)),
),
]
}

View file

@ -2033,7 +2033,7 @@ mod tests {
let body = narrowed(reason(), true).await;
assert!(
body.ends_with(
"\nThe classifier read the forge's diff, with 3 lines of context, not 200: \
"\nThe classifier read the forge's diff, with 3 lines of context, not 25: \
the PR changes 101 files.\n"
),
"{body}"