cli: let /teleport take the provider names --provider advertises - #257
Open
Alexsun1one wants to merge 1 commit into
Open
Alexsun1one wants to merge 1 commit into
Alexsun1one wants to merge 1 commit into
Conversation
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.
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.
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
--providerand--sandbox-backendare clap value enums, so they advertiseapple-container,local-process,aws-agentcoreand map those onto the constants./teleporttakes a raw string instead. SinceFromStrnow accepts anything, the typed name is used verbatim, and the constants are snake_case:So the spelling the CLI itself publishes does not resolve, while
--provider apple-containeron the same build does. Same forlocal-processandaws-agentcore.It also fails late.
FromStrcan no longer returnErr, so theinvalid providerguard at the top ofteleport_sandboxis unreachable, and a name that does not resolve is not caught untilstart_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
SandboxProviderArgmapping--provideruses, 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
FromStralone —preserves_sandbox_provider_namespins 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 exo65 passed,cargo fmt --checkandclippyclean.