~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.
Python academiaanthropicarxivbravedeep-researchencryptionhome-automationhomeserverlocallocal-deep-researchlocal-llmmistralollamaopenaipubmedresearchresearch-toolretrieval-augmented-generationsearxngself-hosted
fix(release): preserve complete oversized notes (#6927)
LearningCircuitf30213eebb7d
diff --git a/.github/scripts/shorten_release_notes.py b/.github/scripts/shorten_release_notes.pynew file mode 100644index 0000000000..affa1fac2b--- /dev/null+++ b/.github/scripts/shorten_release_notes.py@@ -0,0 +1,79 @@+"""Keep oversized GitHub Release bodies readable and lossless.++The complete composed body is uploaded as a Release asset when GitHub's body+limit would otherwise cut the hand-written changelog or generated PR list.+"""++from __future__ import annotations++import argparse+from pathlib import Path+from urllib.parse import quote+++MAX_BODY_CHARS = 124_400 # Leave room below GitHub's 125,000-char limit.+++def shorten_release_notes(+ body_file: Path,+ full_asset_file: Path,+ release_tag: str,+ repository: str,+) -> bool:+ """Shorten an oversized body and save its exact original as an asset.++ Returns whether an asset was written. A body within the limit is untouched.+ """+ body = body_file.read_text(encoding="utf-8")+ if len(body) <= MAX_BODY_CHARS:+ return False+ if body_file.resolve() == full_asset_file.resolve():+ raise ValueError("The full-notes asset must differ from the body file")++ asset_url = (+ f"https://github.com/{repository}/releases/download/"+ f"{quote(release_tag, safe='')}/{quote(full_asset_file.name, safe='')}"+ )+ header = f"**Complete release notes:** [Download the full text]({asset_url}).\n\n"+ marker = (+ "\n\n_Release body shortened to fit GitHub's size limit. "+ f"[Download all notes and the PR list]({asset_url})._\n"+ )+ excerpt_limit = MAX_BODY_CHARS - len(header) - len(marker)+ if excerpt_limit <= 0:+ raise ValueError("Release-note asset link exceeds the body budget")++ # Prefer a paragraph boundary so the published body does not end midway+ # through a changelog item. An unusually long single paragraph still has+ # to be cut, but its complete form remains in the attached asset.+ boundary = body.rfind("\n\n", 0, excerpt_limit)+ if boundary < excerpt_limit // 2:+ boundary = excerpt_limit+ excerpt = body[:boundary].rstrip()+ shortened = header + excerpt + marker+ if len(shortened) > MAX_BODY_CHARS:+ raise ValueError("Shortened release body still exceeds its limit")++ full_asset_file.write_text(body, encoding="utf-8")+ body_file.write_text(shortened, encoding="utf-8")+ return True+++def main() -> None:+ parser = argparse.ArgumentParser(description=__doc__)+ parser.add_argument("body_file", type=Path)+ parser.add_argument("full_asset_file", type=Path)+ parser.add_argument("release_tag")+ parser.add_argument("repository")+ args = parser.parse_args()+ if shorten_release_notes(+ args.body_file,+ args.full_asset_file,+ args.release_tag,+ args.repository,+ ):+ print(f"Attached complete release text as {args.full_asset_file.name}")+++if __name__ == "__main__":+ main()diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex 152de21b64..301aed9799 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -701,6 +701,7 @@ jobs:docs/release_notes/changelog.d/pyproject.toml+ .github/scripts/shorten_release_notes.pysparse-checkout-cone-mode: falsefetch-depth: 1persist-credentials: false@@ -1298,22 +1299,19 @@ jobs:printf '%s\n' "$AUTO_BODY"} > "$NOTES_FILE"- # GitHub release body limit is 125,000 chars — the API rejects- # longer bodies with HTTP 422 and gh CLI does not pre-validate.- # Truncate from the tail (the auto PR list is the largest variable- # section in big releases) with a visible marker. Character-aware- # truncation (Python) — see diff section above.- python3 - "$NOTES_FILE" 124400 "[notes truncated to fit GitHub's 125,000-char body limit]" <<'PYEOF'- import sys- path, max_chars, marker = sys.argv[1], int(sys.argv[2]), sys.argv[3]- with open(path, encoding='utf-8', errors='replace') as f:- content = f.read()- if len(content) > max_chars:- content = content[:max_chars] + f"\n\n_{marker}_\n"- with open(path, 'w', encoding='utf-8') as f:- f.write(content)- print(f"Release body truncated to {len(content)} chars", file=sys.stderr)- PYEOF+ # The v2.0.0 hand-written changelog alone exceeds GitHub's+ # 125,000-character body limit. Preserve the exact composed body+ # (including the generated PR list) as a release asset and put a+ # prominent link in the shortened body. Smaller releases are+ # unchanged and do not receive the extra asset.+ FULL_NOTES_ASSET="release-notes-full.md"+ python3 .github/scripts/shorten_release_notes.py \+ "$NOTES_FILE" "$FULL_NOTES_ASSET" \+ "$RELEASE_TAG" "$GITHUB_REPOSITORY"+ FULL_NOTES_ASSETS=()+ if [[ -f "$FULL_NOTES_ASSET" ]]; then+ FULL_NOTES_ASSETS+=("$FULL_NOTES_ASSET")+ fi# Includes filesystem SBOM (Trivy scan of source tree) AND# container-image SBOM (Syft scan of built image layers, per-arch),@@ -1345,6 +1343,7 @@ jobs:sbom-cyclonedx.json \sbom-cyclonedx.json.bundle \provenance.intoto.jsonl \+ "${FULL_NOTES_ASSETS[@]}" \"${CONTAINER_SBOMS[@]}"env:# PAT_TOKEN is required here because GITHUB_TOKEN cannot triggerdiff --git a/docs/RELEASE_GUIDE.md b/docs/RELEASE_GUIDE.mdindex 1be801446d..31e8f6c6ee 100644--- a/docs/RELEASE_GUIDE.md+++ b/docs/RELEASE_GUIDE.md@@ -39,6 +39,10 @@ and short-circuits everything downstream).merging the bump.3. **Auto-generated PR list** from GitHub's generate-notes API,label-categorized.+- **Large release notes**: GitHub accepts at most 125,000 characters in a+ release body. If the composed notes exceed that limit, the workflow attaches+ the exact complete text as `release-notes-full.md` and links it prominently+ from the shortened body. Smaller release bodies are left unchanged.- **No duplicates**: If a release for `v<version>` already exists, the`version-check` job sets `should_release=false` and every downstreamjob (security gate, CI gate, build, publish) is skipped.diff --git a/tests/ci/test_shorten_release_notes.py b/tests/ci/test_shorten_release_notes.pynew file mode 100644index 0000000000..66f8ef47c5--- /dev/null+++ b/tests/ci/test_shorten_release_notes.py@@ -0,0 +1,68 @@+"""Verify that an oversized release retains its complete published text."""++import subprocess+import sys+from pathlib import Path+++SCRIPT = (+ Path(__file__).resolve().parents[2]+ / ".github/scripts/shorten_release_notes.py"+)+ASSET_URL = (+ "https://github.com/LearningCircuit/local-deep-research/"+ "releases/download/v2.0.0/release-notes-full.md"+)+++def _prepare(body: Path, asset: Path) -> None:+ subprocess.run(+ [+ sys.executable,+ str(SCRIPT),+ str(body),+ str(asset),+ "v2.0.0",+ "LearningCircuit/local-deep-research",+ ],+ check=True,+ capture_output=True,+ text=True,+ )+++def test_small_release_body_is_unchanged(tmp_path):+ body = tmp_path / "body.md"+ asset = tmp_path / "release-notes-full.md"+ content = "# Breaking Changes\n\n- A concise migration note.\n"+ body.write_text(content, encoding="utf-8")++ _prepare(body, asset)++ assert body.read_text(encoding="utf-8") == content+ assert not asset.exists()+++def test_oversized_release_links_exact_complete_body(tmp_path):+ body = tmp_path / "body.md"+ asset = tmp_path / "release-notes-full.md"+ content = (+ "# 💥 Breaking Changes\n\n"+ + "- A complete migration paragraph with accented text: café.\n\n"+ * 3_000+ + "# What's Changed\n\n- The final PR still appears in the asset.\n"+ )+ body.write_text(content, encoding="utf-8")++ _prepare(body, asset)++ published = body.read_text(encoding="utf-8")+ assert asset.read_text(encoding="utf-8") == content+ assert len(published) <= 124_400+ assert published.startswith(+ f"**Complete release notes:** [Download the full text]({ASSET_URL})."+ )+ assert "[Download all notes and the PR list]" in published+ assert published.count(ASSET_URL) == 2+ assert "The final PR still appears in the asset" not in published+ assert published.endswith(f"({ASSET_URL})._\n")