Skip to content

ucode: add --no-preflight to skip per-launch auth/gateway re-validation#195

Open
Edwinhe03 wants to merge 1 commit into
databricks:mainfrom
Edwinhe03:edwin-he/ucode-no-preflight
Open

ucode: add --no-preflight to skip per-launch auth/gateway re-validation#195
Edwinhe03 wants to merge 1 commit into
databricks:mainfrom
Edwinhe03:edwin-he/ucode-no-preflight

Conversation

@Edwinhe03

@Edwinhe03 Edwinhe03 commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

What

Every ucode <agent> launch re-runs configure_shared_state, which does an auth login check, a token fetch, an AI Gateway v2 probe, and (outside provider mode) model discovery — ~5–10s of network round-trips — even when a prior ucode configure already validated all of it. Managed/headless launchers (e.g. omnigent) that run configure once and then launch repeatedly pay this on every turn.

Change

Add a launch-only --no-preflight flag (distinct from the configure-only --skip-validate, which skips the post-configure model smoke test). It threads through _launch_tool as configure_shared_state(no_preflight=True), which skips the auth+gateway block and model discovery entirely:

  • The PAT/bearer is already exported by apply_pat_environment, and the AI Gateway was verified by the earlier configure, so the re-checks are redundant.
  • Local profile resolution, base-URL rebuild, and state persistence still run; previously-discovered model lists are preserved (not clobbered with empties).

Wired into every launch command (codex / claude / gemini / opencode / copilot / pi). Default off — behavior is unchanged unless a caller opts in.

Verification

  • Full unit suite green (858 passed, 8 skipped); ruff + ty clean.
  • New tests: configure_shared_state(no_preflight=True) does not call ensure_databricks_auth / ensure_ai_gateway_v2, still rebuilds base_urls + persists state; --no-preflight on a launch command threads through to _launch_tool.

This pull request and its description were written by Isaac.

Every `ucode <agent>` launch re-runs configure_shared_state, which does an auth
login check, a token fetch, an AI Gateway v2 probe, and per-launch model
discovery — ~5-10s of network round-trips — even when a prior `ucode configure`
already validated all of it. Managed/headless launchers (e.g. omnigent) that run
configure once and then launch repeatedly pay this cost on every turn.

Add a launch-only `--no-preflight` flag (distinct from the configure-only
`--skip-validate`, which skips the post-configure model smoke test). It threads
through _launch_tool as configure_shared_state(no_preflight=True), which skips
the auth+gateway block and model discovery entirely — the PAT/bearer is already
exported by apply_pat_environment and the gateway was verified by the earlier
configure. The local profile resolution, base-URL rebuild, and state persistence
still run, and previously-discovered model lists are preserved rather than
clobbered with empties.

Wired into every launch command (codex/claude/gemini/opencode/copilot/pi).

Co-authored-by: Isaac
@Edwinhe03 Edwinhe03 force-pushed the edwin-he/ucode-no-preflight branch from ddf72cd to 2ef7d98 Compare July 9, 2026 00:33
@Edwinhe03 Edwinhe03 requested a review from lilly-luo July 9, 2026 00:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant