All notable changes to this project are documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
-
Dashboard API (
/dashboard/*). The transformers-ci dashboard can ask serge to make the GitHub writes behind "Re-run failed tests", so its public-facing exporter never holds a write credential:POST /dashboard/permission,/dashboard/runs/canceland/dashboard/workflows/dispatch. The dashboard authenticates withDASHBOARD_API_TOKENand names the acting user, whom serge checks for write access with its App. Cancels are limited to runs ofDASHBOARD_CANCEL_WORKFLOWS, dispatches toDASHBOARD_DISPATCH_WORKFLOWSon the default branch, both inDASHBOARD_REPOSITORIES. Off (404) without the token./tasksis unchanged: the dashboard token is not a/taskscredential. -
A task can answer with anchored edits instead of a unified diff. A diff asks the model for three things at once — what to change, the surrounding context byte for byte, and the
@@geometry that has to agree with it — and two of the three are bookkeeping it got wrong:zambalost on one trailing comma inside a 40-element tensor it had to re-type,qwen3_omni_moeon a hunk count that did not match its own hunk body. An anchored edit is{"path", "old", "new"}, whereoldmust occur exactly once. Measured on the same two real rejections through the prod router, asking for edits instead of a diff got 3 of 4zambaedits and 2 of 2pvt_v2edits exactly right, and on one run the model correctly returned an EMPTY list rather than invent an anchor for a line it could not find. serge applies the edits itself and has git write the diff, soplan.patchis git's and nothing downstream —publish_task,commit_scope,classify_patch, the brevity pass, the GPU verify gate — learns that the format exists.patchstays for what anchors cannot express (a new file, a deletion, a rename). Exactly-once or refuse: there is no fuzz and no nearest-match, so an ambiguous anchor is a rejection and never a silent edit in the wrong place — and the rejection says which ("olddoes not occur", "occurs 3 times at lines …"), quoting the line that is really there when the anchor is a near-miss, wheregit apply's "patch does not apply" could say none of that. Edits that never applied still fail the task, rather than becoming a quiet "no fix proposed" that would take this whole failure mode out of the error counts.
-
A rejected patch now gets a correction turn that can see the file. Three prod tasks died applying a patch on 2026-09-16/17 (
pvt_v2,qwen3_omni_moe,zamba; triage issues transformers#48881 and #48914) — 23% of the task rows in the store and 75% of all task errors, 3.58M input tokens for 0 PRs and 0 branches. Each hadrejected_patch: 3/patch_apply_error: 3/validation_retries: 2: the same patch failed three times in the loop, the correction budget ran out, andpublish_taskapplied a fourth time and reported that. It was not a weak apply fallback — strict,--recount,-C1,-C0,--3wayand GNUpatch --fuzz=3all reject all three patches. It was that the correction turn was blind: the compact retry prompt stripped the model's tools and forced reasoning to "low", and the feedback was two lines of stderr naming a line number. So it re-guessed the context — onzambathe same line came back"<s><s> Tell me…"twice and"[PAD][PAD]…<s> Tell me…"once. Now_validate_patchsends the real file content around every rejected hunk (numbered astools.read_filenumbers it), avalidation_retry_messagescallback may returnNoneto keep the live conversation and its tools, and tasks do that for an apply rejection while a normalizer rejection keeps the compact prompt.apply_patchalso raisesgit apply -v's "while searching for" block so the stored job error is a diagnosis, butapply_error_for_modelstrips it from what the model sees — that block quotes the model's own wrong context, and handing it back measurably kept the fabrication alive. Measured against the deployed model (moonshotai/Kimi-K2.6) replaying both real rejections, 4 runs each, nothing else changed:pvt_v20/4 → 3/4 applied,zamba0/4 → 1/4. -
A task no longer loses a finished patch to its own deadline.
TASK_RUNNER_TIMEOUTis the task Job'sactiveDeadlineSeconds, so it kills the pod wherever it is. Jobd2c24049(2026-09-16,transformers#48881) had finished 56 turns of work, produced a patch that applied cleanly plus a PR title and body, entered the normalize step at 00:06:03, and was killed at 00:11:22 with 5m19s of a 30-minute normalize left. serge recordedtask runner exited without reporting (exit code 1), the triage issue showed⚠️ task failed, and the twoqwen3_omni_moetests stayed unfixed — nothing was published, no branch survived. The runner now bounds every step that can block against the budget it has left (reviewbot/budget.py) instead of against its own configured timeout: the agent loop stops itself withstop_reason="deadline"whileTASK_TAIL_RESERVEstill remains and asks for a final answer without tools; the repo normalizer's timeout is cut to fit, and is skipped rather than started when it cannot finish (the patch is accepted un-normalized — what an unavailable normalizer already produced, and CI still catches the rest); the reproduce poll is clamped like the verify poll already was; and a GPU-verify retry round or a further candidate group is not started unless it has the tail plus ten minutes of real loop time, since the round already in hand is on a branch and the new one's loop would end on iteration 1.TASK_TAIL_RESERVEdefaults toTASK_NORMALIZE_TIMEOUT + 180, derived so raising the normalize timeout cannot silently outgrow it. The budget is armed only inside a runner pod, so the legacy in-process worker stays unbounded.
-
A review now knows when another open PR claims the same issue. Before the loop starts, serge reads the
Fixes #N/Closes #Nclaims out of the PR body and asks relore who else claims to close those issues; any other OPEN pull request becomes a trusted reviewer-side note. "This duplicates #48758, also open" is a finding a human reviewer wants and serge could not previously see.history_inflightis already in the model's schema, but a review has nothing useful to pass it:inflight <the PR under review>asks what claims to close that pull request, and nothing closes a pull request — well-formed and always empty. The useful question is one hop out, on the issue.serge asks, rather than leaving it to the model. Measured over six review runs on two PRs, the model reached for the history tools 0, 0, 1, 3, 0, 0 times; a check worth having on every review cannot depend on that. Fail-soft and non-gating: a PR that closes nothing makes no call, and a daemon that is down produces no note and changes nothing else.
-
The repeat guard stops paying for repeats, and stops waiting three turns to act. Two changes from reading the prod job store.
TOOL_REPEAT_LIMIT6 → 3. Across the 25 sessions that recorded a stop reason,repeatsis only ever 0, 1, 2 or 6 — never 3, 4 or 5. The nudge fires at 3 and not one session has ever recovered after it: a session either repeats twice and moves on, or runs straight to the cap. So the grace between nudge and cut-off was pure waste, and lowering the cap cannot affect a session that behaves, because those never reach 3.ToolRepeatGuard.applynow serves a repeat whose result was byte-identical as a pointer to the copy already in the transcript instead of a second copy. A tool result is not paid for once — it is re-sent with every later turn — so the sixth copy of a 6KB read is billed for the rest of the session. Keyed on the RESULT, never the call: an identical re-run still executes and is served in full when the bytes differ, because in the task loop a re-read after the normalize gate applied a patch must see the new content. And only when it saves: agrepthat found five lines is smaller than the sentence telling the model to scroll up for it, and collapsing that would grow the transcript while sending the model hunting for bytes it could have been handed. On the three repeat shapes measured in today's sessions, 23,160 transcript bytes become 11,290.Neither change stops the model looping — it ignores an explicit, escalating nudge while receiving correct results — but they make the loop cheaper and shorter.
repeat_guardwas already the most common stop reason before any of this week's prompt work, so the looping is not new. -
history_copies, and a truncation fix that the tool exposed.relore copiesgroups every definition of a symbol by what the body does, largest group first. On transformers that is the one questiongrepcannot answer:rotate_halfhas 180 definitions in 5 shapes, and what matters is the 2-copy shape at the bottom, not the 158-copy one at the top. It reads the default branch, not the PR head — said loudly in the description, sincegrep/read_fileare the tools for the code under review.Its output is 11–13KB against an 8KB budget, which exposed a real defect in the existing cap: truncation kept the head and dropped the tail. For
copiesthat discards the finding and keeps the boring bulk; for every relore result it also cut off the closing<<<RELORE-UNTRUSTED-END>>>, leaving the envelope unterminated so the model could not tell where quoted text stopped. Truncation now drops the middle and names how much it dropped, so both ends survive. No parsing of relore's format, so nothing drifts when that format changes. -
Project-history tools, in both the review loop and the task (ITF) loop (
reviewbot/relore_tool.py). serge can now askrelore— the index over this org's issues, PR descriptions, reviews and inline review comments — what the project already decided, via four read-only tools:history_search,history_thread,history_whyandhistory_inflight. They answer what a checkout cannot. A review that is about to flag a convention can check whether a maintainer already ruled it correct (kind="rationale"keeps the answer to people with write access, because a confident wrong answer from a passer-by is worse than none). A task can askhistory_inflight <issue>before it diagnoses anything: writing a patch for a fix that has been in review for hours is the most expensive mistake the loop makes, and that is one call. Smoke-run against production:inflight 48630returns the two pull requests already claiming to close it.serge shells out to the pinned
reloreclient rather than calling/api/v1, because three things live in the client and would drift silently if re-implemented: the client/daemon version handshake (a mismatch is refused with 426 rather than answered with a complete-looking reply missing whatever the client did not know to ask for), the server-side untrusted-content envelope — relayed verbatim, never re-wrapped, since serge's own markers around the whole page would put relore's[authoritative]labels inside a "do not trust the text below" region — and the error vocabulary that tells a daemon that is down apart from an empty index apart from a stale client.Off unless configured:
RELORE_APIplus aRELORE_REPOSlist, and the tools enter the model's schema only for a PR or task on a repo in it.--repois always serge's own fact and is not reachable from the tool schema. The client is installed at image build time (RELORE_REFinDockerfileanddocker/Dockerfile.task-runner) — a task pod's egress allowlist has no PyPI — and that pin must name the commit the deployed daemon was built from. Task pods reach the daemon throughserge-egress, so its host needs anallowDomainsentry. Seedocs/configuration.md. -
One extra LLM pass that shortens serge's own prose (
reviewbot/brevity.py). Prompt discipline had already been tried: the task prompt'sLENGTHblock tells the model to comment only where the reason for a line is not evident from the line, and verbose models keep writing four lines of comment over a one-line assignment. So both flows now get a single dedicated call whose only job is to shorten:- Tasks (
TASK_COMMENT_BREVITY, default on): every comment the patch added, in one call, in the worktree just before the repo normalizer runs — so the comments that reach a PR are the ones the repo's own formatter saw and the gate accepted. - Reviews (
REVIEW_COMMENT_BREVITY, default on): the summary and each inline comment body, before the draft is stored, so the operator edits the text that will actually be posted.
The pass can only ever shorten. The model is handed comment text and returns comment text — the marker, the indent and the wrapping are serge's, so a reply cannot become a code line. Comments are located with
tokenize(running on the applied worktree is what makes that possible: a#inside a string literal is not a comment, and a diff line cannot tell you), and a rewritten file is kept only if its code-token stream is byte-identical and it still parses. Machine-read comments are never sent at all — lint suppressions, typing pragmas, formatter switches, licence headers, and transformers' ownCopied from/Ignore copy(shortening one would failmake repo-consistency). In a review, a fenced ```suggestion block is masked out before the model sees it and must come back intact, an empty answer is treated as "keep" so brevity can never delete a finding, and any body that came back longer keeps its original. Every failure path — provider error, unparseable reply, guard tripping — leaves the original text, which is the behaviour that shipped before this existed. A normalize failure that follows a condensed patch says so in the feedback, because the pass moves the line numbers the normalizer reports. Its tokens are folded into the job's totals but not intosession's turn count: it is not a loop turn.Measured live 2026-09-03 against Kimi at prod's caps, on real serge output rather than fixtures:
- Reviews are where the verbosity is. Four published review bodies (three summaries + one inline comment, fetched back off the transformers PRs serge reviewed): 3,160 → 1,929 chars, −39%, in one call of 1,177 in / 443 out tokens, 2.6s. Every finding survived and the ```suggestion block came back byte-identical.
- Patch comments are a smaller prize than expected. Of seven archived
local task runs that produced a patch, only two contain a comment over the
100-char floor at all; the worst (236 chars / 3 lines) condensed to 197
(−17%), the phimoe one 134 → 126. A full
--brevityreplay of the phimoe group produced a patch with no comments whatsoever — the pass is cheap when there is nothing to do, and now says so. - The first live review run dropped three verdict statements — "No
correctness, security, or style issues were found", a "correctly
fixes", and the object of "verified on a GPU runner that the new
expectation matches current behaviour". Shortening a sign-off into
silence is a different review, so
_REVIEW_SYSTEM_PROMPTnow keeps the verdict (a clean one included) and what a claim is about; the re-run restored all three at the same −39%.
- Tasks (
-
The tool-repeat guard is now path-aware. It keyed on the exact arguments, so fifty-three reads of one file at a different line range each time were fifty-three distinct signatures and it counted zero repeats — while that is the shape that dominates in practice (prod task
9d210794: 137 of 153 calls re-opened a path it had already opened). A second counter tracks visits per opened path, with its own allowance (TOOL_PATH_REVISIT_LIMIT, default 3) and its own cut-off (TOOL_PATH_TRIP_AFTER, default 40). The correction names the file and the ranges already served — "you have already readmodular_blt.py6 times in this session (lines 1-200, 180-420, 400-650)" — rather than only saying stop, because the first is something a model can act on. Still not a cache: every call executes for real, since a re-read after a patch must return the new content. A session cut off this way reportsstop_reason =path_revisit_guard, distinct fromrepeat_guard. -
Per-job agent-loop metrics, exported for Prometheus at
GET /metrics(unauthenticated, like/healthz; scraped in-cluster over the pod port). Every finished job now records how many turns and tool calls it ran, what it spent, how many of its tool calls re-opened a path it had already read, and — the one that reorders the rest — which guard ended the session, withansweredmeaning the model finished on its own terms and every other value meaning it did not. The exposition is a rolling window over the jobs the store still holds (WEB_JOB_RETENTION, 25); Prometheus is the durable side, so read history with a range query rather than by curling the endpoint. The same record is returned onGET /tasks/{owner}/{repo}/{id}/status, so a dispatcher can say why a group came backno_fix. -
GitHub App mode is documented as the zero-config default: installed repos need no workflow file or secret, with instructions for overriding gating via an explicit workflow and a note on the forked-PR limitation.
-
A final answer that is nothing but leaked tool-call markup is now re-asked instead of parsed.
_needs_final_salvageonly recognised a truncated or empty reply, so markup-only content — non-empty, so it looked parseable — went straight to_extract_jsonand raisedLLM returned unparseable outputwith zero recovery attempts. The review path had a backstop after parsing; the task path had none, which is what 3 of 10 task jobs in the 2026-08-24→26 window died of. The three unusable shapes are now one classifier (_final_answer_defect), so the loop, the log line and the recovery prompt agree on what was wrong, and the markup case gets a prompt that names the mistake. -
_UnparseableLLMOutputnow carriessalvage_attempts, so the error distinguishes "salvage never recognised this shape" (0) from "salvage ran and the model still could not produce JSON" (>0). Those are different bugs and they used to share one error string. -
The new-review form's per-provider model dropdown is visible again: it now lists a provider's models on page load (via
GET /llm-options/models) instead of only after a PR reference resolved to a matching config, and Anthropic's/v1/modelsis called with theanthropic-versionheader it requires. -
The trigger gate now ignores comments authored by a bot, so the App never reacts to its own output (no self-trigger loops in App mode).
-
grepno longer under-reports silently. It rangit grep --max-count=10, a cap that applies per file and left no trace in the output, so a single-file search returned ten matches that looked like the complete set — a rules file with 57descriptionlines came back as ten. The per-file cap is now derived frommax_results(one above it, so a partial answer is distinguishable from a complete one), the output is streamed and stopped at the cap instead of captured whole and sliced, and a truncated result ends with an explicit note telling the model not to treat the count as final. The note used to be passed to the 8000-char truncator as a suffix, which dropped it whenever the output was under 8000 chars — i.e. on exactly the results that looked trustworthy. A single match line is also clipped at 300 characters so one minified line cannot spend the whole output budget. -
grepruns Perl-compatible patterns where git supports PCRE2, falling back to POSIX ERE otherwise. Under-Ea pattern likeTRF\d+or\bViolation\bmatched nothing and returnedno matches, which reads as "not in this repo" — worse than a truncated answer, because it invents an absence. The result header now names the flag actually used, and a no-match answer under ERE says so when the pattern needed a feature ERE lacks. -
grepsearches untracked files too, so a file created by an applied patch is visible to the search that follows it (/tasksgreps after patching). Gitignored paths stay excluded, and matches under a denylisted directory (node_modules,.venv, …) are dropped rather than handed to a model thatread_filewould then refuse.
0.1.0 - 2026-06-17
First public release of serge, a GitHub-native AI code reviewer for any
OpenAI-compatible LLM.
- Pull request reviews that read the diff and post inline comments through GitHub's Pull Request Reviews API.
- Every proposed inline comment is validated against real diff positions before publishing; comments that don't map to a diff line are dropped.
- Trigger comments (
@askserge please review) and follow-up replies on inline review comments. - The model name used for a review is included in the review output.
- GitHub Action — per-repo setup driven from GitHub Actions.
- GitHub App webhook — hosted reviewer across many repositories, with installation tokens read from the app database.
- Web app — human-in-the-loop staged reviews that can be edited or discarded before they reach a PR, with webhook calls surfaced in the app UI.
- Repository review rules from
.ai/review-rules.md. - Optional read-only repository context from
.ai/context-script. - Optional helper tools from
.ai/review-tools.json.
- Support for any OpenAI-compatible chat completion endpoint.
- Hugging Face inference provider selection in the web UI.
- Configurable max tokens exposed in the UI.
- Optional context compression via
headroom, enabled at runtime withHEADROOM_COMPRESS=1.
- Optional
/tasksflow: CI posts a failure report and serge opens a fix PR. existing_prmode appends follow-up commits to an existing fix branch instead of opening a duplicate PR, enabling a CI-retry loop.- Loop-cap safety that counts serge-authored commits on a branch to prevent infinite retry loops.
- Original failure report included in the task PR body.
- Fork and PR code isolated from the review host.
- Explicit handling for reviews triggered on forked PRs.
- Dependabot weekly bumps for GitHub Actions.
- Public documentation site under
docs/.