Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(scripts): preserve E2E port defaults when a developer .env is present

Steven Enamakeld8c608d09563
diff --git a/app/scripts/e2e-web-build.sh b/app/scripts/e2e-web-build.sh
index 3b52ea948b..bdb5601844 100755
--- a/app/scripts/e2e-web-build.sh
+++ b/app/scripts/e2e-web-build.sh
@@ -18,14 +18,17 @@ E2E_WEB_CORE_TARGET_DIR="${E2E_WEB_CORE_TARGET_DIR:-$REPO_ROOT/target/e2e-web-${
# Preserve explicit harness ports before loading a developer .env. That file
# may configure normal development, but must not change an E2E bundle's baked
# endpoint or its E2E-only affordances.
-E2E_MOCK_PORT="${E2E_MOCK_PORT:-18473}"
-OPENHUMAN_CORE_PORT="${OPENHUMAN_CORE_PORT:-17788}"
+SELECTED_E2E_MOCK_PORT="${E2E_MOCK_PORT:-18473}"
+SELECTED_OPENHUMAN_CORE_PORT="${OPENHUMAN_CORE_PORT:-17788}"
if [ -f "$REPO_ROOT/.env" ]; then
# shellcheck source=/dev/null
source "$REPO_ROOT/scripts/load-dotenv.sh"
fi
+E2E_MOCK_PORT="$SELECTED_E2E_MOCK_PORT"
+OPENHUMAN_CORE_PORT="$SELECTED_OPENHUMAN_CORE_PORT"
+
# Apply E2E settings after .env so it cannot produce a non-E2E bundle with a
# valid marker. Keep this immediately before the build that consumes them.
export VITE_BACKEND_URL="http://127.0.0.1:${E2E_MOCK_PORT}"
diff --git a/scripts/__tests__/e2e-web-bundle-guard.test.mjs b/scripts/__tests__/e2e-web-bundle-guard.test.mjs
index 7116b35c95..a14a9eba2f 100644
--- a/scripts/__tests__/e2e-web-bundle-guard.test.mjs
+++ b/scripts/__tests__/e2e-web-bundle-guard.test.mjs
@@ -45,6 +45,11 @@ function makeTree(script) {
path.join(repoRoot, "app", "scripts", script),
path.join(root, "app", "scripts", script),
);
+ fs.mkdirSync(path.join(root, "scripts"), { recursive: true });
+ fs.copyFileSync(
+ path.join(repoRoot, "scripts", "load-dotenv.sh"),
+ path.join(root, "scripts", "load-dotenv.sh"),
+ );
// Every stub records that it ran, so a test can prove what was reached.
const record = (name) => `echo "${name} $*" >> "${log}"`;
@@ -166,6 +171,10 @@ test("the session accepts a marked bundle and proceeds past the guard", () => {
test("e2e-web-build.sh marks the bundle it builds, recording the E2E settings", () => {
const tree = makeTree("e2e-web-build.sh");
try {
+ fs.writeFileSync(
+ path.join(tree.root, ".env"),
+ "E2E_MOCK_PORT=28473\nOPENHUMAN_CORE_PORT=27788\n",
+ );
const res = run(tree, "e2e-web-build.sh");
assert.equal(res.status, 0, res.output);
@@ -175,6 +184,7 @@ test("e2e-web-build.sh marks the bundle it builds, recording the E2E settings",
assert.match(recorded, /^VITE_OPENHUMAN_TARGET=web$/m);
assert.match(recorded, /^VITE_OPENHUMAN_E2E_DEFAULT_CORE_MODE=cloud$/m);
assert.match(recorded, /^VITE_BACKEND_URL=http:\/\/127\.0\.0\.1:18473$/m);
+ assert.match(recorded, /^VITE_OPENHUMAN_CORE_RPC_URL=http:\/\/127\.0\.0\.1:17788\/rpc$/m);
} finally {
tree.cleanup();
}