Skip to content

The agent that grows with you

fix(release): say what each release command did and what to do next

etherneta9b931585bfe
diff --git a/scripts/release.py b/scripts/release.py
index eb79bb01df9..51e7b1b743a 100755
--- a/scripts/release.py
+++ b/scripts/release.py
@@ -2554,7 +2554,10 @@ def _resume_canary(tag: str, remote: str, repository: str, *, notes_file: Path |
return
if not dispatch_desktop_build(tag, repository):
raise SystemExit(1)
- print(f"✓ Resumed canary publication for {tag}.")
+ print(f"Resumed canary publication for {tag}.")
+ print(f"Workflow: https://github.com/{repository}/actions/workflows/desktop-bundled-release.yml")
+ print("Wait for that workflow to finish. It builds this canary and publishes the draft when the build is green.")
+ print(f"The draft is at https://github.com/{repository}/releases/tag/{tag}.")
def cmd_canary(args) -> None:
@@ -2692,7 +2695,8 @@ def prune_old_canaries(args) -> None:
else:
print(f"⚠ Could not delete {tag}: {result.stderr.strip()}")
if not args.publish:
- print("Dry run complete. To delete, add --publish")
+ print("Dry run complete. No release was deleted.")
+ print("Run the same command with --publish to delete the tags above.")
def main():
diff --git a/scripts/releases/channel_build.py b/scripts/releases/channel_build.py
index 1619ff97fd5..6fbfb55b535 100644
--- a/scripts/releases/channel_build.py
+++ b/scripts/releases/channel_build.py
@@ -179,6 +179,10 @@ def cmd_channel(args) -> None:
print(json.dumps(result, sort_keys=True, indent=2))
if not args.publish:
print("Dry run: no workflow was dispatched. Add --publish to dispatch.")
+ return
+ print(f"Channel build for {args.channel} started at commit {result['commit']}.")
+ print(f"Workflow: https://github.com/{repository}/actions/workflows/desktop-bundled-release.yml")
+ print("Wait for that workflow to finish. It builds this commit and moves the channel when every native smoke passes.")
return
publisher = configured_publisher(repository)
operations = {
@@ -193,10 +197,14 @@ def cmd_channel(args) -> None:
selected = next(key for key in operations if getattr(args, key, None))
result = operations[selected]()
print(json.dumps(result, sort_keys=True, indent=2))
- if not args.publish and selected != "channels":
- print(
- "Dry run: no R2 object or workflow was written. Add --publish to execute."
- )
+ if selected == "channels":
+ print("These are the channel records. This command did not change them.")
+ elif not args.publish:
+ print("Dry run: no R2 object was written. Add --publish to execute.")
+ elif selected == "retire_channel":
+ print(f"Retired {args.retire_channel}. New installs move to {args.to} at version {args.minimum_version} or newer.")
+ else:
+ print("Wrote the channel records. Check the JSON above for each record.")
except (OSError, ValueError, subprocess.SubprocessError, r2.R2RequestError) as exc:
raise SystemExit(f"release: channel operation refused: {exc}") from exc
diff --git a/scripts/releases/commit_build.py b/scripts/releases/commit_build.py
index 2cdeaedb79e..ab4226ba2f6 100644
--- a/scripts/releases/commit_build.py
+++ b/scripts/releases/commit_build.py
@@ -222,6 +222,9 @@ def cmd_build_commit(args) -> None:
result = subprocess.run(command, cwd=release.REPO_ROOT, capture_output=True, text=True, # windows-footgun: ok — encoding and replacement policy are on the next line.
encoding="utf-8", errors="replace", check=True, timeout=60)
print((result.stdout or "").strip() or f"Dispatched commit build {commit}. No release was created.")
+ print("Wait for that workflow to finish. It builds this commit and uploads the bundles.")
+ print(f"The builds page is {page}.")
+ print("This build does not publish a release and does not move a channel.")
except (OSError, ValueError, subprocess.SubprocessError) as exc:
stderr = ""
if isinstance(exc, subprocess.CalledProcessError):
diff --git a/scripts/releases/entrypoint.py b/scripts/releases/entrypoint.py
index 5975917cc53..0c6287062dd 100644
--- a/scripts/releases/entrypoint.py
+++ b/scripts/releases/entrypoint.py
@@ -143,10 +143,40 @@ def release(commit: str, *, bump: str, repo: Path, remote: str, repository: str,
"gh", "workflow", "run", WORKFLOW, "--ref", tag, "--repo", repository,
"--raw-field", f"tag={tag}",
])
+ found = execute([
+ "gh", "run", "list", "--repo", repository, "--workflow", WORKFLOW,
+ "--branch", tag, "--json", "databaseId,url,headBranch,status",
+ ])
except Exception as exc:
raise ReleaseRefused(f"release {tag} never started: {exc}") from exc
+ run_url = _dispatched_run(found, tag)
return {"version": version, "tag": tag, "commit": commit, "url": url,
- "autopublish": autopublish}
+ "final_url": f"https://github.com/{repository}/releases/tag/v{version}",
+ "run_url": run_url, "autopublish": autopublish}
+
+
+def _dispatched_run(raw: str, tag: str) -> str:
+ """The run URL for the claim ref. Empty when the list has no such run yet."""
+ try:
+ rows = json.loads(raw or "[]")
+ except json.JSONDecodeError:
+ return ""
+ matched = [row for row in rows if isinstance(row, dict) and row.get("headBranch") == tag and row.get("url")]
+ if len(matched) != 1:
+ return ""
+ return str(matched[0]["url"])
+
+
+def _latest_run(raw: str) -> str:
+ """The URL of the newest listed run. Empty when the list names none."""
+ try:
+ rows = json.loads(raw or "[]")
+ except json.JSONDecodeError:
+ return ""
+ for row in rows:
+ if isinstance(row, dict) and row.get("url"):
+ return str(row["url"])
+ return ""
def _release_view(tag: str, repository: str, inspect) -> dict | None:
@@ -185,7 +215,7 @@ def publish(version: str, *, repository: str, dispatch, inspect=None, head_versi
"gh", "workflow", "run", "stable-release-publication.yml",
"--repo", repository, "--raw-field", f"version={version}",
])
- return {"requested": tag}
+ return {"requested": tag, "version": version, "repository": repository}
def abandon(version: str, *, repo: Path, repository: str, delete, inspect=None) -> dict:
@@ -198,7 +228,25 @@ def abandon(version: str, *, repo: Path, repository: str, delete, inspect=None)
raise ReleaseRefused(f"stable {version} has no single release draft to abandon")
tag = rows[0]["tagName"]
delete(["gh", "release", "delete", tag, "--repo", repository, "--yes"])
- return {"burned": version}
+ return {"burned": version, "tag": tag, "repository": repository}
+
+
+def next_steps(result: dict) -> str:
+ """Say what started, what the operator waits for, and the next action."""
+ version = result["version"]
+ lines = [
+ f"Claimed v{version}. The release workflow started on {result['tag']}.",
+ f"Workflow: {result['run_url']}" if result.get("run_url") else "Workflow: the run is not listed yet. Open the Actions tab for this claim.",
+ "Wait for that workflow to finish. It builds and tests this commit.",
+ f"When it is green, the release notes are at {result['final_url']}.",
+ ]
+ if result["autopublish"]:
+ lines.append("Autopublish is on. A green workflow publishes the release. You do not run publish.")
+ else:
+ lines.append("Autopublish is off. The release stays a draft.")
+ lines.append("Edit the notes at that page, then publish the release to push this build live:")
+ lines.append(f" python scripts/release.py publish --version {version} --remote origin")
+ return "\n".join(lines)
def cmd_release(args) -> None:
@@ -216,6 +264,7 @@ def cmd_release(args) -> None:
completed = subprocess.run(command, cwd=repo, capture_output=True, text=True, encoding="utf-8")
if completed.returncode != 0:
raise RuntimeError(completed.stderr.strip() or "release command failed")
+ return completed.stdout
from scripts.releases.versioning import published_stable_version
result = release(
@@ -224,6 +273,7 @@ def cmd_release(args) -> None:
published=published_stable_version(repository),
)
print(result["url"])
+ print(next_steps(result))
def _command_repository(args) -> tuple[Path, str]:
@@ -250,17 +300,45 @@ def _inspect(repo: Path, command: list[str]) -> str:
return completed.stdout
+def publish_steps(result: dict) -> str:
+ """Say that publication was requested, and where to watch it."""
+ version = result["version"]
+ lines = [
+ f"Requested publication of v{version}.",
+ f"Workflow: {result['run_url']}" if result.get("run_url") else "Workflow: the run is not listed yet. Open the Actions tab.",
+ "Wait for that workflow to finish. It publishes the draft and moves the stable channel.",
+ f"The release page is https://github.com/{result['repository']}/releases/tag/v{version}.",
+ ]
+ return "\n".join(lines)
+
+
+def abandon_steps(result: dict) -> str:
+ """Say that the draft is gone and the version cannot be reused."""
+ version = result["burned"]
+ return "\n".join([
+ f"Deleted the draft for v{version}.",
+ f"The claim tag {result['tag']} stays, so v{version} is spent.",
+ "The next release takes the next version. This one cannot be reused.",
+ ])
+
+
def cmd_publish(args) -> None:
repo, repository = _command_repository(args)
from scripts.releases.versioning import published_stable_version
- publish(args.version, repository=repository,
- dispatch=lambda command: _execute(repo, command),
- inspect=lambda command: _inspect(repo, command),
- head_version=lambda: published_stable_version(repository))
+ result = publish(args.version, repository=repository,
+ dispatch=lambda command: _execute(repo, command),
+ inspect=lambda command: _inspect(repo, command),
+ head_version=lambda: published_stable_version(repository))
+ listed = _inspect(repo, [
+ "gh", "run", "list", "--repo", repository, "--workflow", "stable-release-publication.yml",
+ "--json", "databaseId,url,headBranch,status", "--limit", "1",
+ ])
+ print(publish_steps({**result, "run_url": _latest_run(listed)}))
def cmd_abandon(args) -> None:
repo, repository = _command_repository(args)
- abandon(args.version, repo=repo, repository=repository,
- delete=lambda command: _execute(repo, command),
- inspect=lambda command: _inspect(repo, command))
+ result = abandon(args.version, repo=repo, repository=repository,
+ delete=lambda command: _execute(repo, command),
+ inspect=lambda command: _inspect(repo, command))
+ print(abandon_steps(result))
diff --git a/tests/scripts/test_release_entrypoint.py b/tests/scripts/test_release_entrypoint.py
index c81f510c67d..11313f0e5b2 100644
--- a/tests/scripts/test_release_entrypoint.py
+++ b/tests/scripts/test_release_entrypoint.py
@@ -47,13 +47,22 @@ def test_release_claims_the_derived_version_creates_a_draft_and_dispatches(sourc
commit = git(source, "rev-parse", "HEAD")
calls = []
+
+ def execute(command):
+ calls.append(command)
+ if command[:3] == ["gh", "run", "list"]:
+ return json.dumps([{"databaseId": 7, "url": "https://github.com/example/hermes-agent/actions/runs/7",
+ "headBranch": "v0.21.5-rc", "status": "queued"}])
+ return ""
+
result = release(commit, bump="patch", repo=source, remote="origin",
- repository="example/hermes-agent", execute=calls.append, autopublish=True)
+ repository="example/hermes-agent", execute=execute, autopublish=True)
assert result["version"] == "0.21.5"
assert result["tag"] == "v0.21.5-rc"
assert result["commit"] == commit
assert result["url"] == "https://github.com/example/hermes-agent/releases/tag/v0.21.5-rc"
+ assert result["final_url"] == "https://github.com/example/hermes-agent/releases/tag/v0.21.5"
assert git(source, "rev-parse", "v0.21.5-rc^{commit}") == commit
claim = json.loads(git(source, "tag", "-l", "v0.21.5-rc", "--format=%(contents)"))
assert isinstance(claim.pop("claimEpoch"), int)
@@ -68,12 +77,33 @@ def test_release_claims_the_derived_version_creates_a_draft_and_dispatches(sourc
"--verify-tag", "--draft", "--generate-notes", "--title", "Hermes Agent v0.21.5"],
["gh", "workflow", "run", "stable-release.yml", "--ref", "v0.21.5-rc",
"--repo", "example/hermes-agent", "--raw-field", "tag=v0.21.5-rc"],
+ ["gh", "run", "list", "--repo", "example/hermes-agent", "--workflow", "stable-release.yml",
+ "--branch", "v0.21.5-rc", "--json", "databaseId,url,headBranch,status"],
]
+ assert result["run_url"] == "https://github.com/example/hermes-agent/actions/runs/7"
# The claim push names the claim ref and nothing else.
pushed = git(source, "ls-remote", "origin", "refs/tags/v0.21.5-rc")
assert pushed.startswith(git(source, "rev-parse", "v0.21.5-rc"))
+def test_release_output_names_the_wait_and_the_publish_step():
+ from scripts.releases.entrypoint import next_steps
+
+ result = {"version": "0.21.5", "tag": "v0.21.5-rc", "autopublish": False,
+ "run_url": "https://github.com/example/hermes-agent/actions/runs/7",
+ "final_url": "https://github.com/example/hermes-agent/releases/tag/v0.21.5"}
+ text = next_steps(result)
+ assert "Workflow: " + result["run_url"] in text
+ assert "The release workflow started on v0.21.5-rc." in text
+ assert "Wait for that workflow to finish." in text
+ assert result["final_url"] in text
+ assert "python scripts/release.py publish --version 0.21.5 --remote origin" in text
+
+ automatic = next_steps({**result, "autopublish": True})
+ assert "Autopublish is on." in automatic
+ assert "publish --version" not in automatic
+
+
def test_a_commit_behind_an_outstanding_claim_is_refused(source):
from scripts.releases.entrypoint import ReleaseRefused, _require_ancestry, release
@@ -123,6 +153,21 @@ def test_a_dispatch_that_never_starts_is_an_error(source):
assert "v0.21.5-rc" in git(source, "tag", "--list")
+def test_publish_and_abandon_output_name_the_result():
+ from scripts.releases.entrypoint import abandon_steps, publish_steps
+
+ published = publish_steps({"version": "0.21.5", "repository": "example/hermes-agent",
+ "run_url": "https://github.com/example/hermes-agent/actions/runs/9"})
+ assert "Requested publication of v0.21.5." in published
+ assert "Workflow: https://github.com/example/hermes-agent/actions/runs/9" in published
+ assert "moves the stable channel" in published
+
+ abandoned = abandon_steps({"burned": "0.21.5", "tag": "v0.21.5-rc"})
+ assert "Deleted the draft for v0.21.5." in abandoned
+ assert "v0.21.5-rc" in abandoned
+ assert "cannot be reused" in abandoned
+
+
def test_publish_dispatches_the_sequencer_and_abandon_keeps_the_claim(source):
from scripts.releases.entrypoint import ReleaseRefused, abandon, publish
@@ -131,6 +176,8 @@ def test_publish_dispatches_the_sequencer_and_abandon_keeps_the_claim(source):
calls = []
published = publish("0.21.5", repository="example/hermes-agent", dispatch=calls.append)
assert published["requested"] == "v0.21.5"
+ assert published["version"] == "0.21.5"
+ assert published["repository"] == "example/hermes-agent"
assert calls == [[
"gh", "workflow", "run", "stable-release-publication.yml",
"--repo", "example/hermes-agent", "--raw-field", "version=0.21.5",
@@ -144,6 +191,7 @@ def test_publish_dispatches_the_sequencer_and_abandon_keeps_the_claim(source):
abandoned = abandon("0.21.5", repo=source, repository="example/hermes-agent",
delete=calls.append, inspect=inspect)
assert abandoned["burned"] == "0.21.5"
+ assert abandoned["tag"] == "v0.21.5"
assert calls[-1] == ["gh", "release", "delete", "v0.21.5", "--repo", "example/hermes-agent", "--yes"]
assert "v0.21.5-rc" in git(source, "tag", "--list")