Skip to content

Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors

Rust

fix(changelog): stop entries landing in already-released sections

AkitaOnRailsec9bdaae15fd
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index bcd73d25..5940c538 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -145,7 +145,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+ with:
+ # `check-changelog-frozen.sh` diffs against the merge base, so it
+ # needs history rather than a shallow clone.
+ fetch-depth: 0
- run: scripts/check-changelog-sections.sh
+ - name: released sections stay frozen
+ run: scripts/check-changelog-frozen.sh "origin/${{ github.base_ref || github.event.repository.default_branch }}"
# End-to-end docker smoke: packages the release-build binary and confirms
# the image runs. Catches Dockerfile drift (missing COPY, bad ENTRYPOINT)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f7b79708..347341cb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,34 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
+### Fixed
+- CI now rejects a change that writes into an already-released CHANGELOG
+ section. `bin/release` renames `## [Unreleased]` to `## [X.Y.Z]`, so a branch
+ opened before a release carries a diff anchored at the old line numbers and
+ git merges it into whatever section now occupies them — silently, with no
+ conflict. Three entries landed in the wrong release this way (#491 into
+ 1.32.0, #502 into 1.32.2, #517 into 1.33.0), each claiming a fix shipped in a
+ version that did not contain it while the version that did listed nothing.
+ `scripts/check-changelog-frozen.sh` compares a branch against its merge base
+ and fails on any touched line below `[Unreleased]`.
+- The `ingest (server, this process)` counters in `ai-memory status` now move
+ for events delivered over `POST /hook/batch`. They were instrumented only in
+ the per-event `POST /hook` handler, while the spool drain posts batches and
+ falls back to `/hook` only against a pre-upgrade server, so a current client
+ against a current server left the whole section reading `accepted 0`,
+ `last write: -` and zero sheds while observations were landing normally — the
+ section exists precisely to tell "hooks are not arriving" apart from "hooks
+ are arriving but nothing is stored", and it reported the same thing for both.
+ A batch 429 also now counts every item it rejects, not just the one that
+ found no permit, so shed volume is comparable between the two routes instead
+ of understated by up to the batch size (#516).
+- `last write` in the same section now advances only when an event actually
+ cleared the writer. `handle_hook` stamped it unconditionally after processing
+ returned, and processing swallows its errors, so a store rejecting every
+ event — read-only database, exhausted disk, a failed migration — still
+ reported a fresh write time and looked healthy (#516).
+
+
## [1.33.0] - 2026-08-28
### Added
@@ -38,23 +66,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
HTTP 400 and disappear from memory while ASCII events still worked. A native
Windows loopback test now round-trips Chinese and Portuguese text byte for
byte (#500).
-- The `ingest (server, this process)` counters in `ai-memory status` now move
- for events delivered over `POST /hook/batch`. They were instrumented only in
- the per-event `POST /hook` handler, while the spool drain posts batches and
- falls back to `/hook` only against a pre-upgrade server, so a current client
- against a current server left the whole section reading `accepted 0`,
- `last write: -` and zero sheds while observations were landing normally — the
- section exists precisely to tell "hooks are not arriving" apart from "hooks
- are arriving but nothing is stored", and it reported the same thing for both.
- A batch 429 also now counts every item it rejects, not just the one that
- found no permit, so shed volume is comparable between the two routes instead
- of understated by up to the batch size (#516).
-- `last write` in the same section now advances only when an event actually
- cleared the writer. `handle_hook` stamped it unconditionally after processing
- returned, and processing swallows its errors, so a store rejecting every
- event — read-only database, exhausted disk, a failed migration — still
- reported a fresh write time and looked healthy (#516).
-
## [1.32.2] - 2026-08-26
### Fixed
diff --git a/scripts/check-changelog-frozen.sh b/scripts/check-changelog-frozen.sh
new file mode 100755
index 00000000..7af0ecb3
--- /dev/null
+++ b/scripts/check-changelog-frozen.sh
@@ -0,0 +1,78 @@
+#!/usr/bin/env bash
+# Fail if a change adds or edits entries inside an already-released
+# CHANGELOG section.
+#
+# `bin/release` renames `## [Unreleased]` to `## [X.Y.Z]`. A branch opened
+# before that release still carries a CHANGELOG diff anchored at the old
+# `[Unreleased]` line numbers, and git merges it into whatever section now
+# occupies them — no conflict, no warning. The entry then claims a change
+# shipped in a release that did not contain it, and the release that *did*
+# ship it lists nothing.
+#
+# Three times in one week: #491 into [1.32.0], #502 into [1.32.2], #517 into
+# [1.33.0]. Each found by hand, twice only because an unrelated merge
+# conflict forced someone to look at the file.
+#
+# Usage: check-changelog-frozen.sh [base-ref] (default: origin/main)
+#
+# Compares the merge base of <base-ref> and HEAD against HEAD, and rejects
+# any changed CHANGELOG line that sits below the `## [Unreleased]` heading.
+# Deliberate historical corrections on the default branch are unaffected:
+# this asks what a branch changes relative to where it forked, not what the
+# file looks like versus a tag.
+
+set -euo pipefail
+
+REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
+cd "$REPO_ROOT"
+
+BASE_REF="${1:-origin/main}"
+git rev-parse --verify "$BASE_REF" >/dev/null 2>&1 || {
+ echo "check-changelog-frozen: base ref '$BASE_REF' not found; skipping."
+ exit 0
+}
+
+MERGE_BASE="$(git merge-base "$BASE_REF" HEAD)"
+if [[ "$MERGE_BASE" == "$(git rev-parse HEAD)" ]]; then
+ echo "check-changelog-frozen: HEAD is an ancestor of $BASE_REF; nothing to check."
+ exit 0
+fi
+
+# First line number of the first released section in the *new* file.
+FROZEN_FROM="$(awk '/^## \[[0-9]/{print NR; exit}' CHANGELOG.md)"
+if [[ -z "$FROZEN_FROM" ]]; then
+ echo "check-changelog-frozen: no released section yet."
+ exit 0
+fi
+
+# Every new-file line number this diff touches, via the unified hunk headers.
+TOUCHED="$(git diff --unified=0 "$MERGE_BASE" HEAD -- CHANGELOG.md \
+ | awk '/^@@/{ split($3, a, ","); start = a[1] + 0; if (start < 0) start = -start;
+ count = (a[2] == "" ? 1 : a[2] + 0);
+ for (i = 0; i < count; i++) print start + i }')"
+
+BAD=""
+for ln in $TOUCHED; do
+ if (( ln >= FROZEN_FROM )); then
+ BAD+=" line $ln: $(sed -n "${ln}p" CHANGELOG.md)"$'\n'
+ fi
+done
+
+if [[ -z "$BAD" ]]; then
+ echo "CHANGELOG: no released section was modified."
+ exit 0
+fi
+
+echo "error: this change modifies an already-released CHANGELOG section." >&2
+echo >&2
+printf '%s' "$BAD" >&2
+cat >&2 <<'EOF'
+
+Released sections are frozen. An entry for unreleased work belongs under
+`## [Unreleased]`.
+
+This usually means the branch was opened before a release was cut, and git
+merged the entry into the section that now occupies those lines. Move it up
+to `[Unreleased]`; the content does not change, only the section.
+EOF
+exit 1