Skip to content

feat(cli): auto-create providers for explicit --provider names#183

Merged
drew merged 1 commit intomainfrom
feat/auto-create-providers
Mar 9, 2026
Merged

feat(cli): auto-create providers for explicit --provider names#183
drew merged 1 commit intomainfrom
feat/auto-create-providers

Conversation

@drew
Copy link
Copy Markdown
Collaborator

@drew drew commented Mar 9, 2026

Summary

  • When --provider <name> is passed and no provider with that name exists, the CLI now checks if the name is a recognized provider type (e.g. claude, nvidia, github) and auto-creates it from local credentials
  • If the name is not a recognized type, the CLI returns a clear error instead of deferring validation to the server (which returned a cryptic FailedPrecondition gRPC error)
  • Extracted shared auto_create_provider() helper used by both explicit --provider names and inferred provider types, eliminating duplication
  • Fixed a deduplication bug where the same provider could be created twice when it appeared in both explicit and inferred lists

Motivation

Running nemoclaw sandbox create --provider nvidia -- claude on a fresh cluster failed with:

Error: provider 'nvidia' not found

The --provider flag passed names directly to the server without any client-side validation or auto-creation. This PR makes explicit --provider names follow the same auto-creation flow as inferred providers.

Test Plan

  • 7 new integration tests (ensure_providers_integration.rs) against a mock gRPC server covering:
    • Explicit provider name passes through when it exists
    • Explicit provider name auto-creates when it matches a valid type
    • Unrecognized provider name returns a clear error
    • Inferred type auto-creates (existing behavior preserved)
    • --no-auto-providers skips missing providers
    • Explicit + inferred providers combined correctly
    • Deduplication when same provider appears in both explicit and inferred lists
  • 1 new e2e test (provider_auto_create.rs) that verifies the full flow end-to-end:
    • Sets ANTHROPIC_API_KEY in the environment
    • Runs nemoclaw sandbox create --provider claude --auto-providers -- printenv ANTHROPIC_API_KEY
    • Asserts the provider was auto-created and the credential is available inside the sandbox
  • All existing tests pass (cargo test -p navigator-cli, mise run pre-commit)

@drew drew self-assigned this Mar 9, 2026
…atch a known type

When --provider <name> is passed and no provider with that name exists on
the server, the CLI now checks if the name is a recognized provider type
(e.g. claude, nvidia, github). If it is, the provider is auto-created
from local credentials using the same discovery flow as inferred providers.

If the name is not a recognized type, the CLI returns a clear error
instead of deferring validation to the server.

This eliminates the FailedPrecondition error that occurred when passing
--provider nvidia on a fresh cluster where no providers had been created
yet.
@drew drew force-pushed the feat/auto-create-providers branch from 33d98b2 to 5d4f537 Compare March 9, 2026 18:26
@drew drew merged commit 10ec475 into main Mar 9, 2026
10 checks passed
@drew drew deleted the feat/auto-create-providers branch March 9, 2026 21:36
drew added a commit that referenced this pull request Mar 16, 2026
…atch a known type (#183)

When --provider <name> is passed and no provider with that name exists on
the server, the CLI now checks if the name is a recognized provider type
(e.g. claude, nvidia, github). If it is, the provider is auto-created
from local credentials using the same discovery flow as inferred providers.

If the name is not a recognized type, the CLI returns a clear error
instead of deferring validation to the server.

This eliminates the FailedPrecondition error that occurred when passing
--provider nvidia on a fresh cluster where no providers had been created
yet.
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