Skip to content

Commit 0fd69dc

Browse files
committed
fix(wizard): honor configured auth dir in finalize
1 parent 780ca1d commit 0fd69dc

2 files changed

Lines changed: 15 additions & 3 deletions

File tree

src/wizard/setup.finalize.test.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,11 @@ describe("finalizeSetupWizard", () => {
644644
skipUi: false,
645645
},
646646
baseConfig: {},
647-
nextConfig: {},
647+
nextConfig: {
648+
agents: {
649+
list: [{ id: "main", agentDir: "/tmp/custom-agent" }],
650+
},
651+
},
648652
workspaceDir: "/tmp",
649653
settings: {
650654
port: 18789,
@@ -659,6 +663,14 @@ describe("finalizeSetupWizard", () => {
659663
});
660664

661665
expect(launchTuiCli).toHaveBeenCalledWith(expect.objectContaining({ message: undefined }), {});
666+
expect(resolveDefaultModelAuthStatus).toHaveBeenCalledWith(
667+
expect.objectContaining({
668+
agents: {
669+
list: [{ id: "main", agentDir: "/tmp/custom-agent" }],
670+
},
671+
}),
672+
{ agentDir: "/tmp/custom-agent" },
673+
);
662674
expectNoteContains(
663675
prompter,
664676
'No credentials are configured for provider "openai"',

src/wizard/setup.finalize.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -596,10 +596,11 @@ export async function finalizeSetupWizard(
596596
.access(bootstrapPath)
597597
.then(() => true)
598598
.catch(() => false);
599+
const agentDir = resolveDefaultAgentDir(nextConfig);
599600
// Without model credentials the seeded first message is guaranteed to fail
600601
// with a provider auth error, so hatch quietly and explain instead.
601602
const { resolveDefaultModelAuthStatus } = await import("../commands/auth-choice.js");
602-
const modelAuthStatus = resolveDefaultModelAuthStatus(nextConfig);
603+
const modelAuthStatus = resolveDefaultModelAuthStatus(nextConfig, { agentDir });
603604
const shouldSeedBootstrapHatch =
604605
hasBootstrap && options.hadExistingConfig !== true && modelAuthStatus.hasAuth;
605606

@@ -708,7 +709,6 @@ export async function finalizeSetupWizard(
708709
const keyConfigured = entry ? hasExistingKey(nextConfig, webSearchProvider) : false;
709710
const envAvailable = entry ? hasKeyInEnv(entry) : false;
710711
const hasKey = keyConfigured || envAvailable;
711-
const agentDir = resolveDefaultAgentDir(nextConfig);
712712
const authProviderId = entry?.authProviderId?.trim();
713713
const authProviderLabel = authProviderId === "xai" ? "xAI" : authProviderId;
714714
const providerAuthProfileAvailable = authProviderId

0 commit comments

Comments
 (0)