Skip to content

A self-improving RLM agent for coding workflows and long-running autonomous tasks.

Rust

ci: restore changelog-fragment check (#3790)

Sebastian Müller6b5896cdd7d9
diff --git a/.changes/README.md b/.changes/README.md
new file mode 100644
index 0000000000..c72b17e973
--- /dev/null
+++ b/.changes/README.md
@@ -0,0 +1,9 @@
+# Changelog fragments
+
+A PR that changes what the release ships adds a fragment here or carries the `no-changelog` label
+(enforced by `.github/workflows/changelog-fragment.yml`, which lists the shipped paths).
+
+- One file per PR, directly in this directory: `.changes/<branch-slug>.md`.
+- Content: one user-facing bullet, e.g. `- Fixed the frobnicator dropping input on resize.`
+- `release-prepare` folds the fragments into `CHANGELOG.md` and deletes them
+ (`scripts/release/fold_changelog.py`). This README is never folded.
diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md
index a5cc05f05e..e7502a5500 100644
--- a/.github/pull_request_template.md
+++ b/.github/pull_request_template.md
@@ -25,6 +25,7 @@ https://github.com/PrimeIntellect-ai/prime-agent/discussions
- [ ] cargo fmt --all --check
- [ ] cargo clippy --workspace --all-targets -- -D warnings
- [ ] cargo test --workspace
+- [ ] `.changes/<branch-slug>.md` fragment added (or the `no-changelog` label for no user-visible change)
<!-- Windows-touching PRs: make windows-cross (zero warnings) -->
## Test/e2e evidence
diff --git a/.github/workflows/changelog-fragment.yml b/.github/workflows/changelog-fragment.yml
new file mode 100644
index 0000000000..0ddc3a84ed
--- /dev/null
+++ b/.github/workflows/changelog-fragment.yml
@@ -0,0 +1,70 @@
+name: Changelog fragment
+
+on:
+ pull_request:
+ types: [opened, synchronize, reopened, labeled, unlabeled]
+ branches: [main]
+
+permissions:
+ contents: read
+ pull-requests: read
+
+jobs:
+ changelog-fragment:
+ name: Check changelog fragment
+ runs-on: ubuntu-latest
+ if: github.event.pull_request.user.type != 'Bot'
+ steps:
+ - name: Require a changelog fragment for shipped changes or an explicit opt-out
+ uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
+ with:
+ script: |
+ const pr = context.payload.pull_request;
+ if (pr.labels.some((label) => label.name === "no-changelog")) {
+ core.info("Label no-changelog is set; skipping changelog check.");
+ return;
+ }
+ // listFiles caps at 3000 files; beyond that the check cannot see every change.
+ if (pr.changed_files > 3000) {
+ core.setFailed("PR changes more than 3000 files; split it or apply the no-changelog label.");
+ return;
+ }
+ const files = await github.paginate(github.rest.pulls.listFiles, {
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ pull_number: pr.number,
+ per_page: 100,
+ });
+ // What the release ships: the binary's sources (vendor/ is a patched dependency,
+ // install-rust.sh is compiled in) and the payload assemble_artifacts.py stages.
+ const shipped = ["crates/", "vendor/", "install-rust.sh", "prime-agent-runtime/", "skills/"];
+ const isShipped = (path) => shipped.some((prefix) => path.startsWith(prefix)) && !/\/tests?\//.test(path);
+ if (!files.some((f) => isShipped(f.filename) || (f.previous_filename !== undefined && isShipped(f.previous_filename)))) {
+ core.info("No shipped paths changed; no changelog fragment needed.");
+ return;
+ }
+ // fold_changelog.py folds direct children of .changes/ except README.md.
+ const fragments = files.filter(
+ (f) =>
+ (f.status === "added" || f.status === "modified") &&
+ /^\.changes\/[^/]+\.md$/.test(f.filename) &&
+ f.filename !== ".changes/README.md",
+ );
+ for (const f of fragments) {
+ // Read at the head commit through the base repo: works for fork PRs with this read-only token.
+ const { data } = await github.rest.repos.getContent({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ path: f.filename,
+ ref: pr.head.sha,
+ });
+ if (Buffer.from(data.content, "base64").toString().trim() !== "") {
+ core.info(`Changelog fragment found: ${f.filename}`);
+ return;
+ }
+ }
+ core.setFailed(
+ `Shipped paths (${shipped.join(", ")}) changed but no non-empty changelog fragment ` +
+ "was added or modified. Add .changes/<branch-slug>.md containing e.g. " +
+ "`- Fixed the frobnicator dropping input on resize.`, or apply the no-changelog label.",
+ );
diff --git a/AGENTS.md b/AGENTS.md
index c2da65c032..7a7ada6211 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -134,6 +134,8 @@ launch path must keep that test red-first.
the same gates; CI runs on the org's billing (`.github/workflows/continuous.yml` on `main`
pushes; `release.yml` on version tags). The PR-only codebase-health check reports growth
past 2,000 lines as review guidance; it never blocks a merge.
+- PRs that change shipped paths need a `.changes/<branch-slug>.md` fragment (one user-facing
+ bullet; see `.changes/README.md`) or the `no-changelog` label; the changelog-fragment check enforces it.
- **Parity-diff evidence is a merge gate** (the port's definition, not optional polish): every PR
that touches a user-visible surface must include a "parity-diff evidence" section in its
description showing the TS-binary comparison for what it changed: (1) rendered output —