From 56fda1435a758d06d1b0d63812fe2abd57c80916 Mon Sep 17 00:00:00 2001 From: A <258483684+la14-1@users.noreply.github.com> Date: Wed, 18 Feb 2026 09:54:51 -0800 Subject: [PATCH] feat: collect all auth prompts before server provisioning (#1445) Move OpenRouter OAuth and model selection prompts to run BEFORE server provisioning in spawn_agent(). Previously the user had to wait for the server to spin up before being prompted for their API key and model choice. Now all interactive prompts (GitHub auth, OpenRouter OAuth, model selection) happen upfront, then the server provisions without further user interaction. Co-authored-by: lab <6723574+louisgv@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 (1M context) --- shared/common.sh | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/shared/common.sh b/shared/common.sh index 7f63bf75..50c4f94a 100644 --- a/shared/common.sh +++ b/shared/common.sh @@ -1567,27 +1567,27 @@ spawn_agent() { # 2. Pre-provision hooks (e.g., prompt for GitHub auth) if _fn_exists agent_pre_provision; then agent_pre_provision; fi - # 3. Provision server + # 3. Get API key (before provisioning so user isn't waiting on server) + get_or_prompt_api_key + + # 4. Model selection (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 + + # 5. Provision server local server_name server_name=$(get_server_name) cloud_provision "${server_name}" - # 4. Wait for readiness + # 6. Wait for readiness cloud_wait_ready - # 5. Install agent + # 7. Install agent if _fn_exists agent_install; then agent_install || exit 1 fi - # 6. Get API key - get_or_prompt_api_key - - # 7. Model selection (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 - # 8. Inject environment variables _spawn_inject_env_vars