Skip to content

mcode provider add --use fails with "Test the saved provider configuration" but saves nothing #157

Closed

Description

@superbigcup325

mcode 0.4.12, npm install, Linux, Node v26.8.2

The BYOK example in the README ends with --use:

mcode provider add --name my-provider --base-url https://example.com/v1 \
  --api-format openai-completions --model my-model \
  --api-key-env MCODE_PROVIDER_API_KEY --use

Running it exits 1 with:

Test the saved provider configuration before activating it

Nothing is saved. mcode provider list does not show the provider, and
mcode provider test <name> reports "Model provider not found".

Two problems:

  1. The message says "Test the saved provider configuration", but the provider
    was never written — the check runs before any persistence.
  2. Headless users get a wrong signal afterwards: mcode exec fails with
    "Sign in to MiniMax to use Agent features", which sends people off to
    mcode login when the real problem is the provider was never stored.

Retrying without --use does work ("Provider added: my-provider"), followed by
mcode provider test — so the workaround is just dropping --use.

Suggestion: either save first and then require provider test before
activating, or make the message state that nothing was saved and print the
working sequence. Also worth updating the README example, since it sends every
new BYOK user into this on their first run.

Activity

  1. hetaoBackend commented on Sep 18, 2026

    @hetaoBackend
    Collaborator

    The fix is implemented in #169. Local validation and all three platform CI checks passed, but GitHub currently blocks merging pending the required independent approval. The PR has not merged yet.

    mcode provider add --use now tests the first listed model before saving the provider and selecting it as the default. If the connection test fails, the command exits nonzero, explicitly states that nothing was saved or selected, and preserves the existing configuration. Omitting --use still saves without testing or changing the default.

    Verified locally with the built CLI and an offline HTTP fixture, including successful activation and subsequent exec without managed login, and HTTP 401 failure without persistence. The full local verification passed all 14 macOS gates; startup/smoke and BYOK tests were also rerun before the merge attempt.

    Keeping this issue open until the PR merges. No new npm release has been published as part of this change. Thanks for the clear reproduction.

  2. hetaoBackend commented on Sep 18, 2026

    @hetaoBackend
    Collaborator

    Update: #169 has now merged as 149d764, and this issue was closed by the merge. The approval blocker mentioned above no longer applies.

    The fix is now in main. Local built-CLI tests and Linux/macOS/Windows CI passed. This source merge does not itself publish a new npm version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions