The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(install-e2e): make mock_start idempotent, keeping its config rewrite
ethernetfd942fdf31d8
diff --git a/tests/install/e2e-assets/mock-provider.sh b/tests/install/e2e-assets/mock-provider.shindex ac544cf06f6..16f85c8cad1 100755--- a/tests/install/e2e-assets/mock-provider.sh+++ b/tests/install/e2e-assets/mock-provider.sh@@ -22,6 +22,25 @@ mock_start() {local workroot="${1:?mock_start needs a workroot}"MOCK_PIDFILE="$workroot/mock.pid"MOCK_URLFILE="$workroot/mock.url"++ # Idempotent: a mock that is still live from earlier in this run is REUSED. Its+ # URL is what the install is already configured with, so re-writing the config+ # below leaves .env byte-identical -- a NEW instance would take a new port, and+ # the user-state verifier would report that as the upgrade rewriting .env+ # (an equal-size OPENAI_BASE_URL swap, invisible in the file hash).+ if [ -s "$MOCK_URLFILE" ] && [ -s "$MOCK_PIDFILE" ] \+ && kill -0 "$(cat "$MOCK_PIDFILE" 2>/dev/null)" 2>/dev/null; then+ local live_url+ live_url="$(cat "$MOCK_URLFILE")"+ export HERMES_E2E_MOCK_URL="$live_url"+ ok "mock inference server already live: $live_url"+ # The config write is NOT optional: this is what re-points the app at a live+ # endpoint, and callers that only want that (the app-update flow, whose app+ # reads config.yaml/.env rather than the env var) depend on it.+ mock_configure_provider "$live_url"+ return 0+ fi+rm -f "$MOCK_PIDFILE" "$MOCK_URLFILE"# Bare `node file.ts` type-stripping works on node >=22.18 (the images@@ -43,7 +62,11 @@ mock_start() {url="$(cat "$MOCK_URLFILE")"export HERMES_E2E_MOCK_URL="$url"ok "mock inference server: $url"+ mock_configure_provider "$url"+}+mock_configure_provider() {+ local url="${1:?mock_configure_provider needs a url}"node "$ASSETS/../../../tests-js/scripts/mock-provider-config.ts" "$HERMES_HOME" "$url" || fail "mock provider config failed"ok "configured in $HERMES_HOME as an OpenAI-compatible endpoint (api $url/v1)"}diff --git a/tests/install/installer-script-e2e.sh b/tests/install/installer-script-e2e.shindex 62aea998dda..a46690f11f5 100755--- a/tests/install/installer-script-e2e.sh+++ b/tests/install/installer-script-e2e.sh@@ -378,17 +378,14 @@ case "$UPDATE_METHOD" in# overlay (a fullscreen div that intercepts every click) - and the chat# surface is real too.#- # That configuration already happened ABOVE (or comes from the caller's- # HERMES_E2E_MOCK_URL), before preserve_before_upgrade snapshotted the home.- # Starting a second mock HERE is what made this leg report "the upgrade- # changed the user's own state": a fresh instance takes a new port, so .env's- # OPENAI_BASE_URL is rewritten -- same byte length, different value -- after- # the snapshot, and the verifier blames the upgrade for the harness's own- # write. Reuse the live mock; if it died, fail loudly rather than silently- # reconfiguring provider state inside the window under verification.+ # mock_start is idempotent: the mock started above for this run is still+ # live, so it is reused (a new instance would take a new port and rewrite+ # .env's OPENAI_BASE_URL after the preservation snapshot, which the verifier+ # rightly reports as the upgrade touching user state) while the provider+ # config is still (re)written to point at it -- that rewrite is why this+ # call is here at all, since the app reads config.yaml/.env, not the env var.source "$ASSETS/mock-provider.sh"- [ -n "${HERMES_E2E_MOCK_URL:-}" ] || [ -s "$WORK_ROOT/mock.url" ] \- || fail "no mock provider is configured for the app-update phase"+ PATH="$(dirname "$HERMES_E2E_NODE"):$PATH" mock_start "$WORK_ROOT"trap mock_stop EXITstep "capturing the hermes desktop launch spec (build runs for real)"