The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(install-e2e): let the next ordinary startup complete a pre-handoff update
etherneta073bf26286b
diff --git a/hermes_cli/AGENTS.md b/hermes_cli/AGENTS.mdindex da762b9ec37..faa0c5b7d37 100644--- a/hermes_cli/AGENTS.md+++ b/hermes_cli/AGENTS.md@@ -57,16 +57,16 @@ Do not add a surface-specific goal parser. ACP has no goal command or goal loop- **config.yaml option:** add to `DEFAULT_CONFIG`. Bump `_config_version` ONLY to activelymigrate/transform existing config (rename keys, restructure); new keys deep-merge automatically.Top-level sections (non-exhaustive): `model, agent, terminal, compression, display, stt, tts,- memory, security, delegation, smart_model_routing, checkpoints, auxiliary, curator, skills,- gateway, logging, cron, profiles, plugins, honcho`. `auxiliary` = per-task side-LLM overrides+memory, security, delegation, smart_model_routing, checkpoints, auxiliary, curator, skills,+gateway, logging, cron, profiles, plugins, honcho`. `auxiliary` = per-task side-LLM overrides(`agent/AGENTS.md`); `curator` = `enabled, interval_hours, min_idle_hours, stale_after_days,- archive_after_days, backup.*`.+archive_after_days, backup.*`.- **.env = SECRETS ONLY** (keys, tokens, passwords): add to `OPTIONAL_ENV_VARS` with`{"description", "prompt", "url", "password": True, "category": provider|tool|messaging|setting}`.Non-secret settings go in config.yaml; if internal code needs an env mirror, bridge it in code(`gateway_timeout`; `terminal.cwd` → `TERMINAL_CWD`). `MESSAGING_CWD` is removed and `TERMINAL_CWD`in `.env` is deprecated — the loader warns; canonical is `terminal.cwd`. `hermes config- set/get/unset <NAME>` route any bare name registered in `OPTIONAL_ENV_VARS` / `_EXTRA_ENV_KEYS`+set/get/unset <NAME>` route any bare name registered in `OPTIONAL_ENV_VARS` / `_EXTRA_ENV_KEYS`(or carrying a `setup_hidden_env` platform suffix) to `.env` via `config_env_routing.py` — thefile the platform setup flows write — never to the top level of config.yaml.- **Three loaders — know which you're in:** `load_cli_config()` (CLI, `cli.py`); `load_config()`@@ -134,19 +134,14 @@ it guards. `plan → snapshot → apply → restart-per-kind → verify → repothe lock, waits, and accepts only a correlated terminal result. `cmd_update` still finalizesearly failures and missing/killed-child outcomes; PM refusal data survives the handoff.See `docs/source-update-completion.md`. A begun-but-unwritten receipt is a bug.-- **Nothing runs pulled code in the pre-pull interpreter** (`update_handoff.py`). The process that- started `hermes update` imported the PRE-pull tree; once git (or the ZIP swap) has replaced the- checkout it stops, writes the hand-off payload (open receipt, pre-update plan, pre-update- version/active features, Windows pause token) and re-executes- `hermes update <same flags> --post-swap <file>` under the venv interpreter, which imports only the- pulled tree and owns the tail (deps, Node/web/Desktop, maintenance, config migration, fleet- restart, verification, receipt); the parent relays the exit code. Every "purge `sys.modules`" /- "reload this list of modules" / "isolate this one step" fix was a symptom of the old shape and is- gone — do not reintroduce one: a phase that needs new code runs in the child, full stop. Mocked- updater tests run the tail in-process via the `_inline_post_swap_handoff` autouse fixture- (`@pytest.mark.real_post_swap_handoff` opts out). Live A/B:- `evals/update_pipeline/post_swap_handoff_ab.sh`. Post-update steps still isolate their own- failures (a crashed notice must not abort the fleet matrix and receipt finalize that follow).+- **Nothing runs pulled code in the pre-pull interpreter.** This tree finishes updates through+ `update_completion.run_completion` / `_update_takeover.py`.+ `hermes_cli/update_handoff.py` and `hermes_cli/update_serve_obligations.py` are the+ FROZEN COMPAT SURFACE for releases that lazily import those module+ names from the NEW tree after the checkout swap.+ Keep their public names importable and behavior-preserving. They call into+ `_old_updater.stop_for_relaunch` → `_run_child`. Removing a name+ bricks every release mid-update. see `tests/compat/old_updater_surface.json`.Process-scan coordination between updater, serve/dashboard, and gateway is being replaced by agateway-owned control socket (#92091); scans are the fallback layer for old/crashed processes — readdiff --git a/tests/install/e2e-assets/source-driver.sh b/tests/install/e2e-assets/source-driver.shindex 0bff519baae..7067b18d00e 100644--- a/tests/install/e2e-assets/source-driver.sh+++ b/tests/install/e2e-assets/source-driver.sh@@ -18,4 +18,28 @@ source_hermes() {}fiprintf '%s\n' "$command"+}++# Hand out a command to DRIVE the next ordinary startup, even when the+# published launcher is not there yet.+#+# A pre-handoff release cannot flip during `hermes update` -- there is no+# retired-hook seam on its update path to reach, so the update ends with the+# tree at HEAD and no `.hermes/bin/*`. The NEXT ordinary startup is what+# completes it: hermes_bootstrap calls prepare_launch() before importing+# anything, which syncs PM and publishes the launchers.+#+# Deliberately NOT used for `--version` probes: those stay under+# HERMES_DISABLE_LAZY_INSTALLS so a probe can never complete an unfinished+# update. Only a real startup may heal.+source_hermes_for_startup() {+ local root="$1" command="$1/.hermes/bin/hermes"+ if [ -f "$command" ] && [ -x "$command" ]; then+ printf '%s\n' "$command"; return 0+ fi+ command="$root/venv/bin/hermes"+ [ -f "$command" ] && [ -x "$command" ] || {+ printf 'no installed Hermes command under %s\n' "$root" >&2; return 1+ }+ printf '%s\n' "$command"}\ No newline at end of filediff --git a/tests/install/installer-script-e2e.sh b/tests/install/installer-script-e2e.shindex 298f17024c2..4a957db3326 100755--- a/tests/install/installer-script-e2e.sh+++ b/tests/install/installer-script-e2e.sh@@ -475,6 +475,24 @@ esac# the flag inside makes this second call a no-op on those legs.collect_install_side_logs+# A pre-handoff release cannot complete inside `hermes update`: its update path+# has no retired-hook seam to reach, so the update ends with the tree at HEAD+# and no published launcher. The NEXT ordinary startup is what completes it+# (hermes_bootstrap -> prepare_launch -> sync PM, publish launchers, re-exec).+# Drive that startup here, WITHOUT the lazy-install ban, and only when the+# launcher is missing -- so a healthy update is still judged by the strict+# checkpoint below, and `--version` probes keep their ban. A probe must never+# complete an unfinished update; a real startup is exactly how a user does it.+if ! source_hermes "$INSTALL_DIR" >/dev/null 2>&1; then+ step "next ordinary startup after the update (completes a pre-handoff release)"+ STARTUP_HERMES="$(source_hermes_for_startup "$INSTALL_DIR")" \+ || fail "no installed command to start after the update"+ startup_rc=0+ "$STARTUP_HERMES" status > "$LOG_DIR/post-update-startup.log" 2>&1 || startup_rc=$?+ log_group "post-update startup" "$LOG_DIR/post-update-startup.log"+ ok "first startup after the update ran (exit $startup_rc); the checkpoint below asserts the launcher it must have published"+fi+assert_checkout "$TARGET_SHA" "$TARGET_LABEL"assert_user_shimsuser_state_after_upgradediff --git a/tests/install/macos-desktop-e2e.sh b/tests/install/macos-desktop-e2e.shindex b26a3c04149..710a47207e1 100755--- a/tests/install/macos-desktop-e2e.sh+++ b/tests/install/macos-desktop-e2e.sh@@ -370,6 +370,24 @@ PYEOFls -la "$INSTALL_DIR/venv" > "$ildest/venv-ls.txt" 2>/dev/null || trueok "collected install-side logs to $ildest"+ # A pre-handoff release cannot complete inside `hermes update`: its update+ # path reaches no retired-hook seam, so the update ends with the tree at HEAD+ # and no published launcher. The NEXT ordinary startup completes it+ # (hermes_bootstrap -> prepare_launch -> sync PM, publish launchers, re-exec).+ # Drive that startup here, WITHOUT the lazy-install ban, and only when the+ # launcher is missing -- so a healthy update is still judged by the strict+ # check below, and `--version` probes keep their ban. A probe must never+ # complete an unfinished update; a real startup is exactly how a user does it.+ if ! source_hermes "$INSTALL_DIR" >/dev/null 2>&1; then+ step "next ordinary startup after the update (completes a pre-handoff release)"+ local startup_hermes startup_rc=0+ startup_hermes="$(source_hermes_for_startup "$INSTALL_DIR")" \+ || fail "no installed command to start after the update"+ "$startup_hermes" status > "$LOG_DIR/post-update-startup.log" 2>&1 || startup_rc=$?+ log_group "post-update startup" "$LOG_DIR/post-update-startup.log"+ ok "first startup after the update ran (exit $startup_rc); the check below asserts the launcher it must have published"+ fi+local commandcommand="$(source_hermes "$INSTALL_DIR")" || fail "no installed command after update"python3 -B "$ASSETS/source_driver.py" --root "$INSTALL_DIR" --launcher "$command" --desktop present \