Skip to content

cli: let /teleport take the provider names --provider advertises - #257

Open
Alexsun1one wants to merge 1 commit into
exoharness:mainfrom
Alexsun1one:fix/teleport-validate-provider
Open

Alexsun1one wants to merge 1 commit into
exoharness:mainfrom
Alexsun1one:fix/teleport-validate-provider

Conversation

@Alexsun1one

Copy link
Copy Markdown
Contributor

Follow-up to #195. Not a disagreement with the open provider set — this is about the one entry point that takes a provider name as free text.

The problem

--provider and --sandbox-backend are clap value enums, so they advertise apple-container, local-process, aws-agentcore and map those onto the constants. /teleport takes a raw string instead. Since FromStr now accepts anything, the typed name is used verbatim, and the constants are snake_case:

/teleport apple-container   ->  SandboxProvider("apple-container")
registry has              ->  SandboxProvider("apple_container")

So the spelling the CLI itself publishes does not resolve, while --provider apple-container on the same build does. Same for local-process and aws-agentcore.

It also fails late. FromStr can no longer return Err, so the invalid provider guard at the top of teleport_sandbox is unreachable, and a name that does not resolve is not caught until start_sandbox — after the snapshot has already been taken. A typo costs a full snapshot before it reports anything.

The fix

Resolve the built-ins through the same SandboxProviderArg mapping --provider uses, so there is still one table of spellings rather than a second alias list that can drift from it. Anything clap does not recognize is a provider this build does not define, so it passes through verbatim and out-of-tree registrations are unaffected. The unreachable guard goes with it.

I left FromStr alone — preserves_sandbox_provider_names pins the permissive behavior deliberately, and this belongs at the CLI boundary rather than in the type.

Verification

Two tests in tui.rs: the advertised spellings resolve to the constants, and an unknown name (my-own-vm) still passes through untouched. The first fails without the change. cargo test -p exo --bin exo 65 passed, cargo fmt --check and clippy clean.

Since sandbox providers became an open set, any string parses, so
/teleport uses the name typed at the prompt verbatim. exo registers its
own providers under the snake_case constants while --provider advertises
the kebab-case spellings, so `/teleport apple-container` — the spelling
the CLI itself publishes — no longer resolves to `apple_container`, and
because parsing can no longer fail the name is not rejected up front:
the mismatch only surfaces after the sandbox has already been
snapshotted.

Route the built-ins through the same mapping --provider uses, so one
spelling works at both entry points, and pass any other name through
untouched so out-of-tree providers still reach their registration. The
`invalid provider` guard that could no longer fire goes with it.
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