Skip to content

Your lightweight open-source personal agent.

fix(release): verify final candidates and refresh SVG parser

Xubin Ren19c18aaafd86
diff --git a/.github/workflows/release-candidate.yml b/.github/workflows/release-candidate.yml
index a9b3d6d75..b6e6f6e4b 100644
--- a/.github/workflows/release-candidate.yml
+++ b/.github/workflows/release-candidate.yml
@@ -5,9 +5,17 @@ on:
workflow_dispatch:
inputs:
next_stable:
- description: Next stable base (for example 0.3.6); must not have a stable tag
+ description: Stable version/base (for example 0.4.0); must not have a stable tag
required: true
type: string
+ channel:
+ description: Preview makes a version-only commit; stable keeps the ref's exact final version
+ required: true
+ default: preview
+ type: choice
+ options:
+ - preview
+ - stable
retain_installable:
description: Retain this exact installable candidate and source for 1 day (~400 MB); not publication
required: false
@@ -35,6 +43,7 @@ jobs:
SOURCE_COMMIT: ${{ github.sha }}
NEXT_STABLE: ${{ inputs.next_stable }}
PREVIEW_SEQUENCE: ${{ github.run_number }}
+ CANDIDATE_CHANNEL: ${{ inputs.channel }}
steps:
- name: Set candidate directory
@@ -63,10 +72,21 @@ jobs:
- name: Prepare an exact, separate candidate
run: |
- python -m scripts.release_candidate prepare \
- --source-commit "$SOURCE_COMMIT" --base "$NEXT_STABLE" \
- --sequence "$PREVIEW_SEQUENCE" --output "$CANDIDATE_DIR" \
- > "$RUNNER_TEMP/candidate.json"
+ case "$CANDIDATE_CHANNEL" in
+ stable)
+ python -m scripts.release_candidate prepare-stable \
+ --source-commit "$SOURCE_COMMIT" --version "$NEXT_STABLE" \
+ --output "$CANDIDATE_DIR" > "$RUNNER_TEMP/candidate.json"
+ ;;
+ preview)
+ python -m scripts.release_candidate prepare \
+ --source-commit "$SOURCE_COMMIT" --base "$NEXT_STABLE" \
+ --sequence "$PREVIEW_SEQUENCE" --output "$CANDIDATE_DIR" \
+ > "$RUNNER_TEMP/candidate.json"
+ ;;
+ *) exit 1 ;;
+ esac
+ python -c 'import json, os; print("CANDIDATE_VERSION=" + json.load(open(os.environ["RUNNER_TEMP"] + "/candidate.json"))["version"])' >> "$GITHUB_ENV"
- name: Verify packaging and selection contracts
working-directory: ${{ env.CANDIDATE_DIR }}
@@ -120,7 +140,7 @@ jobs:
- name: Assemble and verify the complete candidate
working-directory: ${{ env.CANDIDATE_DIR }}
run: |
- version="${NEXT_STABLE}.dev${PREVIEW_SEQUENCE}"
+ version="$CANDIDATE_VERSION"
python -m scripts.release_candidate assemble --source-commit "$SOURCE_COMMIT" \
--wheel "$RUNNER_TEMP/python-dist/nanobot_ai-${version}-py3-none-any.whl" \
--sdist "$RUNNER_TEMP/python-dist/nanobot_ai-${version}.tar.gz" \
diff --git a/docs/releases/0.4.0.md b/docs/releases/0.4.0.md
index 8e1198238..0c502832a 100644
--- a/docs/releases/0.4.0.md
+++ b/docs/releases/0.4.0.md
@@ -26,6 +26,7 @@ The gateway now owns model history and WebUI display history in SQLite. Existing
### Terminal, models and integrations
- Native terminal packages include Mermaid image rendering and smaller standalone builds with target-specific native dependencies. Platform wheels include the matching TUI and built WebUI; supported wheel installations do not need Bun or a first-launch TUI download.
+- The TUI SVG parser is updated to the maintained `@xmldom/xmldom` 0.8.15 patch release. Restricted image rendering and isolated rendering workers remain in place.
- Model setup includes searchable providers, explicit API choices and per-preset request overrides. Shared proxy settings can be selected independently by supported providers, web tools and MCP connections.
- Native Linear and WhatsApp Agent Platform channels, QQ QR setup, DeepSeek Search, and further provider/channel compatibility improvements are included.
- Scheduled jobs can be updated, enabled and disabled in place, and their recent run history can be inspected. Restart and delivery fixes preserve pending work without treating an unknown delivery result as permission to replay it.
@@ -58,7 +59,7 @@ Preview remains off by default. Selecting a channel is not permission to install
## Release scope and remaining checks
-These notes describe the current preparation base, not open PRs or a promise that all known issues are fixed. In particular, preventing new `/goal` event-sequence collisions does not repair already conflicting legacy history. The separate Dock window-reuse work is not included in this preparation base. Reconcile these limitations with the final merged range before publishing.
+These notes describe the current preparation base, not open PRs or a promise that all known issues are fixed. In particular, preventing new `/goal` event-sequence collisions does not repair already conflicting legacy history. The separate Dock window-reuse and retry-redesign work is not included in this release scope. Reconcile these limitations with the final merged range before publishing.
The release PR tracks the final CI/review, package hashes, native installation and upgrade/recovery matrix, historical-baseline coverage, source-offer commitment and documentation handoff. The [release checklist](../releasing.md) remains authoritative. Merge preparation before creating a tag, then compare the merged sources with the accepted candidate and reverify any changes. Tag that exact verified commit, not a later untested `main` tip. No tag, GitHub Release, PyPI upload, signing switch, update-feed advancement or website deployment is performed by this preparation PR.
diff --git a/docs/releasing.md b/docs/releasing.md
index 64e75c528..dc723072d 100644
--- a/docs/releasing.md
+++ b/docs/releasing.md
@@ -103,6 +103,8 @@ PyPI receives **five platform wheels and one sdist**, not the intermediate unive
Final releases also require `release-manifest.json` for `stable`. Run `scripts.release_candidate assemble` as shown below from the clean final-version checkout, using that final commit as `--source-commit` without Preview preparation. GitHub receives the same wheels/sdist, ten archive/checksum files and manifest; PyPI receives only wheels/sdist. Verify final source and public bytes before catalogue advancement. A TUI-only GitHub Release cannot deliver the final release to Preview subscribers.
+For the same-build Linux and Windows candidate acceptance, run **Verify Release Candidate** at the exact final-version ref with `channel=stable`, `next_stable` equal to that declared version and `retain_installable=true`. Stable preparation copies the exact commit without changing version declarations or creating a Preview commit; it rejects mismatched versions and existing stable tags. The default `channel=preview` retains the version-only Preview preparation. Both modes are read-only preparation, require **Candidate required** and retain accepted files for one day; neither publishes a tag, release, PyPI package or feed. Download and independently preserve the accepted handoff before expiry, then complete native macOS and historical-owner acceptance against that same manifest.
+
## Publish, with maintainer approval
### Release approval proof
diff --git a/scripts/release_candidate.py b/scripts/release_candidate.py
index b30b4485d..38a1666ad 100644
--- a/scripts/release_candidate.py
+++ b/scripts/release_candidate.py
@@ -106,6 +106,32 @@ def prepare_preview(root: Path, output: Path, *, source_commit: str, base: str,
"candidate_commit": _git(output, "rev-parse", "HEAD")}
+def prepare_stable(root: Path, output: Path, *, source_commit: str, version: str) -> dict[str, str]:
+ """Copy an already versioned final commit without relabelling Preview bytes."""
+ source_commit = _commit(source_commit)
+ release_version(version)
+ parsed = Version(version)
+ if parsed.is_prerelease or parsed.is_postrelease:
+ raise ValueError("Stable preparation requires a final version")
+ root, output = root.resolve(), output.resolve()
+ if output.exists() or output == root or root in output.parents:
+ raise ValueError("Candidate output must be a new directory outside the source checkout")
+ if _git(root, "rev-parse", f"{source_commit}^{{commit}}") != source_commit:
+ raise ValueError("Source commit is not available in this repository")
+ original = {name: _git(root, "show", f"{source_commit}:{name}", trim=False) for name in VERSION_FILES}
+ if tomllib.loads(original["pyproject.toml"])["project"]["version"] != version:
+ raise ValueError("Stable source must already declare the requested final version")
+ if _version_changes(original["pyproject.toml"], original["nanobot/__init__.py"], version) != original:
+ raise ValueError("Stable version declarations need maintainer review")
+ if _git(root, "tag", "--list", f"v{version}"):
+ raise ValueError("Stable preparation must not reuse an existing stable tag")
+ _git(root, "clone", "--shared", "--no-checkout", "-c", "core.autocrlf=false", str(root), str(output))
+ hooks = output / ".git" / "candidate-hooks"
+ hooks.mkdir()
+ _git(output, "-c", f"core.hooksPath={hooks}", "checkout", "--detach", source_commit)
+ return {"version": version, "source_commit": source_commit, "candidate_commit": source_commit}
+
+
def _candidate_identity(root: Path, source_commit: str) -> tuple[str, str, str]:
_commit(source_commit)
candidate_commit = _git(root, "rev-parse", "HEAD")
@@ -322,6 +348,10 @@ def main() -> None:
prepare.add_argument("--base", required=True)
prepare.add_argument("--sequence", type=int, required=True)
prepare.add_argument("--output", type=Path, required=True)
+ stable = commands.add_parser("prepare-stable")
+ stable.add_argument("--source-commit", required=True)
+ stable.add_argument("--version", required=True)
+ stable.add_argument("--output", type=Path, required=True)
verify = commands.add_parser("verify")
verify.add_argument("--source-commit", required=True)
verify.add_argument("--artifacts", type=Path, required=True)
@@ -343,6 +373,9 @@ def main() -> None:
if args.command == "prepare":
print(json.dumps(prepare_preview(args.root, args.output, source_commit=args.source_commit,
base=args.base, sequence=args.sequence)))
+ elif args.command == "prepare-stable":
+ print(json.dumps(prepare_stable(args.root, args.output, source_commit=args.source_commit,
+ version=args.version)))
elif args.command == "verify":
manifest = verify_candidate(args.root, args.artifacts, source_commit=args.source_commit)
write_manifest(manifest, args.artifacts / "release-manifest.json")
diff --git a/tests/test_release_candidate.py b/tests/test_release_candidate.py
index 865cd7126..5fee64bcf 100644
--- a/tests/test_release_candidate.py
+++ b/tests/test_release_candidate.py
@@ -10,6 +10,7 @@ from scripts.release_candidate import (
_candidate_identity,
_source_payload,
prepare_preview,
+ prepare_stable,
preview_version,
)
@@ -64,6 +65,31 @@ def test_dirty_source_is_not_accidentally_included_in_candidate(tmp_path, source
assert (root / "nanobot/__init__.py").read_text() == "uncommitted work"
+def test_stable_preparation_preserves_exact_source_and_ignores_local_changes(tmp_path, source):
+ root, commit = source
+ (root / "nanobot/__init__.py").write_text("uncommitted work")
+ target = tmp_path / "stable"
+ result = prepare_stable(root, target, source_commit=commit, version="0.3.5")
+ assert result == {"version": "0.3.5", "source_commit": commit, "candidate_commit": commit}
+ assert git(target, "rev-parse", "HEAD") == commit
+ assert git(target, "status", "--porcelain") == ""
+ assert _candidate_identity(target, commit) == ("0.3.5", ">=3.11", commit)
+ assert (root / "nanobot/__init__.py").read_text() == "uncommitted work"
+
+
+def test_stable_preparation_refuses_version_mismatch_and_published_identity(tmp_path, source):
+ root, commit = source
+ target = tmp_path / "stable"
+ with pytest.raises(ValueError, match="already declare"):
+ prepare_stable(root, target, source_commit=commit, version="0.4.0")
+ with pytest.raises(ValueError, match="final version"):
+ prepare_stable(root, target, source_commit=commit, version="0.4.0.dev1")
+ git(root, "tag", "v0.3.5")
+ with pytest.raises(ValueError, match="existing stable tag"):
+ prepare_stable(root, target, source_commit=commit, version="0.3.5")
+ assert not target.exists()
+
+
def test_refuses_existing_output_and_published_stable_base(tmp_path, source):
root, commit = source
with pytest.raises(ValueError, match="new directory"):
diff --git a/tui/bun.lock b/tui/bun.lock
index 8304ef3fb..64c872a39 100644
--- a/tui/bun.lock
+++ b/tui/bun.lock
@@ -7,7 +7,7 @@
"dependencies": {
"@opentui/core": "0.5.11",
"@resvg/resvg-js": "2.6.2",
- "@xmldom/xmldom": "0.8.11",
+ "@xmldom/xmldom": "0.8.15",
"css-tree": "3.2.1",
"fontkit": "2.0.4",
"pele": "1.9.0",
@@ -75,7 +75,7 @@
"@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~8.3.0" } }, "sha512-5IviulTZeRNp2vAJ514cc/HUlY5nZ9fCbq9DMyC52BrhFZACo3nI0R7qBxhQmo/d27NFe96ur/b7Wwxklda+kg=="],
- "@xmldom/xmldom": ["@xmldom/[email protected]", "", {}, "sha512-cQzWCtO6C8TQiYl1ruKNn2U6Ao4o4WBBcbL61yJl84x+j5sOWWFU9X7DpND8XZG3daDppSsigMdfAIl2upQBRw=="],
+ "@xmldom/xmldom": ["@xmldom/[email protected]", "", {}, "sha512-/5NV/vDALVFDXgLmfsy9TRCBlKwO2LNBFzpzvb9iIj+jR+eSc6DLYYvVOdivT/jm7MtU6TebYuRmzEOI7w40UA=="],
"ansi-regex": ["[email protected]", "", {}, "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg=="],
diff --git a/tui/package.json b/tui/package.json
index a9590d3ed..0bd36c20b 100644
--- a/tui/package.json
+++ b/tui/package.json
@@ -14,7 +14,7 @@
"dependencies": {
"@opentui/core": "0.5.11",
"@resvg/resvg-js": "2.6.2",
- "@xmldom/xmldom": "0.8.11",
+ "@xmldom/xmldom": "0.8.15",
"css-tree": "3.2.1",
"fontkit": "2.0.4",
"pele": "1.9.0"