From 8fd9fcdadde7b49232acda84cfecbfcbbcc3619b Mon Sep 17 00:00:00 2001 From: hermes Date: Fri, 16 Oct 2026 06:07:47 +0000 Subject: [PATCH] test(agents): a cold npm cache per agent with --npx All agents shared one npm cache, so only the first ran a cold `npx -y idx-mcp` install and the others reused its installed binary, never exercising their own first-run install. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01V3syn2fN2LNo5pvTSqc6eh --- tests/agents/agent-smoke.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/agents/agent-smoke.sh b/tests/agents/agent-smoke.sh index 79d3f78..01a1462 100755 --- a/tests/agents/agent-smoke.sh +++ b/tests/agents/agent-smoke.sh @@ -128,10 +128,9 @@ fi # One server definition for every agent, as {command, args, env}. if [[ -n "$npx_spec" ]]; then # What users configure, so each agent's own npx handling is exercised - # (Hermes swaps in its managed Node). A fresh npm cache makes the first - # agent run a cold install; agents may filter env, so pass it explicitly. - export npm_config_cache="$work/npm-cache" - server_env=("${data_env[@]}" "npm_config_cache=$npm_config_cache") + # (Hermes swaps in its managed Node). Each agent gets a fresh npm cache + # below, so its first run is a cold install. + server_env=("${data_env[@]}") [[ -z "${IDX_BINARY_URL:-}" ]] || server_env+=("IDX_BINARY_URL=$IDX_BINARY_URL") # npx runs a tarball only as a package to install: `npx -y -p file: idx-mcp`. if [[ "$npx_spec" == *.tgz && ! -f "$npx_spec" ]]; then @@ -332,6 +331,12 @@ results="$work/results.jsonl" : > "$results" echo "agent-smoke: agents=${agents[*]} cases=${#case_ids[@]} runs=$runs" for agent in "${agents[@]}"; do + if [[ -n "$npx_spec" ]]; then + # A shared cache would let later agents reuse the first one's install. + # Agents may filter env, so pass it explicitly. + export npm_config_cache="$work/npm-cache/$agent" + server_json="$(jq -c --arg cache "$npm_config_cache" '.env.npm_config_cache = $cache' <<< "$server_json")" + fi "setup_$agent" for id in "${case_ids[@]}"; do case_json="$(jq -c --arg id "$id" '.[] | select(.id == $id)' "$cases_file")"