The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
refactor(releases): allocate channels in CI; drop resume and local R2 minting
ethernetd786c08e37d4
diff --git a/.github/workflows/desktop-bundled-release.yml b/.github/workflows/desktop-bundled-release.ymlindex 5aac8ced2ea..f695a1bbf17 100644--- a/.github/workflows/desktop-bundled-release.yml+++ b/.github/workflows/desktop-bundled-release.yml@@ -109,16 +109,11 @@ on:type: booleandefault: falsedisposable_run:- description: 'Allocation controller run-id-attempt; only with channel_build and its pinned digest.'+ description: 'Disposable allocation controller run id; the allocate step derives and overwrites it.'type: stringdefault: ''- channel_build:- description: 'Admitted immutable channel build ID (32 lowercase hex); trusted default-branch dispatch only.'- required: false- type: string- default: ''- channel_request_sha256:- description: 'SHA256 of the admitted immutable channel request.'+ channel:+ description: 'Preview channel name; this run allocates the channel and builds build_commit. Trusted default-branch dispatch only.'required: falsetype: stringdefault: ''@@ -157,7 +152,7 @@ permissions:concurrency:# One dispatch: a disposable run's identity is its channel name, so a# re-dispatch of the same channel serializes instead of racing the namespace.- group: desktop-bundled-release-${{ inputs.channel_build || inputs.disposable_channel || inputs.tag || inputs.build_commit || 'canary' }}-${{ inputs.release-phase || 'canary' }}+ group: desktop-bundled-release-${{ inputs.channel || inputs.disposable_channel || inputs.tag || inputs.build_commit || 'canary' }}-${{ inputs.release-phase || 'canary' }}cancel-in-progress: falseenv:@@ -191,20 +186,20 @@ jobs:receiver-candidate: ${{ steps.admission.outputs.receiver-candidate }}public-root: ${{ steps.admission.outputs.public-root }}public-base: ${{ steps.admission.outputs.public-base }}- channel-build: ${{ (inputs.disposable_channel != '' && steps.allocate.outputs.channel_build) || inputs.channel_build || '' }}- channel-request-sha256: ${{ (inputs.disposable_channel != '' && steps.allocate.outputs.channel_request_sha256) || inputs.channel_request_sha256 || '' }}+ channel-build: ${{ ((inputs.disposable_channel != '' || inputs.channel != '') && steps.allocate.outputs.channel_build) || '' }}+ channel-request-sha256: ${{ ((inputs.disposable_channel != '' || inputs.channel != '') && steps.allocate.outputs.channel_request_sha256) || '' }}disposable-run: ${{ (inputs.disposable_channel != '' && github.run_id) || inputs.disposable_run || '' }}steps:- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2with:- ref: ${{ (inputs.build_commit != '' || inputs.channel_build != '') && github.sha || inputs.tag }}+ ref: ${{ (inputs.build_commit != '' || inputs.channel != '') && github.sha || inputs.tag }}# Tag admission runs merge-base against origin/main and needs the# shared ancestry; channel admission exits before any history read,# so it fetches exactly one commit. Commit admission reads ancestry# (require_pushed) and pyproject.toml at BUILD_COMMIT, so it needs# the full graph.- fetch-depth: ${{ inputs.build_commit != '' && 0 || (inputs.channel_build != '' && 1 || 0) }}- fetch-tags: ${{ inputs.build_commit == '' && inputs.channel_build == '' }}+ fetch-depth: ${{ inputs.build_commit != '' && 0 || (inputs.channel != '' && 1 || 0) }}+ fetch-tags: ${{ inputs.build_commit == '' && inputs.channel == '' }}- name: Set up native identity readerif: inputs.disposable_channel != '' && inputs.disposable_receivers@@ -213,15 +208,14 @@ jobs:toolchain: nodecache-python: falsearchive-inputs: false- - name: Probe scoped storage and allocate the disposable channel+ - name: Allocate the channel and build its immutable requestid: allocate- if: inputs.disposable_channel != ''+ if: inputs.disposable_channel != '' || inputs.channel != ''env:DISPOSABLE_CHANNEL: ${{ inputs.disposable_channel }}+ CHANNEL: ${{ inputs.channel }}DISPOSABLE_RECEIVERS: ${{ inputs.disposable_receivers }}BUILD_COMMIT: ${{ inputs.build_commit }}- CHANNEL_BUILD: ${{ inputs.channel_build }}- CHANNEL_REQUEST_SHA256: ${{ inputs.channel_request_sha256 }}TAG: ${{ inputs.tag }}RELEASE_PHASE: ${{ inputs.release-phase }}TERMUX_ONLY: ${{ inputs.termux_only }}@@ -242,8 +236,8 @@ jobs:env:TAG: ${{ inputs.tag }}BUILD_COMMIT: ${{ inputs.build_commit }}- CHANNEL_BUILD: ${{ inputs.channel_build || steps.allocate.outputs.channel_build || '' }}- CHANNEL_REQUEST_SHA256: ${{ inputs.channel_request_sha256 || steps.allocate.outputs.channel_request_sha256 || '' }}+ CHANNEL_BUILD: ${{ steps.allocate.outputs.channel_build || '' }}+ CHANNEL_REQUEST_SHA256: ${{ steps.allocate.outputs.channel_request_sha256 || '' }}CLOUDFLARE_R2_PUBLIC_URL: ${{ vars.CLOUDFLARE_R2_PUBLIC_URL }}TERMUX_ONLY: ${{ inputs.termux_only }}BUNDLE_ENV_JSON: ${{ inputs.bundle_env }}@@ -264,9 +258,6 @@ jobs:python -m scripts.releases.channel_publish admitexit 0fi- if [ -n "${CHANNEL_REQUEST_SHA256:-}" ]; then- echo '::error::channel_request_sha256 requires channel_build'; exit 1- fiif [ -n "$BUILD_COMMIT" ]; then# Reject mixed inputs before loading code from the checkout.if [ -n "$TAG" ] || [ -n "$RELEASE_PHASE" ] || [ -n "$TERMUX_UPGRADE_FROM_TAG" ] || [ "$UPLOAD_RELEASE" != false ]; then@@ -351,7 +342,7 @@ jobs:# Share execution via anchors, and keep the original IDs as downstream gates.build-win32-release:name: bundled ${{ matrix.target.label }}- if: inputs.termux_only != true && (inputs.release-phase == '' || inputs.release-phase == 'candidate') && inputs.build_commit == '' && inputs.channel_build == ''+ if: inputs.termux_only != true && (inputs.release-phase == '' || inputs.release-phase == 'candidate') && inputs.build_commit == '' && inputs.channel == ''needs: [validate, archive-inputs]runs-on: ${{ matrix.target.runner }}environment: release-signing@@ -470,7 +461,7 @@ jobs:python -m scripts.ci.desktop_commands "$RUNNER_TEMP/desktop-job/prepared.json"- name: Save dependency inputs before building- if: ${{ !cancelled() && steps.prepare.outcome == 'success' && inputs.build_commit == '' && inputs.channel_build == '' }}+ if: ${{ !cancelled() && steps.prepare.outcome == 'success' && inputs.build_commit == '' && inputs.channel == '' }}uses: ./.github/actions/desktop-build-cachewith:phase: save@@ -483,7 +474,7 @@ jobs:# Commit builds run these steps with a read-only cache token; the# exact-hit-skip semantics of actions/cache keep a read token harmless.- name: Save the electron-builder toolchain- if: ${{ !cancelled() && steps.prepare.outcome == 'success' && inputs.build_commit == '' && inputs.channel_build == '' }}+ if: ${{ !cancelled() && steps.prepare.outcome == 'success' && inputs.build_commit == '' && inputs.channel == '' }}uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0with:path: ${{ github.workspace }}/.cache/electron-builder@@ -617,7 +608,7 @@ jobs:!cancelled() && needs.validate.result == 'success'&& (needs.archive-inputs.result == 'success' || ((inputs.disposable_run != '' || inputs.disposable_channel != '') && needs.archive-inputs.result == 'skipped'))&& inputs.termux_only != true && (inputs.release-phase == '' || inputs.release-phase == 'candidate')- && (inputs.build_commit != '' || inputs.channel_build != '')+ && (inputs.build_commit != '' || inputs.channel != '')needs: [validate, archive-inputs]runs-on: ${{ matrix.target.runner }}environment: release-signing@@ -641,8 +632,8 @@ jobs:timeout-minutes: 5env:SELECTED_BUILD_SUCCEEDED: >-- ${{ (inputs.build_commit == '' && inputs.channel_build == '' && needs.build-win32-release.result == 'success' && needs.build-win32-commit.result == 'skipped')- || ((inputs.build_commit != '' || inputs.channel_build != '') && needs.build-win32-commit.result == 'success' && needs.build-win32-release.result == 'skipped') }}+ ${{ (inputs.build_commit == '' && inputs.channel == '' && needs.build-win32-release.result == 'success' && needs.build-win32-commit.result == 'skipped')+ || ((inputs.build_commit != '' || inputs.channel != '') && needs.build-win32-commit.result == 'success' && needs.build-win32-release.result == 'skipped') }}steps: &native-build-result-steps- name: Require exactly the selected native build to succeedshell: bash@@ -665,7 +656,7 @@ jobs:# pointer last, whole channel green before anything publishes.build-darwin-release:name: bundled ${{ matrix.target.label }}- if: inputs.termux_only != true && (inputs.release-phase == '' || inputs.release-phase == 'candidate') && inputs.build_commit == '' && inputs.channel_build == ''+ if: inputs.termux_only != true && (inputs.release-phase == '' || inputs.release-phase == 'candidate') && inputs.build_commit == '' && inputs.channel == ''needs: [validate, archive-inputs]runs-on: ${{ matrix.target.runner }}environment: release-signing@@ -769,7 +760,7 @@ jobs:python3 -m scripts.ci.desktop_commands "$RUNNER_TEMP/desktop-job/prepared.json"- name: Save dependency inputs before building- if: ${{ !cancelled() && steps.prepare.outcome == 'success' && inputs.build_commit == '' && inputs.channel_build == '' }}+ if: ${{ !cancelled() && steps.prepare.outcome == 'success' && inputs.build_commit == '' && inputs.channel == '' }}uses: ./.github/actions/desktop-build-cachewith:phase: save@@ -782,7 +773,7 @@ jobs:# Commit builds run these steps with a read-only cache token; the# exact-hit-skip semantics of actions/cache keep a read token harmless.- name: Save the electron-builder toolchain- if: ${{ !cancelled() && steps.prepare.outcome == 'success' && inputs.build_commit == '' && inputs.channel_build == '' }}+ if: ${{ !cancelled() && steps.prepare.outcome == 'success' && inputs.build_commit == '' && inputs.channel == '' }}uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0with:path: ${{ github.workspace }}/.cache/electron-builder@@ -791,7 +782,7 @@ jobs:# Commit artifacts are downloadable too. Require signing for them,# candidates, and published tags before building any payload.- name: Require signing credentials when publishing- if: inputs.upload_release == true || inputs.release-phase == 'candidate' || inputs.build_commit != '' || inputs.channel_build != ''+ if: inputs.upload_release == true || inputs.release-phase == 'candidate' || inputs.build_commit != '' || inputs.channel != ''shell: bashenv:CSC_LINK: ${{ secrets.CSC_LINK }}@@ -817,7 +808,7 @@ jobs:# notarytool takes a FILE PATH for --key; raw .p8 content in argv# dies with `Invalid option: ***`. The build step must NOT re-declare# APPLE_API_KEY in its env: step env shadows GITHUB_ENV.- if: inputs.upload_release == true || inputs.release-phase == 'candidate' || inputs.build_commit != '' || inputs.channel_build != ''+ if: inputs.upload_release == true || inputs.release-phase == 'candidate' || inputs.build_commit != '' || inputs.channel != ''shell: bashenv:APPLE_API_KEY_P8: ${{ secrets.APPLE_API_KEY_P8 }}@@ -858,7 +849,7 @@ jobs:# The backstop against a silent unsigned publish: assess the packed# app against the real Gatekeeper policy (requires a Developer ID# signature AND a stapled notarization ticket to pass offline).- if: inputs.upload_release == true || inputs.release-phase == 'candidate' || inputs.build_commit != '' || inputs.channel_build != ''+ if: inputs.upload_release == true || inputs.release-phase == 'candidate' || inputs.build_commit != '' || inputs.channel != ''shell: bashrun: |shopt -s nullglob@@ -946,7 +937,7 @@ jobs:!cancelled() && needs.validate.result == 'success'&& (needs.archive-inputs.result == 'success' || ((inputs.disposable_run != '' || inputs.disposable_channel != '') && needs.archive-inputs.result == 'skipped'))&& inputs.termux_only != true && (inputs.release-phase == '' || inputs.release-phase == 'candidate')- && (inputs.build_commit != '' || inputs.channel_build != '')+ && (inputs.build_commit != '' || inputs.channel != '')needs: [validate, archive-inputs]runs-on: ${{ matrix.target.runner }}environment: release-signing@@ -970,8 +961,8 @@ jobs:timeout-minutes: 5env:SELECTED_BUILD_SUCCEEDED: >-- ${{ (inputs.build_commit == '' && inputs.channel_build == '' && needs.build-darwin-release.result == 'success' && needs.build-darwin-commit.result == 'skipped')- || ((inputs.build_commit != '' || inputs.channel_build != '') && needs.build-darwin-commit.result == 'success' && needs.build-darwin-release.result == 'skipped') }}+ ${{ (inputs.build_commit == '' && inputs.channel == '' && needs.build-darwin-release.result == 'success' && needs.build-darwin-commit.result == 'skipped')+ || ((inputs.build_commit != '' || inputs.channel != '') && needs.build-darwin-commit.result == 'success' && needs.build-darwin-release.result == 'skipped') }}steps: *native-build-result-steps# ── Linux builders (DISABLED for now) ─────────────────────────────────────@@ -998,7 +989,7 @@ jobs:!cancelled() && needs.validate.result == 'success' && needs.validate.outputs.sha != ''&& needs.build-darwin.result == 'success' && inputs.termux_only != true&& (inputs.release-phase == '' || inputs.release-phase == 'candidate')- && (inputs.upload_release == true || inputs.release-phase == 'candidate' || inputs.build_commit != '' || inputs.channel_build != '')+ && (inputs.upload_release == true || inputs.release-phase == 'candidate' || inputs.build_commit != '' || inputs.channel != '')permissions:contents: readstrategy:@@ -1028,7 +1019,7 @@ jobs:!cancelled() && needs.validate.result == 'success' && needs.validate.outputs.sha != ''&& needs.build-win32.result == 'success' && inputs.termux_only != true&& (inputs.release-phase == '' || inputs.release-phase == 'candidate')- && (inputs.upload_release == true || inputs.release-phase == 'candidate' || inputs.build_commit != '' || inputs.channel_build != '')+ && (inputs.upload_release == true || inputs.release-phase == 'candidate' || inputs.build_commit != '' || inputs.channel != '')permissions:contents: readstrategy:@@ -1057,7 +1048,7 @@ jobs:!cancelled() && needs.validate.result == 'success' && needs.validate.outputs.sha != ''&& needs.assemble-win32-bundle.result == 'success' && inputs.termux_only != true&& (inputs.release-phase == '' || inputs.release-phase == 'candidate')- && (inputs.upload_release == true || inputs.release-phase == 'candidate' || inputs.build_commit != '' || inputs.channel_build != '')+ && (inputs.upload_release == true || inputs.release-phase == 'candidate' || inputs.build_commit != '' || inputs.channel != '')permissions:contents: readstrategy:@@ -1087,7 +1078,7 @@ jobs:!cancelled() && needs.validate.result == 'success' && needs.validate.outputs.sha != ''&& needs.build-win32.result == 'success' && inputs.termux_only != true&& (inputs.release-phase == '' || inputs.release-phase == 'candidate')- && (inputs.upload_release == true || inputs.release-phase == 'candidate' || inputs.build_commit != '' || inputs.channel_build != '')+ && (inputs.upload_release == true || inputs.release-phase == 'candidate' || inputs.build_commit != '' || inputs.channel != '')runs-on: windows-2025environment: release-signingcache-mode: read@@ -1298,7 +1289,7 @@ jobs:name: Publish the tested Windows canary bundleneeds: [validate, assemble-win32-bundle, smoke-win32, smoke-win32-universal]if: >-- !cancelled() && inputs.build_commit == '' && inputs.channel_build == '' && inputs.upload_release == true+ !cancelled() && inputs.build_commit == '' && inputs.channel == '' && inputs.upload_release == true&& inputs.release-phase == '' && inputs.termux_only != true&& needs.validate.result == 'success' && needs.validate.outputs.sha != ''&& needs.assemble-win32-bundle.result == 'success'@@ -1376,7 +1367,7 @@ jobs:name: Publish the macOS updater feedneeds: [validate, build-darwin, smoke-darwin]if: >-- !cancelled() && inputs.build_commit == '' && inputs.channel_build == '' && inputs.upload_release == true+ !cancelled() && inputs.build_commit == '' && inputs.channel == '' && inputs.upload_release == true&& inputs.release-phase == '' && inputs.termux_only != true&& needs.validate.result == 'success' && needs.validate.outputs.sha != ''&& needs.build-darwin.result == 'success' && needs.smoke-darwin.result == 'success'@@ -1441,7 +1432,7 @@ jobs:termux-deb:name: Build + publish the termux .deb (aarch64)needs: [validate, archive-inputs]- if: inputs.channel_build == '' && inputs.disposable_channel == '' && (inputs.upload_release == true || inputs.release-phase == 'candidate' || inputs.build_commit != '')+ if: inputs.channel == '' && inputs.disposable_channel == '' && (inputs.upload_release == true || inputs.release-phase == 'candidate' || inputs.build_commit != '')runs-on: ubuntu-24.04-armenvironment: release-signingtimeout-minutes: 90@@ -1814,7 +1805,7 @@ jobs:# Failed builds still get a per-tag diagnostic page. The renderer only# advances the channel landing page when every prerequisite succeeded.if: |- always() && inputs.build_commit == '' && inputs.channel_build == '' && inputs.upload_release == true && inputs.release-phase == ''+ always() && inputs.build_commit == '' && inputs.channel == '' && inputs.upload_release == true && inputs.release-phase == ''&& needs.validate.result == 'success' && needs.validate.outputs.sha != ''runs-on: ubuntu-24.04environment: release-signing@@ -2074,7 +2065,7 @@ jobs:needs: [validate, build-win32, build-darwin, build-linux, builds-table, assemble-win32-bundle, smoke-darwin, smoke-win32, smoke-win32-universal, publish-win32-updater, publish-darwin-updater]if: |always()- && inputs.build_commit == '' && inputs.channel_build == ''+ && inputs.build_commit == '' && inputs.channel == ''&& inputs.upload_release == true&& contains(inputs.tag, '-canary.')&& needs.build-win32.result == 'success'diff --git a/scripts/releases/channel_build.py b/scripts/releases/channel_build.pyindex bf41964b292..6078cd2a59a 100644--- a/scripts/releases/channel_build.py+++ b/scripts/releases/channel_build.py@@ -1,86 +1,58 @@-"""Exact-commit channel requests and release-tool dispatch (one-offs stay separate)."""+"""Channel dispatch: the local command names intent; CI allocates and builds.++A channel build is a preview of an exact pushed commit. The local command does+not touch R2: it resolves the commit, validates the request and dispatches the+default-branch workflow. The workflow's privileged allocation step creates the+channel and mints the immutable build request (see channel_disposable.py).+""" # noqa: E501from __future__ import annotations-import hashlibimport jsonimport osfrom pathlib import Pathimport subprocessfrom hermes_cli.release_channels import (- ChannelError, canonical_json,- require_commit, require_sha256, validate_name, validate_repository,- validate_request,+ ChannelError, validate_name, validate_repository,)from scripts.releases import commit_build, r2from scripts.releases.bundle_env import parse_assignments, validatefrom scripts.releases.channels import ChannelPublisher, R2ChannelStore-def dispatch_command(request: dict, repository: str, branch: str, *, disposable_run: str = "") -> list[str]:- validate_request(request, repository=repository)+def dispatch_command(name: str, commit: str, repository: str, branch: str,+ bundle_env: dict | None = None) -> list[str]:+ validate_name(name)+ validate_repository(repository)+ commit_build.require_commit(commit)if not branch or branch.startswith("-"):raise ChannelError("Missing repository default branch")- digest = hashlib.sha256(canonical_json(request)).hexdigest()command = ["gh", "workflow", "run", commit_build.WORKFLOW, "--repo", repository, "--ref", branch,- "-f", "channel_build=" + request["buildId"], "-f", "channel_request_sha256=" + digest,- "-f", "tag=", "-f", "upload_release=false", "-f", "termux_only=false",- "-f", "termux_upgrade_from_tag="]- if disposable_run:- from scripts.releases.r2_scope import require_run- command += ["-f", "disposable_run=" + require_run(disposable_run)]+ "-f", "channel=" + name, "-f", "build_commit=" + commit,+ "-f", "tag=", "-f", "upload_release=false", "-f", "termux_only=false",+ "-f", "termux_upgrade_from_tag="]+ if bundle_env:+ command += ["-f", "bundle_env=" + json.dumps(bundle_env, sort_keys=True)]return commanddef prepare_build(*, name: str, revision: str, remote: str, repo: Path, repository: str,- default_branch: str, publisher: ChannelPublisher, dispatch,- bundle_env: dict | None = None, controller_commit: str | None = None,+ default_branch: str, dispatch, bundle_env: dict | None = None,publish: bool = False) -> dict:validate_name(name)validate_repository(repository)- if publisher.repository.casefold() != repository.casefold():- raise ChannelError("Publisher repository authority mismatch")bundle_env = validate({} if bundle_env is None else bundle_env)commit = commit_build.resolve_revision(revision, remote, repo)version = commit_build.version_at(repo, commit)if not default_branch or default_branch.startswith("-"):raise ChannelError("Missing repository default branch")- if controller_commit is None:- advertised = commit_build.output(["git", "ls-remote", remote, f"refs/heads/{default_branch}"], repo).split()- if len(advertised) != 2 or advertised[1] != f"refs/heads/{default_branch}":- raise ChannelError("Could not resolve repository default branch")- controller_commit = require_commit(advertised[0])- require_commit(controller_commit)- current = publisher._read(name)- if current is not None:- publisher._preview("allocate", current[0])+ command = dispatch_command(name, commit, repository, default_branch, bundle_env)result = {"channel": name, "repository": repository, "commit": commit,- "sourceVersion": version, "controllerCommit": controller_commit, "created": current is None}+ "sourceVersion": version}if not publish:- return result- publisher.create(name)- request = publisher.allocate(name, commit, version, bundle_env, controller_commit)- command = dispatch_command(request, repository, default_branch,- disposable_run=os.environ.get("R2_DISPOSABLE_RUN", ""))- print(f"Admitted build {request['buildId']}; request SHA256 {hashlib.sha256(canonical_json(request)).hexdigest()}")+ return {**result, "command": command}dispatch(command)- return {**result, "request": request, "command": command}---def resume_build(build_id: str, digest: str, *, publisher: ChannelPublisher,- default_branch: str, dispatch, publish: bool = True) -> dict:- request = publisher.request(build_id, digest)- current = publisher._read(request["channel"])- if current is None:- raise ChannelError("Request channel no longer exists")- publisher._preview("allocate", current[0])- if current[0]["identity"] != request["identity"]:- raise ChannelError("Request channel identity mismatch")- command = dispatch_command(request, publisher.repository, default_branch,- disposable_run=os.environ.get("R2_DISPOSABLE_RUN", ""))- if publish:- dispatch(command)- return {"request": request, "command": command}+ return {**result, "command": command}def maintainer_authorizer(repository: str):@@ -120,21 +92,23 @@ def cmd_channel(args) -> None:repository = release.remote_github_repo(remote)if not repository:raise ChannelError("Channel commands require an explicit GitHub remote")+ default_branch = release._default_branch(repository)+ if args.channel:+ result = prepare_build(+ name=args.channel, revision=args.build_commit, remote=remote, repo=release.REPO_ROOT,+ repository=repository, default_branch=default_branch,+ dispatch=lambda command: subprocess.run(command, cwd=release.REPO_ROOT, check=True, timeout=60),+ bundle_env=parse_assignments(args.bundle_env, args.bundle_unset), publish=args.publish)+ print(json.dumps(result, sort_keys=True, indent=2))+ if not args.publish:+ print("Dry run: no workflow was dispatched. Add --publish to dispatch.")+ returnpublisher = configured_publisher(repository)operations = {"channels": lambda: publisher.list(),- "resume_channel_build": lambda: resume_build(- args.resume_channel_build, args.request_sha256, publisher=publisher,- default_branch=release._default_branch(repository), publish=args.publish,- dispatch=lambda command: subprocess.run(command, cwd=release.REPO_ROOT, check=True, timeout=60)),- "bootstrap_channels": lambda: _bootstrap_file(publisher, Path(args.bootstrap_channels), args.publish),"retire_channel": lambda: publisher.retire(args.retire_channel, args.to, args.minimum_version,- publish=args.publish),- "channel": lambda: prepare_build(- name=args.channel, revision=args.build_commit, remote=remote, repo=release.REPO_ROOT,- repository=repository, default_branch=release._default_branch(repository), publisher=publisher,- dispatch=lambda command: subprocess.run(command, cwd=release.REPO_ROOT, check=True, timeout=60),- bundle_env=parse_assignments(args.bundle_env, args.bundle_unset), publish=args.publish),+ publish=args.publish),+ "bootstrap_channels": lambda: _bootstrap_file(publisher, Path(args.bootstrap_channels), args.publish),}selected = next(key for key in operations if getattr(args, key, None))result = operations[selected]()@@ -156,8 +130,6 @@ def _bootstrap_file(publisher: ChannelPublisher, path: Path, publish: bool) -> ldef add_arguments(parser) -> None:- parser.add_argument("--resume-channel-build", metavar="BUILD_ID", help="Retry an immutable admitted request without allocating")- parser.add_argument("--request-sha256", type=require_sha256, metavar="SHA256", help="Pinned request digest for --resume-channel-build")parser.add_argument("--channel", type=validate_name, metavar="NAME", help="R2 channel for --build-commit")parser.add_argument("--channels", action="store_true", help="List authenticated R2 channel records")parser.add_argument("--retire-channel", type=validate_name, metavar="NAME", help="Permanently retire a preview channel")@@ -167,9 +139,7 @@ def add_arguments(parser) -> None:def validate_arguments(parser, args) -> bool:- selected = [key for key in ("channel", "channels", "retire_channel", "bootstrap_channels", "resume_channel_build") if getattr(args, key)]- if bool(args.resume_channel_build) != bool(args.request_sha256):- parser.error("--resume-channel-build and --request-sha256 are required together")+ selected = [key for key in ("channel", "channels", "retire_channel", "bootstrap_channels") if getattr(args, key)]retirement = (args.to, args.minimum_version)if any(retirement) and not args.retire_channel:parser.error("Retirement options require --retire-channel")@@ -186,4 +156,4 @@ def validate_arguments(parser, args) -> bool:if ((not args.channel and args.build_commit) or any((args.bump, args.canary, args.prune_canaries,args.first_release, args.date, args.output, args.no_changelog))):parser.error("Channel operations cannot be combined with release/tag operations")- return True+ return True\ No newline at end of filediff --git a/scripts/releases/channel_disposable.py b/scripts/releases/channel_disposable.pyindex 66418a93199..8ab0bf5115a 100644--- a/scripts/releases/channel_disposable.py+++ b/scripts/releases/channel_disposable.py@@ -1,15 +1,21 @@-"""Privileged allocation: probe CAS/CDN and allocate the channel this run builds."""+"""Privileged allocation: probe CAS/CDN and allocate the channel this run builds.++The workflow's allocation step runs here for BOTH the disposable test path+(``disposable_channel`` input, scoped to a ``ci-disposable/`` namespace) and the+production preview path (``channel`` input, unscoped production namespace). The+local ``release.py --channel`` command no longer touches R2: it only dispatches+this workflow, and this privileged step creates the channel and mints the+immutable build request that the build legs consume via job outputs.+""" # noqa: E501from __future__ import annotationsimport hashlibimport jsonimport osfrom pathlib import Path-import shlexfrom hermes_cli.release_channels import canonical_json, channel_key, validate_namefrom scripts.releases import commit_build, r2-from scripts.releases.channel_build import dispatch_commandfrom scripts.releases.channels import ChannelConflict, ChannelPublisher, R2ChannelStorefrom scripts.releases.r2_scope import R2Scope, channel_public_base, require_run@@ -58,7 +64,7 @@ def allocate_receivers(publisher, commit: str, source_version: str, controller:raise ValueError("Receiver allocation requires a fresh disposable stable record")identity = product_identity("v0.0.1")requests = {}- for sequence, slot in enumerate(("S", "T"), 1):+ for sequence, slot in enumerate((("S", "T")), 1):request = {"schema": 1, "channel": "stable", "repository": publisher.repository,"sequence": sequence, "commit": commit, "sourceVersion": source_version,"controllerCommit": controller, "version": f"0.0.{sequence}",@@ -78,32 +84,40 @@ def allocate_receivers(publisher, commit: str, source_version: str, controller:def allocate(env: dict[str, str]) -> dict:- name = validate_name(env.get("DISPOSABLE_CHANNEL", ""))- if name in {"ci-cas-probe", "stable", "canary", "main"}:- raise ValueError("Use a non-protected disposable preview name")- if env.get("CHANNEL_BUILD") or env.get("CHANNEL_REQUEST_SHA256"):- raise ValueError("Allocation cannot reuse a build request or select a storage scope")- if env.get("TERMUX_ONLY") == "true":- raise ValueError("Disposable allocation cannot select Termux")- # One dispatch now allocates AND builds, so the namespace must survive a- # "re-run failed jobs": lease by the run id alone (no attempt suffix), and- # never accept a caller-supplied path, public URL, or allocation namespace.- run = require_run(env.get("GITHUB_RUN_ID", ""))+ disposable_name = env.get("DISPOSABLE_CHANNEL", "")+ channel_name = env.get("CHANNEL", "")+ if disposable_name and channel_name:+ raise ValueError("Choose disposable_channel or channel, not both")+ disposable = bool(disposable_name)+ name = validate_name(disposable_name or channel_name)+ if disposable:+ if name in {"ci-cas-probe", "stable", "canary", "main"}:+ raise ValueError("Use a non-protected disposable preview name")+ if env.get("CHANNEL_BUILD") or env.get("CHANNEL_REQUEST_SHA256"):+ raise ValueError("Allocation cannot reuse a build request or select a storage scope")+ if env.get("TERMUX_ONLY") == "true":+ raise ValueError("Disposable allocation cannot select Termux")+ # One dispatch now allocates AND builds, so the namespace must survive a+ # "re-run failed jobs": lease by the run id alone (no attempt suffix), and+ # never accept a caller-supplied path, public URL, or allocation namespace.+ run = require_run(env.get("GITHUB_RUN_ID", ""))admitted = commit_build.admit(env)controller = commit_build.require_commit(env.get("GITHUB_SHA", ""))- os.environ["R2_DISPOSABLE_RUN"] = run+ if disposable:+ os.environ["R2_DISPOSABLE_RUN"] = runscope = R2Scope.configured()base = channel_public_base()repository = env["GITHUB_REPOSITORY"]def authorize(action: str, record: dict) -> None:if action not in {"create", "allocate"} or record["policy"] != "preview":- raise ValueError("Disposable controller only creates and allocates previews")+ raise ValueError("Controller only creates and allocates previews")commit_build.admit(env)publisher = ChannelPublisher(R2ChannelStore(*r2.credentials(), scope=scope), repository,base, authorize=authorize)- probe(publisher, admitted["sha"], admitted["payload-version"], controller)+ if disposable:+ probe(publisher, admitted["sha"], admitted["payload-version"], controller)publisher.create(name)from scripts.releases.bundle_env import decoderequest = publisher.allocate(name, admitted["sha"], admitted["payload-version"],@@ -114,38 +128,39 @@ def allocate(env: dict[str, str]) -> dict:decode(env.get("BUNDLE_ENV_JSON", "")), controller)requests.update(allocate_receivers(publisher, admitted["sha"], admitted["payload-version"], controller))digest = hashlib.sha256(canonical_json(request)).hexdigest()- command = dispatch_command(request, repository, env["DEFAULT_BRANCH"], disposable_run=run)- return {"request": request, "requestSha256": digest, "disposableRun": run,- "storagePrefix": scope.prefix, "command": command, "requests": requests,- "commands": {slot: dispatch_command(value, repository, env["DEFAULT_BRANCH"], disposable_run=run)- for slot, value in requests.items()}}+ return {"request": request, "requestSha256": digest, "disposableRun": run if disposable else "",+ "storagePrefix": scope.prefix, "requests": requests}def main() -> None:result = allocate(dict(os.environ))- # Job outputs feed the build legs of THIS run (one dispatch). The summary- # stays informational; the printed commands are no longer required.+ outputs = {+ "channel_build": result["request"]["buildId"],+ "channel_request_sha256": result["requestSha256"],+ "public_base": channel_public_base(),+ }+ if result["disposableRun"]:+ outputs["disposable_run"] = result["disposableRun"]+ outputs["storage_prefix"] = result["storagePrefix"]+ # Job outputs feed the build legs of THIS run (one dispatch). The summary is+ # informational; the request is consumed through job outputs.if os.environ.get("GITHUB_OUTPUT"):with Path(os.environ["GITHUB_OUTPUT"]).open("a", encoding="utf-8") as stream:- stream.write("".join(f"{key}={value}\n" for key, value in {- "channel_build": result["request"]["buildId"],- "channel_request_sha256": result["requestSha256"],- "disposable_run": result["disposableRun"],- "public_base": channel_public_base(),- "storage_prefix": result["storagePrefix"],- }.items()))- summary = ("## Disposable channel allocation\n\n"- "CAS, stale-writer rejection, listing and public readback passed. "- "No native build or production record was published.\n\n"- f"Storage prefix: `{result['storagePrefix']}`\n\n"- "This run's build legs consume the allocation through job outputs; "- "no separate follow-up dispatch is needed. The command below is "- "informational only:\n\n" + "\n\n".join(- f"### {slot}\n```sh\n{shlex.join(cmd)}\n```" for slot, cmd in result["commands"].items()) + "\n")+ stream.write("".join(f"{key}={value}\n" for key, value in outputs.items()))+ if result["disposableRun"]:+ title = "## Disposable channel allocation\n\n"+ note = ("CAS, stale-writer rejection, listing and public readback passed. "+ "No native build or production record was published.")+ prefix = f"Storage prefix: `{result['storagePrefix']}`"+ else:+ title = "## Channel allocation\n\n"+ note = "Created the channel and allocated this build's immutable request in the production namespace."+ prefix = f"Channel: `{result['request']['channel']}` · build `{result['request']['buildId']}`"+ summary = (title + note + "\n\n" + prefix + "\n")with Path(os.environ["GITHUB_STEP_SUMMARY"]).open("a", encoding="utf-8") as stream:stream.write(summary)print(json.dumps(result, sort_keys=True))if __name__ == "__main__":- main()+ main()\ No newline at end of filediff --git a/scripts/releases/channels.py b/scripts/releases/channels.pyindex 5064c123400..b115f6363c6 100644--- a/scripts/releases/channels.py+++ b/scripts/releases/channels.py@@ -186,7 +186,9 @@ class ChannelPublisher:if controller_commit is not None:request["controllerCommit"] = controller_commitvalidate_request(request, repository=self.repository, base_url=self.public_base)- # Distinguish competing allocations with otherwise identical CAS bodies.+ # Distinguish competing allocations: the build ID makes otherwise+ # identical CAS bodies unique, so a loser's readback recovery can+ # never mistake another allocation's write for its own.updated = {**record, "revision": record["revision"] + 1, "nextSequence": sequence + 1,"lastAllocation": {"buildId": request["buildId"], "sequence": sequence}}try:@@ -238,25 +240,12 @@ class ChannelPublisher:if {k: v for k, v in pinned.items() if k != "sequence"} != {k: v for k, v in request.items() if k != "sequence"}:raise ChannelError("Protected immutable request differs from accepted release")return pinned- # Retain the request in the CAS reservation so a lost request PUT can- # resume with its original sequence, including after process restart.- last = record.get("lastAllocation", {})- if last.get("buildId") == build_id and last.get("request"):- request = last["request"]- else:- if last.get("request"):- # Flush a prior interrupted reservation before replacing its- # recovery slot. Otherwise retries would allocate new inputs.- prior_key = build_prefix(last["buildId"]) + "request.json"- self._write(prior_key, last["request"])- updated = {**record, "revision": record["revision"] + 1,- "nextSequence": request["sequence"] + 1,- "lastAllocation": {"buildId": build_id, "sequence": request["sequence"],- "request": request}}- try:- self._write(channel_key(name), updated, etag)- except ChannelConflict:- continue+ updated = {**record, "revision": record["revision"] + 1,+ "nextSequence": request["sequence"] + 1}+ try:+ self._write(channel_key(name), updated, etag)+ except ChannelConflict:+ continuetry:self._write(key, request)except ChannelConflict:diff --git a/scripts/releases/r2_scope.py b/scripts/releases/r2_scope.pyindex b2d4ad42a5e..5953dd3066b 100644--- a/scripts/releases/r2_scope.py+++ b/scripts/releases/r2_scope.py@@ -91,4 +91,12 @@ def channel_public_base(explicit: str | None = None) -> str:raise ValueError("Disposable channel archive authority mismatch")return expectedfrom hermes_cli.release_channels import public_base- return public_base(explicit if explicit is not None else configured)+ if explicit is not None:+ return public_base(explicit)+ if not configured:+ # The documented production origin is the default, exactly as the+ # commit-build path (r2.public_base_url) does, so a local command can+ # name the page it is about to publish without hand-setting the URL.+ from scripts.releases.r2 import DEFAULT_PUBLIC_URL+ configured = DEFAULT_PUBLIC_URL+ return public_base(configured)diff --git a/tests/ci/test_channel_build_publication.py b/tests/ci/test_channel_build_publication.pyindex 059cfc12000..006f07bc168 100644--- a/tests/ci/test_channel_build_publication.py+++ b/tests/ci/test_channel_build_publication.py@@ -390,7 +390,7 @@ def test_disposable_controller_allocates_then_separate_admission(tmp_path):"GITHUB_WORKFLOW_REF": "fixture/repo/.github/workflows/desktop-bundled-release.yml@refs/heads/main","GITHUB_ACTOR": "fixture", "GITHUB_TRIGGERING_ACTOR": "fixture", "UPLOAD_RELEASE": "false","GITHUB_STEP_SUMMARY": str(tmp_path / "allocation.md"), "BUNDLE_ENV_JSON": "{}"}- script = workflow_step("desktop-bundled-release.yml", "validate", "Probe scoped storage and allocate the disposable channel")+ script = workflow_step("desktop-bundled-release.yml", "validate", "Allocate the channel and build its immutable request")objects["releases/channels/stable.json"] = b"production sentinel"result = run_shell(tmp_path, server, script, env, cwd=clone)assert result.returncode == 0, result.stdout + result.stderr@@ -398,8 +398,7 @@ def test_disposable_controller_allocates_then_separate_admission(tmp_path):request = allocation["request"]assert request["publicBase"] == url + "/bucket/ci-disposable/12345/98765"assert allocation["storagePrefix"] == "ci-disposable/12345/98765/"- assert "disposable_run=98765" in allocation["command"]- assert "channel_build=" + request["buildId"] in allocation["command"]+ assert allocation["disposableRun"] == "98765"assert objects["releases/channels/stable.json"] == b"production sentinel"assert all(key.startswith(allocation["storagePrefix"]) for method, key in requests if method == "PUT")before = dict(objects)diff --git a/tests/ci/test_desktop_release_tag_admission.py b/tests/ci/test_desktop_release_tag_admission.pyindex 9091e811894..508f1f83620 100644--- a/tests/ci/test_desktop_release_tag_admission.py+++ b/tests/ci/test_desktop_release_tag_admission.py@@ -69,7 +69,7 @@ def test_signing_jobs_pin_source_and_controller_revisions_not_mutable_tags():if name in {"publish-channel"} or step.get("if") == "needs.validate.outputs.channel-build != ''":expected = "${{ github.sha }}"elif name == "validate":- expected = "${{ (inputs.build_commit != '' || inputs.channel_build != '') && github.sha || inputs.tag }}"+ expected = "${{ (inputs.build_commit != '' || inputs.channel != '') && github.sha || inputs.tag }}"elif name == "assemble-win32-bundle":expected = "${{ needs.validate.outputs.channel-build != '' && github.sha || needs.validate.outputs.sha }}"assert ref == expected, (diff --git a/tests/scripts/test_release_channel_build.py b/tests/scripts/test_release_channel_build.pyindex 8c73ef476bf..b18c393107b 100644--- a/tests/scripts/test_release_channel_build.py+++ b/tests/scripts/test_release_channel_build.py@@ -1,15 +1,8 @@-"""Channel dispatch freezes a real pushed Git commit before allocating inputs."""-import hashlib-import importlib.util-from pathlib import Path+"""Channel dispatch names an exact pushed Git commit; CI allocates and builds."""import subprocessimport pytest-_spec = importlib.util.spec_from_file_location("channel_http_fixture", Path(__file__).with_name("test_release_channels.py"))-_fixture = importlib.util.module_from_spec(_spec)-_spec.loader.exec_module(_fixture)-def git(repo, *args):return subprocess.check_output(["git", *args], cwd=repo, text=True, encoding="utf-8").strip()@@ -33,44 +26,39 @@ def source(tmp_path):return repo-def test_dry_run_never_allocates_and_dispatch_is_bound_to_pushed_source(source):+def test_dispatch_names_channel_and_binds_to_pushed_source(source):from scripts.releases.channel_build import prepare_build- from hermes_cli.release_channels import canonical_json- with _fixture.object_server() as (url, objects, headers, requests, faults):- pub = _fixture.publisher(url)- calls = []- options = dict(name="custom-branch", revision="main", remote="origin", repo=source,- repository="example/hermes-agent", default_branch="main", publisher=pub,- dispatch=calls.append, bundle_env={"FEATURE": "a"}, controller_commit="c" * 40)- dry = prepare_build(**options)- assert dry["commit"] == git(source, "rev-parse", "HEAD")- assert not calls and not objects- admitted = prepare_build(**options, publish=True)- request = admitted["request"]- assert request["commit"] == dry["commit"] and request["sourceVersion"] == "1.2.3"- command = calls.pop()- assert "desktop-bundled-release.yml" in command- assert "channel_build=" + request["buildId"] in command- assert "channel_request_sha256=" + hashlib.sha256(canonical_json(request)).hexdigest() in command- assert "--ref" in command and command[command.index("--ref") + 1] == "main"- assert not any(value.startswith("build_commit=") for value in command)- git(source, "commit", "--allow-empty", "--quiet", "-m", "Unpublished")- with pytest.raises(ValueError, match="pushed"):- prepare_build(**options, publish=True)- assert not calls- assert pub.request(request["buildId"])["commit"] == dry["commit"]---def test_missing_controller_branch_is_rejected_without_channel_creation(source):+ calls = []+ options = dict(name="custom-branch", revision="main", remote="origin", repo=source,+ repository="example/hermes-agent", default_branch="main",+ dispatch=calls.append, bundle_env={"FEATURE": "a"})+ dry = prepare_build(**options)+ assert dry["commit"] == git(source, "rev-parse", "HEAD")+ assert dry["sourceVersion"] == "1.2.3"+ assert not calls+ command = dry["command"]+ assert "desktop-bundled-release.yml" in command+ assert "channel=custom-branch" in command+ assert "build_commit=" + dry["commit"] in command+ assert any(value.startswith("bundle_env=") for value in command)+ assert "--ref" in command and command[command.index("--ref") + 1] == "main"+ admitted = prepare_build(**options, publish=True)+ assert calls == [command]+ assert admitted["commit"] == dry["commit"]+ # An unpublished commit is never dispatched.+ git(source, "commit", "--allow-empty", "--quiet", "-m", "Unpublished")+ with pytest.raises(ValueError, match="pushed"):+ prepare_build(**options, publish=True)+ assert len(calls) == 1+++def test_missing_default_branch_is_rejected_without_dispatch(source):from scripts.releases.channel_build import prepare_buildfrom hermes_cli.release_channels import ChannelError- with _fixture.object_server() as (url, objects, headers, requests, faults):- pub = _fixture.publisher(url)- with pytest.raises(ChannelError, match="default branch"):- prepare_build(name="invalid-controller", revision="main", remote="origin", repo=source,- repository="example/hermes-agent", default_branch="absent", publisher=pub,- dispatch=lambda command: pytest.fail("must not dispatch"), publish=True)- assert not objects+ with pytest.raises(ChannelError, match="default branch"):+ prepare_build(name="invalid-controller", revision="main", remote="origin", repo=source,+ repository="example/hermes-agent", default_branch="",+ dispatch=lambda command: pytest.fail("must not dispatch"), publish=True)def test_disposable_scope_is_opt_in_and_lease_bound(monkeypatch):@@ -116,27 +104,4 @@ def test_release_parser_preserves_plain_oneoff_dispatch(monkeypatch):monkeypatch.setattr(sys, "argv", ["release.py", "--channels", "--bundle-env", "X=y"])with pytest.raises(SystemExit) as incompatible:release.main()- assert incompatible.value.code == 2- monkeypatch.setattr(channel_build, "cmd_channel", lambda args: calls.append(("resume", args.resume_channel_build)))- monkeypatch.setattr(sys, "argv", ["release.py", "--resume-channel-build", "a" * 32, "--request-sha256", "b" * 64])- release.main()- assert calls[-1] == ("resume", "a" * 32)---def test_dispatch_retry_uses_same_immutable_request_and_no_new_sequence(source):- from scripts.releases import channel_build- from hermes_cli.release_channels import canonical_json, ChannelError- with _fixture.object_server() as (url, objects, headers, requests, faults):- pub = _fixture.publisher(url)- calls = []- admitted = channel_build.prepare_build(name="resume", revision="main", remote="origin", repo=source,- repository="example/hermes-agent", default_branch="main", publisher=pub,- dispatch=calls.append, publish=True)- request = admitted["request"]- before = pub._read("resume")[0]- digest = hashlib.sha256(canonical_json(request)).hexdigest()- channel_build.resume_build(request["buildId"], digest, publisher=pub, default_branch="main", dispatch=calls.append)- assert calls[-1] == calls[0]- assert pub._read("resume")[0] == before- with pytest.raises(ChannelError, match="SHA256"):- channel_build.resume_build(request["buildId"], "0" * 64, publisher=pub, default_branch="main", dispatch=calls.append)+ assert incompatible.value.code == 2\ No newline at end of filediff --git a/tests/scripts/test_release_channels.py b/tests/scripts/test_release_channels.pyindex 3dc85fe45a9..f26c29956ad 100644--- a/tests/scripts/test_release_channels.py+++ b/tests/scripts/test_release_channels.py@@ -312,8 +312,9 @@ def test_protected_releases_bootstrap_retry_and_refuse_late_or_ungated_promotionversion=version, windows_version=version + ".0", identity=identity,policy="stable-release", release_gate=gate)- # A failed request PUT followed by another release allocation must still- # recover the original sequence, not reinterpret the same build ID.+ # A failed request PUT is not recovered by sequence: retrying the same+ # release adopts a fresh sequence gap, while the deterministic build ID+ # keeps the immutable request idempotent across retries.original_write = pub._writedef lose_request(key, value, etag=None):if key.endswith("request.json"):@@ -322,11 +323,9 @@ def test_protected_releases_bootstrap_retry_and_refuse_late_or_ungated_promotionpub._write = lose_requestwith pytest.raises(OSError):allocate("1.0.0", "a" * 40)- reservation = pub._read("official")[0]["lastAllocation"]["request"]pub._write = original_writeallocate("0.5.0", "e" * 40)first = allocate("1.0.0", "a" * 40)- assert first == reservationassert allocate("1.0.0", "a" * 40) == firstassert len(first["buildId"]) == 32assert pub.reader.resolve("official").manifest is Nonediff --git a/tests/scripts/test_release_r2.py b/tests/scripts/test_release_r2.pyindex 3aef2642de3..0c70df3c91d 100644--- a/tests/scripts/test_release_r2.py+++ b/tests/scripts/test_release_r2.py@@ -113,12 +113,9 @@ def test_disposable_scope_streams_lists_and_never_touches_production(r2_server,with pytest.raises(ValueError):r2.put_object(creds, base, bucket, key, b"x", NOW, None)monkeypatch.delenv("R2_DISPOSABLE_RUN")- monkeypatch.setenv("GITHUB_ACTIONS", "true")- monkeypatch.setenv("GITHUB_REPOSITORY", "fixture/fork")- with pytest.raises(ValueError, match="disposable"):- r2.put_object(creds, base, bucket, key, b"x", NOW, None)+ # Scoping is opt-in via R2_DISPOSABLE_RUN alone: there is no fork isolation+ # to assert after the fork-conditional dispatch was dropped.assert r2_server.requests == before- monkeypatch.delenv("GITHUB_ACTIONS")from scripts.releases.channel_disposable import probefrom scripts.releases.channels import ChannelPublisher, R2ChannelStoreunscoped = ChannelPublisher(R2ChannelStore(creds, base, bucket), "fixture/fork", root,@@ -226,6 +223,18 @@ def test_public_base_url_precedence(monkeypatch):assert public_base_url("https://explicit.example.com/") == "https://explicit.example.com"+def test_channel_public_base_defaults_to_production(monkeypatch):+ # Unscoped channel administration names the same documented production+ # origin the commit-build path falls back to; the public URL is not a+ # secret, so a local command should not have to hand-set it.+ monkeypatch.delenv("CLOUDFLARE_R2_PUBLIC_URL", raising=False)+ monkeypatch.delenv("R2_DISPOSABLE_RUN", raising=False)+ assert channel_public_base() == "https://hermes-assets.nousresearch.com"+ monkeypatch.setenv("CLOUDFLARE_R2_PUBLIC_URL", "https://cdn.example.com")+ assert channel_public_base() == "https://cdn.example.com"+ assert channel_public_base("https://explicit.example.com/") == "https://explicit.example.com"++@pytest.mark.parametrize('key,content_type,immutable', [('releases/tag/v1.2.3/app.msix', 'application/msix', None),('releases/tag/v1.2.3/app.msixbundle', 'application/msixbundle', None),diff --git a/website/docs/developer-guide/stable-releases.md b/website/docs/developer-guide/stable-releases.mdindex a112b06b8ef..7eb98ce1c0f 100644--- a/website/docs/developer-guide/stable-releases.md+++ b/website/docs/developer-guide/stable-releases.md@@ -124,11 +124,12 @@ versions separately. The existing native build and smoke jobs must all passbefore the channel head advances.Preview a custom build, then explicitly dispatch it. Repository identity does-not select behavior: the same direct dispatch runs from any GitHub remote, and-the local command reads and writes the production release namespace with the-configured R2 credentials (every caller already holds the release-signing-secret). The `gh` user must have write, maintain or admin permission on the-selected repository.+not select behavior: the same direct dispatch runs from any GitHub remote, but+`--channel` performs no R2 access locally — it resolves the exact pushed commit+and dispatches the default-branch workflow, whose privileged allocation step+creates the channel and mints the immutable build request in CI. The local+command needs only a `gh` token with write, maintain or admin permission on the+selected repository; no R2 credentials are required.```shpython scripts/release.py --channel pm-preview --build-commit my-branch --remote origin@@ -146,13 +147,13 @@ inputs, not persistent application settings; the repository ID is checkedagainst the selected remote before credentials are read, so a scoped namespacestill belongs to exactly one repository.-The first publishing invocation creates the channel. Later invocations retain-its identity. Requests and artifacts live under+The first publishing invocation creates the channel (during CI allocation), and+later invocations retain its identity. Requests and artifacts live under`releases/channel-builds/BUILD_ID/`; the mutable pointer is`releases/channels/NAME.json`. A failed build leaves its previous head intact.Conditional writes reject stale publication and permanently retired channels.-Use the printed build ID and request digest with `--resume-channel-build` and-`--request-sha256` to retry an admitted request rather than allocate another one.+Retrying re-dispatches `--channel NAME --build-commit SHA --publish`, which+allocates a fresh sequence slot in CI; there is no separate resume command.Retirement pins the current official stable build as the first receiver: