fix: route MiniMax usage env auth metadata

This commit is contained in:
Gustavo Madeira Santana
2026-04-21 12:20:19 -04:00
parent d3bc1aace6
commit fa39b0c1ce
3 changed files with 32 additions and 4 deletions

View File

@@ -6,7 +6,7 @@
"autoEnableWhenConfiguredProviders": ["minimax", "minimax-portal"],
"nonSecretAuthMarkers": ["minimax-oauth"],
"providerAuthEnvVars": {
"minimax": ["MINIMAX_API_KEY"],
"minimax": ["MINIMAX_CODE_PLAN_KEY", "MINIMAX_CODING_API_KEY", "MINIMAX_API_KEY"],
"minimax-portal": ["MINIMAX_OAUTH_TOKEN", "MINIMAX_API_KEY"]
},
"providerAuthChoices": [

View File

@@ -263,6 +263,37 @@ describe("resolveProviderAuths plugin boundary", () => {
expect(ensureAuthProfileStoreMock).not.toHaveBeenCalled();
});
it("keeps plugin usage auth when provider-owned usage env credentials exist", async () => {
resolveProviderUsageAuthWithPluginMock.mockResolvedValueOnce({
token: "plugin-minimax-token",
});
await withTempHome(async (homeDir) => {
await expect(
resolveProviderAuths({
providers: ["minimax"],
skipPluginAuthWithoutCredentialSource: true,
env: {
HOME: homeDir,
MINIMAX_CODE_PLAN_KEY: "code-plan-key",
},
}),
).resolves.toEqual([
{
provider: "minimax",
token: "plugin-minimax-token",
},
]);
});
expect(resolveProviderUsageAuthWithPluginMock).toHaveBeenCalledWith(
expect.objectContaining({
provider: "minimax",
}),
);
expect(ensureAuthProfileStoreMock).not.toHaveBeenCalled();
});
it("does not overlay external auth profiles while checking the skip gate", async () => {
hasAnyAuthProfileStoreSourceMock.mockReturnValue(true);

View File

@@ -210,8 +210,6 @@ export function getProviderEnvVars(
return Array.isArray(envVars) ? [...envVars] : [];
}
const EXTRA_PROVIDER_AUTH_ENV_VARS = ["MINIMAX_CODE_PLAN_KEY", "MINIMAX_CODING_API_KEY"] as const;
// OPENCLAW_API_KEY authenticates the local OpenClaw bridge itself and must
// remain available to child bridge/runtime processes.
export function listKnownProviderAuthEnvVarNames(params?: ProviderEnvVarLookupParams): string[] {
@@ -219,7 +217,6 @@ export function listKnownProviderAuthEnvVarNames(params?: ProviderEnvVarLookupPa
...new Set([
...Object.values(resolveProviderAuthEnvVarCandidates(params)).flatMap((keys) => keys),
...Object.values(resolveProviderEnvVars(params)).flatMap((keys) => keys),
...EXTRA_PROVIDER_AUTH_ENV_VARS,
]),
];
}