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) <noreply@anthropic.com>
This commit is contained in:
A 2026-02-18 09:54:51 -08:00 committed by GitHub
parent e4bf4d86a4
commit 56fda1435a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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