Skip to content

PR bodies fit GitHub's limit; a refused PR waits with GitHub's words; Retry opens it from the work - #636

Merged
nambok merged 1 commit into
mainfrom
pr-body-fits-github
Nov 12, 2026
Merged

nambok merged 1 commit into
mainfrom
pr-body-fits-github

Conversation

@nambok

@nambok nambok commented Nov 12, 2026

Copy link
Copy Markdown
Collaborator

Summary

A bundled security fix run (55 packages, 229 advisories, every task done) ended without its real pull request: GitHub refused the description with 422 body is too long (maximum is 65536 characters). The stop path then opened a small draft whose only open item was the raw HTTP error, and the run waited on "Review pull request #n" with that error as its reason.

Now no body CoderHelm sends GitHub can be over its limit, a big bundle's description lists what to look at first and points at the full detail, a refused pull request is tried once more and then said in GitHub's own words, and Retry on a run whose work was done opens the pull request from its branch without implementing again.

Changes

  • common::pr_body_fit (new): one structured fitter for every body. It keeps the text before the first heading (ticket line, draft status, "Not yet verified"), the sections a reader and CoderHelm read first (Summary, Not finished, CI failing, Not yet verified, Verification, Open items, Proof, Risk), a dependency fix run's account under "What to check" (### Dependency fix run: the bumps applied, the ones deferred with why, the sandbox's checks and the cost, from Security update runs: planned by rule, verified in the sandbox, never stuck #634) whole, every ## heading and every line with an HTML comment marker. It shrinks the other sections largest first, a step at a time: nested lines under list items, then long lists capped with "and N more", then a section's text replaced by one line saying where the full detail is. Code blocks are never left open. Titles are kept to 256 characters.
  • GitHub client: bounded_payload runs in post, patch, post_empty and the review update, so pull requests, description updates, issues, comments and reviews all go through it. The #0 guard stays where it was.
  • Security bundle description (common::security_fixes): a bundle of more than 10 packages gets the short description. Every package is still in the table, most urgent first, each linked to its finding page. Advisories list P0, P1, exploited and malware first and count the rest by tier. Reachability lists what is reachable and counts the rest. "What to check" shows in full up to 10 packages that need a look (P0 and P1, and majors with breaking changes, call sites, or notes not found), then the rest by tier with counts inside <details>. A dependency fix run's account comes first in "What to check", as in the full description. Closes is capped. Small bundles and single fixes keep the full description as before.
  • Full detail: every package's notes and every advisory go to openspec/specs/<ticket>/security-detail.md on the pull request's branch. That is the folder where CoderHelm already commits the run's plan, it is excluded from the work files, and it is written only when the team's commit_openspec setting is on. Its link is recorded on the ticket, so the in-place CI rewrite of "What to check" and Proof builds the same short sections. The dashboard's finding pages already show each advisory, its path, reachability and evidence, and the table links them whatever the setting is.
  • Pull request pass: when GitHub refuses a create as invalid, it tries once more with the description cut to half the target, then fails with plain words ("GitHub refused to open the pull request: body is too long (maximum is 65536 characters)") in place of the raw HTTP line. A rate limit or an outage keeps its own error, so the run still waits for GitHub.
  • Stop path (stop_pr): open returns Stopped::Opened { number, url } or Stopped::Refused { why }. The supervisor's ending rules (Runs finish or hand back only for a listed reason: one supervisor for every ending #635) decide first: a run it ships opens its pull request and goes on to CI, now named only when GitHub gave it a number. A run it hands back for a reason on the human-only list opens its draft; a create GitHub refuses there is tried once more with a shorter body, and if it is refused again, or GitHub's answer has no number, the run waits with that same hand-back reason ("Open the pull request", with GitHub's words and what Retry does). Nothing logs or records a pull request it doesn't have (before, a missing number became #0). The log lines name the pull request number only from Stopped::Opened.
  • Retry: a Retry (resume_from) of a run whose checkpoint says the work was implemented (implement or a later pass), whose plan is still there and whose branch still exists takes up that checkpoint as its own. It goes on to the checks and the pull request without implementing again. The pull request pass finds the branch's open draft and rewrites its description in place. For a security ticket it now also tells the findings about that pull request, skipping findings that already point at it.

Verification

  • cargo test --workspace, cargo clippy --workspace --all-targets -- -D warnings, cargo fmt --all, on main with Security update runs: planned by rule, verified in the sandbox, never stuck #634 and Runs finish or hand back only for a listed reason: one supervisor for every ending #635.
  • New tests:
    • pr_body_fit: a body 3x over the limit fits with every marker (in order), every heading and every kept section intact; an in-place rewrite of "What to check" and Proof on the fitted body works and fits again; the Not finished markers stay paired; a body over the limit before its first heading keeps its markers; a property test over 120 random bodies of every size checks that the result fits, keeps its markers and headings, and leaves a body that already fits unchanged.
    • Client (body_limit_tests): a local server receives a create, a description update, a comment and an issue with a body over twice the limit, and every body sent fits and keeps its required sections and marker. Every body write is checked to go through the bound.
    • Dependency fix run's account: it stays whole in a fitted body at 64,000, 20,000 and 12,000 bytes while the package blocks beside it shrink; the short bundle description starts "What to check" with it, keeps it when fitted harder, and the detail document has it.
    • Bundle: the 55-package, 37-major, 229-advisory bundle fits without the generic shortening, with P0 then P1 then majors first in "What to check", the rest by tier with counts, every package linked, the detail link present, and a detail document that has every package. The CI rewrite in place on the short body works and fits.
    • Stop path: a refused create, or an answer without a number, is never taken for a pull request; the log line and the wait say GitHub's words and Retry. The source checks find two creates and record_refused, and no unwrap_or(0).
    • Retry: which checkpoints a retry takes up, that run_passes takes it up before deciding to implement, and that this run's recorded error resumes.
  • Shown to fail on the code before this change (tests ported to origin/main): the bundle description is over the limit, the CI rewrite is over the limit, the client sends bodies over the limit, the stop path records a create without a number as #0 and logs "Opened" with whatever link came back, and Retry has no checkpoint, so it implements again.

@nambok
nambok merged commit 104ec23 into main Nov 12, 2026
10 checks passed
@nambok
nambok deleted the pr-body-fits-github branch November 12, 2026 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant