Skip to content

The agent that grows with you

feat(releases): link build pages to GitHub and show bundle overrides

ethernetfbec127a597d
diff --git a/.github/workflows/desktop-bundled-release.yml b/.github/workflows/desktop-bundled-release.yml
index 57033254a0b..4d09b21e3e4 100644
--- a/.github/workflows/desktop-bundled-release.yml
+++ b/.github/workflows/desktop-bundled-release.yml
@@ -1528,6 +1528,7 @@ jobs:
ref: ${{ needs.validate.outputs.sha }}
- name: Render the full expected-binary matrix
env:
+ HERMES_BUNDLE_ENV_JSON: ${{ inputs.bundle_env }}
CLOUDFLARE_R2_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_R2_ACCOUNT_ID }}
CLOUDFLARE_R2_ACCESS_KEY_ID: ${{ secrets.CLOUDFLARE_R2_ACCESS_KEY_ID }}
CLOUDFLARE_R2_SECRET_ACCESS_KEY: ${{ secrets.CLOUDFLARE_R2_SECRET_ACCESS_KEY }}
@@ -1549,7 +1550,7 @@ jobs:
PY
)
python3 scripts/render-builds-table.py \
- --summary-commit "$RELEASE_COMMIT" \
+ --summary-commit "$RELEASE_COMMIT" --repo "$GITHUB_REPOSITORY" \
--summary-out "$GITHUB_STEP_SUMMARY" \
--summary-failed-legs "$failed" --run-url "$RUN_URL"
diff --git a/docs/stable-releases.md b/docs/stable-releases.md
index 25c5b956f61..a364d94e38b 100644
--- a/docs/stable-releases.md
+++ b/docs/stable-releases.md
@@ -100,7 +100,12 @@ commit summary runs even when a build or assembly job fails; it lists only
receipt-backed existing downloads and marks missing binaries as not built.
Missing binaries link to the workflow run under **View build run**, not to
nonexistent downloads. Disabled platforms have no download or failure link.
-Page publication still requires working R2 access.
+Page publication still requires working R2 access. The commit links to its source
+on GitHub; tag and channel pages link to the corresponding GitHub release tag.
+Commit pages also list explicit non-secret `--bundle-env` defaults and
+`--bundle-unset` clears passed to the desktop bundles, not the CI environment.
+Values are shown as JSON strings (including `""` for an empty value); clears are
+labeled **Unset**. The section is omitted when no overrides were supplied.
Tagged builds also publish a per-tag diagnostic page at
`releases/tag/<tag>/index.html` after build or feed failures, including when no
diff --git a/scripts/render-builds-table.py b/scripts/render-builds-table.py
index ce28bc1c63f..9b530ab294d 100644
--- a/scripts/render-builds-table.py
+++ b/scripts/render-builds-table.py
@@ -48,6 +48,7 @@ import subprocess
import sys
import tempfile
from pathlib import Path
+from urllib.parse import quote
# Direct-script invocation starts with scripts/, not the repository root.
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
@@ -56,6 +57,7 @@ from scripts.releases import handoff, r2, semver # noqa: E402
MARKER = "<!-- HERMES_BUILDS_TABLE -->"
END_MARKER = "<!-- /HERMES_BUILDS_TABLE -->"
+DEFAULT_REPO = "NousResearch/hermes-agent"
# Asset name shapes (electron-builder artifactName in
# apps/desktop/electron-builder.config.cjs):
@@ -340,7 +342,7 @@ _PAGE_STYLE = (
"h1{font-size:1.4rem}h2{font-size:1.05rem;margin-top:1.75rem}"
"p{color:#444}table{border-collapse:collapse;width:100%}"
"th,td{text-align:left;padding:.45rem .6rem;border-bottom:1px solid #dcdcdc}"
- "th{font-weight:600}a{color:#0a58ca}code{font-size:.95em}"
+ "th{font-weight:600}a{color:#0a58ca}code{font-size:.95em;white-space:pre-wrap;overflow-wrap:anywhere}"
)
# The record a channel page keeps of the release it describes; the write
@@ -371,12 +373,13 @@ def _link(url: str) -> str:
def render_page(tag: str, assets_by_app: dict, base_url: str,
incomplete_jobs: list[str] | None = None,
- run_url: str | None = None) -> str:
+ run_url: str | None = None, *, repo: str = DEFAULT_REPO) -> str:
"""The tag/channel page: the release-body download table as HTML."""
channel = r2.channel_for_tag(tag)
+ tag_url = f"https://github.com/{quote(repo, safe='/')}/releases/tag/{quote(tag, safe='')}"
body = [
f"<h1>Hermes Desktop {channel} builds</h1>",
- f"<p>Release <code>{html.escape(tag)}</code>. Only objects this release "
+ f"<p>Release {_link(tag_url)}<code>{html.escape(tag)}</code></a>. Only objects this release "
"actually staged in the bucket are listed.</p>",
]
if incomplete_jobs:
@@ -406,19 +409,34 @@ def render_page(tag: str, assets_by_app: dict, base_url: str,
def render_commit_page(commit: str, names: list[str], base_url: str,
receipts: dict[str, dict | None],
failed_legs: list[str] | None = None,
- run_url: str | None = None) -> str:
+ run_url: str | None = None, *, repo: str = DEFAULT_REPO,
+ bundle_env: dict[str, str | None] | None = None) -> str:
"""The commit-build page: every expected binary, built or not."""
_validated_commit_inputs(commit, receipts)
+ commit_url = f"https://github.com/{quote(repo, safe='/')}/commit/{commit}"
rows = []
for label, status, url, link_text in commit_entries(commit, names, base_url, receipts, failed_legs, run_url):
cell = (f"{_link(url)}{html.escape(link_text)}</a>" if url and link_text else "—")
rows.append([html.escape(label), html.escape(status), cell])
body = [
f"<h1>Hermes commit build <code>{html.escape(commit[:12])}</code></h1>",
- f"<p>Commit <code>{html.escape(commit)}</code>. Every expected binary is listed; "
+ f"<p>Commit {_link(commit_url)}<code>{html.escape(commit)}</code></a>. Every expected binary is listed; "
"built rows link to downloads; incomplete rows link to the build run when available.</p>",
*_table(("Binary", "Status", "Download / diagnostics"), rows),
]
+ if bundle_env:
+ from scripts.releases.bundle_env import validate
+
+ body.extend([
+ "<h2>Bundle environment</h2>",
+ "<p>Explicit non-secret desktop bundle overrides only. Runtime values override defaults; "
+ "Unset always removes the variable. String values use JSON notation.</p>",
+ *_table(("Variable", "Value / action"), [
+ [f"<code>{html.escape(key)}</code>", "Unset" if value is None else
+ f"<code>{html.escape(json.dumps(value, ensure_ascii=False))}</code>"]
+ for key, value in sorted(validate(bundle_env).items())
+ ]),
+ ])
return _page(f"Hermes commit build {commit[:12]}", commit, body)
@@ -474,13 +492,14 @@ def existing_page(key: str) -> str | None:
raise
-def write_channel_page(tag: str, assets_by_app: dict, base_url: str) -> str | None:
+def write_channel_page(tag: str, assets_by_app: dict, base_url: str,
+ *, repo: str = DEFAULT_REPO) -> str | None:
"""Publish releases/<channel>/index.html for the tag's own channel."""
key = r2.channel_page_key_for(r2.channel_for_tag(tag))
if not supersedes(existing_page(key), tag):
print(f"::warning::{key} already describes a newer release; leaving it unchanged")
return None
- return write_page(key, render_page(tag, assets_by_app, base_url), base_url)
+ return write_page(key, render_page(tag, assets_by_app, base_url, repo=repo), base_url)
def r2_object_names_under(prefix: str) -> list[str]:
@@ -517,7 +536,9 @@ def main() -> int:
parser.add_argument("--summary-failed-legs", default="",
help="With --summary-commit: comma-separated failed job names, "
"blamed on the Not built rows")
- parser.add_argument("--repo", default="NousResearch/hermes-agent")
+ parser.add_argument("--repo", default=DEFAULT_REPO)
+ parser.add_argument("--bundle-env-json", default=os.environ.get("HERMES_BUNDLE_ENV_JSON", ""),
+ help="Explicit non-secret commit desktop bundle overrides, not the CI environment")
parser.add_argument("--run-url", default=None,
help="Actual workflow run URL for incomplete-build diagnostics")
parser.add_argument("--r2-base-url", default=os.environ.get("CLOUDFLARE_R2_PUBLIC_URL"),
@@ -543,6 +564,9 @@ def main() -> int:
return 1
commit = args.summary_commit
try:
+ from scripts.releases.bundle_env import decode
+
+ bundle_env = decode(args.bundle_env_json)
prefix = r2.commit_prefix_for(commit)
except ValueError as err:
print(f"::error::{err}")
@@ -555,7 +579,8 @@ def main() -> int:
with open(args.summary_out, "a", encoding="utf-8") as out:
out.write(block)
write_page(r2.commit_page_key_for(commit),
- render_commit_page(commit, names, args.r2_base_url, receipts, failed_legs, args.run_url),
+ render_commit_page(commit, names, args.r2_base_url, receipts, failed_legs, args.run_url,
+ repo=args.repo, bundle_env=bundle_env),
args.r2_base_url)
built = sum(1 for row in commit_expected_rows(names, receipts) if row["state"] == "built")
print(f"✓ Commit summary appended to {args.summary_out} ({built}/{len(_COMMIT_EXPECTED)} binaries built)")
@@ -581,7 +606,8 @@ def main() -> int:
# consumed by source updates. Missing artifacts never become downloads.
if not args.dry_run:
write_page(r2.staging_key_for(args.tag, "index.html"),
- render_page(args.tag, assets, args.r2_base_url, incomplete, args.run_url), args.r2_base_url)
+ render_page(args.tag, assets, args.r2_base_url, incomplete, args.run_url,
+ repo=args.repo), args.r2_base_url)
# Keep the per-tag diagnostic page even when GitHub cannot supply a draft.
view = subprocess.run(
@@ -595,7 +621,7 @@ def main() -> int:
release = json.loads(view.stdout)
body = release.get("body") or ""
if not args.pending_run_url and not args.dry_run and not incomplete and names:
- write_channel_page(args.tag, assets, args.r2_base_url)
+ write_channel_page(args.tag, assets, args.r2_base_url, repo=args.repo)
if MARKER not in body:
print("::warning::release body has no HERMES_BUILDS_TABLE marker; leaving it unchanged")
return 0
diff --git a/tests/ci/test_commit_build_staging.py b/tests/ci/test_commit_build_staging.py
index 589f4adacb2..540b40d71f5 100644
--- a/tests/ci/test_commit_build_staging.py
+++ b/tests/ci/test_commit_build_staging.py
@@ -1,4 +1,5 @@
"""Execute commit staging and summary steps against a disposable object store."""
+import html
import json
import os
from pathlib import Path
@@ -63,7 +64,10 @@ def test_failed_commit_summary_publishes_downloads_or_run_links(tmp_path, r2_ser
base = f'http://127.0.0.1:{r2_server.server_port}/hermes-releases'
summary = tmp_path / 'summary.md'
jobs = _workflow()['jobs']
+ bundle_env = {'HERMES_HOME': None, 'EMPTY': '', 'LABEL': '<script>\n"café" & value</script>'}
env = dict(HERMES_BUILD_COMMIT=sha, HERMES_PAYLOAD_TAG='', RELEASE_COMMIT=sha,
+ GITHUB_REPOSITORY='fixture-owner/fixture-repo',
+ HERMES_BUNDLE_ENV_JSON=json.dumps(bundle_env), CI_SECRET='must-not-appear',
RELEASE_PHASE='', TARGET='win32-x64', RUN_URL=run_url,
GITHUB_STEP_SUMMARY=str(summary), CLOUDFLARE_R2_PUBLIC_URL=base,
CLOUDFLARE_R2_ACCOUNT_ID='loopback', CLOUDFLARE_R2_ACCESS_KEY_ID='test-inert',
@@ -83,6 +87,11 @@ def test_failed_commit_summary_publishes_downloads_or_run_links(tmp_path, r2_ser
page_key = f'releases/commit/{sha}/index.html'
with urlopen(f'{base}/{page_key}', timeout=5) as response:
page = response.read().decode()
+ assert f'href="https://github.com/fixture-owner/fixture-repo/commit/{sha}"' in page
+ assert 'Bundle environment' in page and 'HERMES_HOME' in page and 'Unset' in page
+ assert '<code>EMPTY</code></td><td><code>&quot;&quot;</code>' in page
+ assert html.escape(json.dumps(bundle_env['LABEL'], ensure_ascii=False)) in page
+ assert '<script>' not in page and 'must-not-appear' not in page and 'CI_SECRET' not in page
links = re.findall(r'\]\((https?://[^)]+)\)', text)
assert run_url in links
assert text.count('✅ Built') == page.count('✅ Built') == int(has_download)
@@ -102,12 +111,14 @@ def test_failed_commit_summary_publishes_downloads_or_run_links(tmp_path, r2_ser
assert jobs[name]['strategy']['fail-fast'] is False
step = next(step for step in jobs['commit-builds-summary']['steps'] if 'run' in step)
assert step['env']['RUN_URL'] == '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}'
+ assert step['env']['HERMES_BUNDLE_ENV_JSON'] == '${{ inputs.bundle_env }}'
def test_commit_staging_and_summary_bind_every_produced_file_without_channels(tmp_path, r2_server):
sha = 'a' * 40
base = f'http://127.0.0.1:{r2_server.server_port}/hermes-releases'
env = dict(HERMES_BUILD_COMMIT=sha, HERMES_PAYLOAD_TAG='', RELEASE_COMMIT=sha,
+ GITHUB_REPOSITORY='o/r',
RELEASE_PHASE='', GITHUB_SHA='b' * 40, CLOUDFLARE_R2_PUBLIC_URL=base,
CLOUDFLARE_R2_ACCOUNT_ID='loopback', CLOUDFLARE_R2_ACCESS_KEY_ID='test-inert',
CLOUDFLARE_R2_SECRET_ACCESS_KEY='test-inert', CLOUDFLARE_R2_BUCKET='hermes-releases')
diff --git a/tests/ci/test_tag_builds_summary.py b/tests/ci/test_tag_builds_summary.py
index 0521b17f05c..05871c3f3cf 100644
--- a/tests/ci/test_tag_builds_summary.py
+++ b/tests/ci/test_tag_builds_summary.py
@@ -65,6 +65,7 @@ def test_admitted_failure_publishes_tag_info_without_promoting_channel(tmp_path,
key = f"releases/tag/{tag}/index.html"
assert key in r2_server.store, result.stdout + result.stderr
page = r2_server.store[key][0].decode()
+ assert f'href="https://github.com/o/r/releases/tag/{tag}"' in page
assert "Build incomplete" in page
assert "build-win32 (failure)" in page and "publish-win32-updater (skipped)" in page
assert "No downloadable artifacts" in page
diff --git a/tests/scripts/test_render_builds_table.py b/tests/scripts/test_render_builds_table.py
index 4798817ce1c..7de13f51cf2 100644
--- a/tests/scripts/test_render_builds_table.py
+++ b/tests/scripts/test_render_builds_table.py
@@ -267,6 +267,8 @@ class TestTagRunPublishesThePage:
# Canary tag → the canary channel page, as a full key (not a tag name).
assert key == "releases/canary/index.html" and key_is_full
assert rbt.recorded_build(page) == self.TAG
+ assert f'href="https://github.com/o/r/releases/tag/{self.TAG}"' in page
+ assert 'Bundle environment' not in page
for name in ("HermesBundled-0.28.0-canary.20260818101010-win-x64.msix",
"HermesBundled-0.28.0-canary.20260818101010-mac-arm64.dmg",
"HermesLight-0.28.0-canary.20260818101010-win-x64.msix"):
@@ -333,7 +335,8 @@ class TestTagRunPublishesThePage:
assert f"publish-win32-updater ({result})" in page
assert f"publish-win32-updater ({result})" in edits[0]
links = re.findall(r'href="([^"]+)"', page)
- assert links == ([f"{base}/{self.KEYS[0]}"] if asset_present else [])
+ assert links[0] == f"https://github.com/NousResearch/hermes-agent/releases/tag/{self.TAG}"
+ assert links[1:] == ([f"{base}/{self.KEYS[0]}"] if asset_present else [])
assert r2_server.store[channel_key][0] == previous
if not asset_present:
assert "No downloadable artifacts" in page
diff --git a/tests/scripts/test_render_builds_table_commit.py b/tests/scripts/test_render_builds_table_commit.py
index b601b4f329c..cc7fb380b38 100644
--- a/tests/scripts/test_render_builds_table_commit.py
+++ b/tests/scripts/test_render_builds_table_commit.py
@@ -275,8 +275,11 @@ def test_commit_page_lists_a_missing_binary_without_a_link():
page = rbt.render_commit_page(COMMIT, names, BASE, receipts, failed_legs=["build-darwin"])
assert page.count("<tr>") == len(rbt._COMMIT_EXPECTED) + len(rbt._COMMIT_DISABLED) + 1
assert "failed: build-darwin" in page
- # Only the one staged object was built, so it is the only anchor.
- assert page.count("<a href=") == 1
+ # Source navigation is separate from receipt-backed downloads.
+ assert re.findall(r'href="([^"]+)"', page) == [
+ f"https://github.com/NousResearch/hermes-agent/commit/{COMMIT}", f"{BASE}/{names[0]}",
+ ]
+ assert "Bundle environment" not in page
def test_commit_run_publishes_the_commit_page(tmp_path, monkeypatch, capsys):