ucode: add --skip-preflight to skip per-launch auth/gateway re-validation#195
Open
Edwinhe03 wants to merge 1 commit into
Open
ucode: add --skip-preflight to skip per-launch auth/gateway re-validation#195Edwinhe03 wants to merge 1 commit into
Edwinhe03 wants to merge 1 commit into
Conversation
ddf72cd to
2ef7d98
Compare
lilly-luo
reviewed
Jul 10, 2026
lilly-luo
reviewed
Jul 10, 2026
2ef7d98 to
e05650b
Compare
Collaborator
|
this is great! can you put the --help outputs on the PR description and have some examples to confirm this is working? before merge |
lilly-luo
previously approved these changes
Jul 10, 2026
f3fe6a7 to
5782bcf
Compare
…tion 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. Add a launch-only `--skip-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(skip_preflight=True). configure_shared_state now assembles the shared workspace state (profile, base URLs, auth mode) up front and returns early when skip_preflight is set; otherwise it falls through into the preflight block (auth + AI Gateway validation, then model discovery). The PAT/bearer is already exported by apply_pat_environment and the gateway was verified by the earlier configure, so the skipped work is redundant, and the saved model lists are preserved. Wired into every launch command (codex/claude/gemini/opencode/copilot/pi), default off. Co-authored-by: Isaac
5782bcf to
c21003a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Every
ucode <agent>launch re-runsconfigure_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 priorucode configurealready validated all of it. Managed/headless launchers (e.g. omnigent) that runconfigureonce and then launch repeatedly pay this on every turn.Change
Add a launch-only
--skip-preflightflag (distinct from the configure-only--skip-validate, which skips the post-configure model smoke test). It threads through_launch_toolasconfigure_shared_state(skip_preflight=True):configure_shared_stateassembles the shared workspace state (profile, base URLs, auth mode) up front, then returns early whenskip_preflightis set; otherwise it falls through into the preflight block (auth + AI Gateway validation, then model discovery). One function, one shared assembly — no parallel state builder and no invertednot skip_preflightguard.~/.databrickscfgat most once per launch — in the skip branch (trusting the prior configure) or afterdatabricks auth loginon the full path, never both.apply_pat_environment, and the AI Gateway was verified by the earlierconfigure, so the skipped work is redundant. 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.--helpTests
New tests in
tests/test_cli.py:TestConfigureSharedStateSkipPreflight—configure_shared_state(..., skip_preflight=True)makes noensure_databricks_auth/ensure_ai_gateway_v2/get_databricks_token/ model-discovery calls (each patched to raise if hit), still rebuildsbase_urls+ persists state, and resolves the profile whenNone.TestSkipPreflightFlag—--skip-preflighton every launch command threads through_launch_tooltoconfigure_shared_stateasskip_preflight=True(and defaults toFalsewithout the flag).ruff+tyclean.Manual verification
Configured against a real staging workspace (
ucode configure --profiles <p> --agents claude --use-pat), then launched the same agent with and without the flag (claude --versionexecs the real binary and exits, so the launch is observable end-to-end):--skip-preflightdrops the auth + AI Gateway round-trips (7.39s → 0.79s, ~7s saved), and the agent still launches on the correctly-resolved model — confirming the trusted state (base URLs rebuilt, model lists preserved) is intact.This pull request and its description were written by Isaac.