Skip to content

A description names the head it was built for and is rebuilt whenever the head differs - #665

Merged
nambok merged 2 commits into
mainfrom
description-stamped-to-head
Nov 13, 2026
Merged

nambok merged 2 commits into
mainfrom
description-stamped-to-head

Conversation

@nambok

@nambok nambok commented Nov 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

The first live dependency run after #658 showed that a description built from the head does not stay true. A feedback round changed an override in the manifest and the description was rebuilt on that commit, where the lockfile still resolved the old version. The lockfile was regenerated in the commits after it, the checks ran again and the run completed. The description still said "not moved on the head", still counted the advisory as not fixed, and still listed the package under open findings and "the lockfile is out of sync" under Open items. CoderHelm's own review of the final head saw it and left it as a note.

Root causes, from reading the code against the run's timeline (the run's logs were not available to me):

  1. services/worker/src/passes/mod.rs, the checks step for a pull request that is already open (let pr_result = if let Some(o) = opened, then pr::apply_checks after settle::run). It skips pr::run and only patches CoderHelm's owned sections. It never rebuilt the sections computed from the lockfile, and with_checks in pr.rs copied the old open findings forward as they were.
  2. services/worker/src/passes/review_pr.rs, where a review of CoderHelm's own pull request writes its open findings. It added its section to the copy of the description read when the review started and saved that. A review that began before a rebuild and ended after it put the earlier description back, and a review of a head already replaced wrote that head's findings onto the new one. Four reviews on four different heads ran in the minute after the feedback round.
  3. lock_repair_on_pr in resume.rs and its callers push a regenerated lockfile and nothing rebuilt the description after it.
  4. settle::classify treated an item about the lockfile as CoderHelm's own work left, so no check ever settled it.
  5. own_review::required left out every optional finding, so a wording note about the description ended the loop.

dep_head read the versions correctly: the new tests with suffixed versions and an override keyed on the exact version pass without a change to it.

This change makes the rebuild independent of which code path pushed.

Changes

A stamp, and one rebuild that every resting point calls

  • description.rs: the description carries <!-- coderhelm:built-for <sha> -->. reconcile reads the pull request, and when the stamp is not its head it rebuilds everything computed from the branch and stamps the head. rebuild does the same whatever the stamp says (CI ended on the same head, the model rewrote the prose).
  • security_fixes::at_head is the one builder of the dependency sections and description.rs is its only caller (a test holds that).
  • Called from:
    • main::handle_message, after every message, for each branch CoderHelm moved while handling it (reconcile_moved);
    • pr::apply_checks, so the checks and settle step ends on a description of its head, including after a redrive;
    • pr::run, so the first description is stamped;
    • review_pr, before a review of CoderHelm's own pull request reads the description;
    • pr_watch::perform;
    • resume::complete_run_with_status: when the description cannot be rebuilt for the head the step returns an error and is tried again. A run does not complete while stamp and head differ.

Every push is seen in one place

  • clients/github.rs: all requests leave through send_tracked. It now notes the branch moved by a successful ref update or creation, contents write or delete, or merge (branch_moved_by). The branches are drained by reconcile_moved.
  • A test fails when a request is sent outside send_tracked, when a write is built and not sent through it, or when a pass calls GitHub's refs or merges endpoints itself.

Nothing of an earlier head survives

  • review_pr.rs: open findings are written with description::edit, which reads the description as it is now, applies the one section and saves. It writes nothing when the reviewed head is no longer the pull request's head.
  • settle.rs: an item that says a lockfile is out of sync is classified as something CoderHelm runs (Action::LockSync). The repository's checks install from the lockfile; when they ran and passed on this head the item closes with that result, otherwise it stays and says what was or was not run.
  • The dependency table, headline and advisory counts are recomputed in every rebuild, as before; they now also run in the paths listed above.

CoderHelm's review of its own pull request

  • own_review::about_description: a finding that names the description and says it is behind the code. It is never optional. The review calls description::rebuild for it before deciding what is open; when the rebuild changed the description the finding is dropped, otherwise it is required and goes to a fix round, whose end rewrites the description.
  • own_review::required now leaves out only pure style (review_severity::pure_style: a preference the reviewer inferred, such as wording, naming or layout). An optional improvement to working code is required. The existing round limits apply (own_review::MAX_FIX_ROUNDS, then the findings are deferred with the reason). review_severity::optional had no other caller and is removed.

Tests and the incident suite

  • dep_head: versions with a suffix on and off their line, an exact-version override key read from pnpm, npm and yarn lockfile text, and a package moved on a later head after an earlier head recorded it as not moved.
  • incidents/ar_description_stamped_to_the_head.rs and its row in docs/incidents.md.

Not in this change

  • For a pull request that is not a dependency fix, reconcile only stamps. Its prose is still rewritten by the model in the paths that call head_moved.
  • The stamp covers the computed sections. Open items written on an earlier head are still re-derived by the existing settle redrive at completion, which is capped at three per run.
  • LockSync rests on the repository's checks installing from the lockfile. A repository whose check command installs without a frozen lockfile would close the item on a passing check without proving it.
  • Two things seen in the same logs are reported, not fixed:
    • "review fix suite: CoderHelm's own command broke before the tests ran ... exit 127" for pnpm commands. review_fix/suite.rs and suite_shell.rs never call ensure_manager, which is what makes pnpm or yarn available in the other sandbox commands, so a pnpm command there runs on an image without pnpm.
    • "runtime proof ... the build passes; the application did not start" on both base and head. That is the proof's designed answer when the start fails on the base branch too (the sandbox has no secrets or services): it is reported and proves nothing about the bumps.

Verification

  • cargo fmt --check --all: clean
  • cargo clippy --workspace --all-targets -- -D warnings: clean
  • cargo test --workspace: passes on the tree merged with main (common 2295, gateway 912, worker 1785, 0 failed)
  • Verified by test: the stamp and its staleness; the rebuild dropping "not moved on the head" and the not-fixed count; which requests move a branch; the single send path; the completion gate, the reconcile calls and the review's write, by source assertion; the settle classification and result; the review rule; the dep_head cases above.
  • Not verified live: no real pull request was reconciled, and the root causes were read from code against the reported timeline, not confirmed from the run's logs.

… the head differs

A dependency run's description was built on the commit that changed the
manifest, where the lockfile still resolved the old version. The lockfile
was regenerated in later commits and the run completed with a description
that still said "not moved on the head", still counted the advisory as not
fixed and still listed items of the earlier head.

- description: a hidden stamp names the head the description was built
  for. reconcile rebuilds it when the stamp is not the pull request's
  head: after every message in which CoderHelm moved the branch, in the
  checks and settle step, before a review of its own pull request, in the
  pull request watch and at the end of the run, which returns an error
  instead of completing on another head's description.
- GitHub client: every request leaves through send_tracked, which notes
  the branch a successful ref update, contents write or merge moved. No
  caller has to remember to ask for a rebuild.
- review: its open findings are written on the description as it is now
  and only while the reviewed head is still the head. It used to write
  back the copy it read when it started.
- settle: an item that says a lockfile is out of sync is checked on the
  head by the repository's checks, never carried as CoderHelm's own.
- own review: a finding that the description is behind the code triggers
  the rebuild and is dropped when the rebuild settles it. Every finding
  that is not pure style is CoderHelm's to act on.
- dep_head: tests for suffixed versions, exact-version override keys and a
  package moved on a later head.
- Incident case ar and its row in docs/incidents.md.
@nambok
nambok merged commit b66a622 into main Nov 13, 2026
10 checks passed
@nambok
nambok deleted the description-stamped-to-head branch November 13, 2026 23:55
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