The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(ci): the install.sh protocol lane verifies without a source stamp
ethernetfd49308813b5
diff --git a/.github/workflows/bootstrap-installer.yml b/.github/workflows/bootstrap-installer.ymlindex b16d28bc23b..6598d5b00aa 100644--- a/.github/workflows/bootstrap-installer.yml+++ b/.github/workflows/bootstrap-installer.yml@@ -99,7 +99,8 @@ jobs:--stamp "$HERMES_INSTALL_DIR/.hermes-bootstrap-complete" \--repo "$HERMES_INSTALL_DIR" \--expect-commit "${{ steps.source.outputs.sha }}" \- --expect-branch ci-under-test+ --expect-branch ci-under-test \+ --no-source-stamp # the protocol check above skips the products stage- name: The pinned commit is on the branch the installer clonedshell: bashdiff --git a/scripts/verify-bootstrap-version-stamp.py b/scripts/verify-bootstrap-version-stamp.pyindex f239373cc15..a95f8bc23c5 100644--- a/scripts/verify-bootstrap-version-stamp.py+++ b/scripts/verify-bootstrap-version-stamp.py@@ -88,7 +88,8 @@ def _git(repo: Path, *args: str) -> str | None:return value if result.returncode == 0 and value else None-def verify_stamp(stamp_path: Path, repo: Path, expect_commit: str | None, expect_branch: str | None) -> list[str]:+def verify_stamp(stamp_path: Path, repo: Path, expect_commit: str | None, expect_branch: str | None,+ *, source_stamp: bool = True) -> list[str]:errors: list[str] = []try:@@ -145,17 +146,18 @@ def verify_stamp(stamp_path: Path, repo: Path, expect_commit: str | None, expectelif actual and actual != "HEAD" and actual != branch:_fail(errors, f"pinnedBranch {branch!r} != checked-out branch {actual!r}")- # The install must carry its source identity stamp, and that stamp must- # tell the truth about the checkout: commit == HEAD. baseVersion is null- # when no release tag is reachable (a PR checkout), exactly as the runtime- # reports it.- present, canonical_commit = _read_install_stamp(repo)- if not present:- _fail(errors, f"no {repo}/install-stamp.json — the install carries no source identity stamp")- elif not canonical_commit:- _fail(errors, f"{repo}/install-stamp.json names no commit")- elif head and canonical_commit != head:- _fail(errors, f"canonical stamp commit {canonical_commit[:12]} != installed HEAD {head[:12]}")+ # A working install carries its source identity stamp (written by the+ # products stage), and it must tell the truth about the checkout:+ # commit == HEAD. baseVersion is null when no release tag is reachable+ # (a PR checkout), exactly as the runtime reports it.+ if source_stamp:+ present, canonical_commit = _read_install_stamp(repo)+ if not present:+ _fail(errors, f"no {repo}/install-stamp.json — the install carries no source identity stamp")+ elif not canonical_commit:+ _fail(errors, f"{repo}/install-stamp.json names no commit")+ elif head and canonical_commit != head:+ _fail(errors, f"canonical stamp commit {canonical_commit[:12]} != installed HEAD {head[:12]}")return errors@@ -179,10 +181,13 @@ def main() -> int:parser.add_argument("--repo", required=True, help="The install checkout the stamp describes")parser.add_argument("--expect-commit", default=None, help="Fail unless pinnedCommit equals this sha")parser.add_argument("--expect-branch", default=None, help="Fail unless pinnedBranch equals this branch")+ parser.add_argument("--no-source-stamp", action="store_true",+ help="The run skipped the products stage, which writes install-stamp.json")args = parser.parse_args()errors = verify_stamp(- Path(args.stamp), Path(args.repo), args.expect_commit, args.expect_branch+ Path(args.stamp), Path(args.repo), args.expect_commit, args.expect_branch,+ source_stamp=not args.no_source_stamp,)if errors:for e in errors:diff --git a/tests/scripts/test_verify_bootstrap_version_stamp.py b/tests/scripts/test_verify_bootstrap_version_stamp.pyindex c78aa6b0cbf..3f54ea87495 100644--- a/tests/scripts/test_verify_bootstrap_version_stamp.py+++ b/tests/scripts/test_verify_bootstrap_version_stamp.py@@ -86,6 +86,8 @@ def _install_repo(tmp_path: Path) -> Path:({"canonicalCommit": "c" * 40}, [], "canonical"),# A checkout with no reachable release tag honestly stamps a null base.({"canonicalBase": None}, [], None),+ # The protocol lane never runs the products stage that writes the stamp.+ ({"missing": "version"}, ["--no-source-stamp"], None),])def test_verifier_cli(tmp_path, changes, expect, error):repo = _install_repo(tmp_path)@@ -102,7 +104,7 @@ def test_verifier_cli(tmp_path, changes, expect, error):canonical["baseVersion"] = changes.get("canonicalBase", canonical["baseVersion"])(repo / "install-stamp.json").write_text(json.dumps(canonical), encoding="utf-8")if not error:- expect = ["--expect-commit", stamp["pinnedCommit"], "--expect-branch", "main"]+ expect = ["--expect-commit", stamp["pinnedCommit"], "--expect-branch", "main", *expect]env = dict(os.environ)if os.name == "nt":env.setdefault("SystemRoot", r"C:\Windows")