The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(release): --branding stable works before stable has a channel record (#129541)
Siddharth Balyan09681e7959c0
diff --git a/.github/workflows/desktop-bundled-release.yml b/.github/workflows/desktop-bundled-release.ymlindex f00737516e7..467ae144526 100644--- a/.github/workflows/desktop-bundled-release.yml+++ b/.github/workflows/desktop-bundled-release.yml@@ -286,7 +286,10 @@ jobs:run: python3 -m scripts.ci.archive_inputs- name: Set up native identity reader- if: inputs.disposable_channel != '' && inputs.disposable_receivers+ # product_identity() runs apps/desktop/product-identity.cjs: disposable+ # receivers need it, and so does a stable-branded channel before any+ # stable release has published a channel record to copy.+ if: (inputs.disposable_channel != '' && inputs.disposable_receivers) || inputs.branding == 'stable'uses: ./.github/actions/setup-pmwith:toolchain: nodediff --git a/scripts/releases/channels.py b/scripts/releases/channels.pyindex 17c2a46e782..7a2275fe98a 100644--- a/scripts/releases/channels.py+++ b/scripts/releases/channels.py@@ -142,9 +142,18 @@ class ChannelPublisher:self.authorize(action, record)def _stable_identity(self) -> dict:- """The identity installed stable clients already carry, read from its channel record."""+ """The identity installed stable clients already carry, read from its channel record.++ Before any stable release has published through channels there is no+ record to read, so use the identity channel_publish holds the first+ stable release to. A record without a head still refuses: once stable+ exists on channels, its record is the only authority.+ """current = self._read("stable")- if current is None or current[0]["head"] is None:+ if current is None:+ from scripts.releases.channel_releases import product_identity+ return product_identity("v0.0.0")+ if current[0]["head"] is None:raise ChannelError("Stable branding copies the published stable channel identity; none is published")return deepcopy(current[0]["identity"])diff --git a/tests/scripts/test_release_channels.py b/tests/scripts/test_release_channels.pyindex 6e7a3b170ad..14174f304f6 100644--- a/tests/scripts/test_release_channels.py+++ b/tests/scripts/test_release_channels.py@@ -120,14 +120,24 @@ def test_unknown_channel_created_over_http_retains_identity_and_immutable_requesassert "immutable" in headers[f"releases/channel-builds/{one['buildId']}/request.json"]["Cache-Control"]-def test_stable_branded_channel_reuses_the_published_stable_identity():- """--branding stable is fixed at creation and needs an actual published stable to copy."""+def test_stable_branded_channel_reuses_the_published_stable_identity(monkeypatch):+ """--branding stable is fixed at creation; it copies a published stable record, and+ before stable has any channel record it uses the identity the first stable release+ is held to."""from hermes_cli.release_channels import ChannelError, canonical_json+ from scripts.releases import channel_releases+ product = {"token": "f204dc6857361e33", "displayName": "Hermes Agent",+ "appId": "com.nousresearch.hermes-bundled", "appNamePascal": "HermesBundled",+ "artifactNamePascal": "HermesBundled", "cliName": "hermes",+ "windowsExecutableName": "Hermes Agent", "msixAppIdWithOrg": "NousResearch.HermesBundled"}+ monkeypatch.setattr(channel_releases, "product_identity", lambda tag: dict(product))with object_server() as (url, objects, headers, requests, faults):pub = publisher(url)+ assert pub.create("before-stable", "stable")["identity"] == product+ assert not [key for key in objects if key.startswith("releases/channel-identities/")]+ stable = pub.create("stable")with pytest.raises(ChannelError, match="none is published"):pub.create("like-stable", "stable")- stable = pub.create("stable")stable.update(policy="stable-release", nextSequence=2, head={"buildId": "e" * 32, "sequence": 1, "sha256": "0" * 64,"manifestKey": "releases/channel-builds/" + "e" * 32 + "/build.json"})