fix(auth): document MMX_CONFIG_DIR in credential errors#189
Open
kartikkabadi wants to merge 1 commit into
Open
fix(auth): document MMX_CONFIG_DIR in credential errors#189kartikkabadi wants to merge 1 commit into
kartikkabadi wants to merge 1 commit into
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
a54980a to
213ca64
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.
Summary
Documents the existing
MMX_CONFIG_DIRenvironment variable and includes it in the remediation guidance shown when the CLI cannot find credentials.This helps users running
mmxfrom agents, services, CI jobs, or subprocesses whose resolved home directory differs from the credential owner's — the exact scenario in #185, whereos.homedir()returns a different path than where~/.mmx/config.jsonlives.Before
The hint mentioned only two remediation options.
MMX_CONFIG_DIRwas functional but undocumented — users only discovered it by readingsrc/config/paths.ts.After
Why MMX_CONFIG_DIR and not MINIMAX_API_KEY
MMX_CONFIG_DIRis a working remediation: it changes where the CLI looks forconfig.json, so credentials saved viammx auth loginare found even whenos.homedir()differs.MINIMAX_API_KEYis not listed in the hint because it does not work end-to-end.ensureAuth()insrc/auth/setup.tsrecognizes it and returns early, but the actual request path callsresolveCredential()insrc/auth/resolver.ts, which never readsprocess.env.MINIMAX_API_KEY— it only checksconfig.apiKey(the--api-keyflag), OAuth credentials, andconfig.fileApiKey. So a user settingMINIMAX_API_KEYwould pass the setup gate but still get "No credentials found" when the first real request is made. Listing it as a remediation would be misleading.This PR does not fix
MINIMAX_API_KEY— that is a separate pre-existing issue outside the scope of #185. It only lists remediation options that genuinely work.Changes
src/auth/resolver.ts— update the "No credentials found" hint to mentionmmx auth login,--api-key, andMMX_CONFIG_DIR.src/auth/setup.ts— same hint update (this file throws the identical error on the non-interactive path).README.md— add an "Environment variables" section documenting the supported env vars, includingMMX_CONFIG_DIRwith guidance for subprocess/CI usage.ERRORS.md— add the previously-missing "No credentials found" row to the auth error reference.test/auth/resolver.test.ts— add focused tests asserting both error paths (resolveCredentialandensureAuth) includeMMX_CONFIG_DIRin the hint.Scope
This does not change credential lookup behavior or attempt automatic cross-user credential discovery. It only makes the existing
MMX_CONFIG_DIRoverride discoverable — the minimal Option A from the issue.Testing
bun test test/auth/resolver.test.ts— 6/6 pass (2 new)bun run typecheck— passbun run lint— no new errors (2 pre-existing errors in unrelated test files onupstream/main)bun test— no new failures (40 pre-existing failures onupstream/mainare unrelated to auth; +2 tests, +2 pass)bun run build— passReproduction
Fixes #185