From b603e05043ca8ecdb4852351308bbca95d9cd1ad Mon Sep 17 00:00:00 2001 From: A <258483684+la14-1@users.noreply.github.com> Date: Thu, 19 Feb 2026 03:23:55 -0800 Subject: [PATCH] fix: remove duplicate API key + model selection in spawn_agent() (#1462) Steps 3-4 (get_or_prompt_api_key and model selection) were executed twice in spawn_agent() -- once before provisioning and once after. This caused redundant HTTP validation calls to openrouter.ai/api for every agent deployment (~130+ scripts use spawn_agent). The duplicate step numbering in comments (3,4,5 then 4,5,6) confirms this was accidental. Agent: code-health Co-authored-by: B <6723574+louisgv@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.5 --- shared/common.sh | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/shared/common.sh b/shared/common.sh index f5bfc3fb..423cd37c 100644 --- a/shared/common.sh +++ b/shared/common.sh @@ -1720,15 +1720,7 @@ spawn_agent() { server_name=$(get_server_name) cloud_provision "${server_name}" - # 4. Get API key while server provisions (overlaps with cloud-init) - get_or_prompt_api_key - - # 5. Model selection while server provisions (if agent needs it) - if [[ -n "${AGENT_MODEL_PROMPT:-}" ]]; then - MODEL_ID=$(get_model_id_interactive "${AGENT_MODEL_DEFAULT:-openrouter/auto}" "${agent_name}") || exit 1 - fi - - # 6. Wait for readiness (may already be done after OAuth) + # 6. Wait for readiness cloud_wait_ready # 7. Install agent