Skip to content

The agent that grows with you

fix(bundle): reject unresolved launcher placeholders

ethernet589d9129e6e1
diff --git a/scripts/bundles/payload.py b/scripts/bundles/payload.py
index 23ea0400db5..de5a8189f53 100644
--- a/scripts/bundles/payload.py
+++ b/scripts/bundles/payload.py
@@ -4,6 +4,7 @@ from __future__ import annotations
import argparse
import json
import os
+import re
import shutil
import subprocess
import sys
@@ -117,6 +118,9 @@ def render_wrapper(entry: str, repo: str, site: str) -> str:
if '"' in value or "\n" in value or "__" in value:
raise ValueError(f"invalid launcher value: {key}")
text = text.replace(f"__HERMES_{key}__", value)
+ unresolved = re.search(r"__HERMES_\w+?__", text)
+ if unresolved:
+ raise ValueError(f"unresolved launcher placeholder: {unresolved.group()}")
return text
diff --git a/tests/scripts/test_bundle_payload.py b/tests/scripts/test_bundle_payload.py
index a2342a7f943..706ed62902e 100644
--- a/tests/scripts/test_bundle_payload.py
+++ b/tests/scripts/test_bundle_payload.py
@@ -54,6 +54,16 @@ def test_surfaces_require_complete_outputs_and_replace_stale_files(tmp_path):
plant_surfaces(repo, source)
+def test_wrapper_rejects_unresolved_template_fields(tmp_path, monkeypatch):
+ from scripts.bundles import payload
+
+ template = tmp_path / "launcher_wrapper.py"
+ template.write_text('entry = "__HERMES_ENTRY_MODULE__"\nmissing = "__HERMES_NEW__"\n', encoding="utf-8")
+ monkeypatch.setattr(payload, "__file__", str(tmp_path / "payload.py"))
+ with pytest.raises(ValueError, match="__HERMES_NEW__"):
+ payload.render_wrapper("entry:run", "../app", "../venv/Lib/site-packages")
+
+
def test_launcher_stage_reads_declared_entries_and_drops_stale_names(tmp_path, monkeypatch):
from pathlib import Path
from types import SimpleNamespace