Watch
0
0
Fork
You've already forked hyperhive
0

swarm-controller: fall back to the forge diff when a file read fails, and stop rendering at the cap

A failure reading the changed files (a forge error on a tree or blob, a
truncated tree, a non-base64 blob) or joining the diff task made the PR
read fail, so the review posted no verdict. It now falls back to the
forge's 3-line .diff with "reading the files failed: …" as the note.

render wrote each file's whole diff before wide compared it with
MAX_BYTES. It now writes through a writer that refuses once past the cap,
which stops similar's formatter mid-file, so one huge file costs about
MAX_BYTES of output, not its full diff.
This commit is contained in:
atlas 2026-10-15 07:54:08 +02:00 • committed by mara
commit f4b5e1445b
3 changed files with 82 additions and 31 deletions

View file

@ -293,8 +293,9 @@ 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
controller sends the forge's `.diff` instead when the PR changes more than
100 files, when the forge names no merge base, or when the wide diff is over
256 KiB. The review then says so, with the reason.
100 files, when the forge names no merge base, when reading a changed file
fails, or when the wide diff is over 256 KiB. The review then says so, with
the reason.
On the API key runtime the commits and diff are one content block of the user
message and the question another, with a cache breakpoint at the end of the