fix: avoid duplicate missing auth label

This commit is contained in:
Peter Steinberger
2026-01-05 23:00:37 +01:00
parent e5058a4cf9
commit 53bf8b7b80
3 changed files with 34 additions and 1 deletions

View File

@@ -16,6 +16,7 @@
- Model: `/model` list shows auth source (masked key or OAuth email) per provider.
- Model: `/model list` is an alias for `/model`.
- Model: `/model` output now includes auth source location (env/auth.json/models.json).
- Model: avoid duplicate `missing (missing)` auth labels in `/model` list output.
- Docs: clarify auth storage, migration, and OpenAI Codex OAuth onboarding.
- Sandbox: copy inbound media into sandbox workspaces so agent tools can read attachments.
- Control UI: show a reading indicator bubble while the assistant is responding.

View File

@@ -636,6 +636,31 @@ describe("directive parsing", () => {
});
});
it("does not repeat missing auth labels on /model list", async () => {
await withTempHome(async (home) => {
vi.mocked(runEmbeddedPiAgent).mockReset();
const storePath = path.join(home, "sessions.json");
const res = await getReplyFromConfig(
{ Body: "/model list", From: "+1222", To: "+1222" },
{},
{
agent: {
model: "anthropic/claude-opus-4-5",
workspace: path.join(home, "clawd"),
allowedModels: ["anthropic/claude-opus-4-5"],
},
session: { store: storePath },
},
);
const text = Array.isArray(res) ? res[0]?.text : res?.text;
expect(text).toContain("auth:");
expect(text).not.toContain("missing (missing)");
expect(runEmbeddedPiAgent).not.toHaveBeenCalled();
});
});
it("sets model override on /model directive", async () => {
await withTempHome(async (home) => {
vi.mocked(runEmbeddedPiAgent).mockReset();

View File

@@ -93,6 +93,13 @@ const resolveAuthLabel = async (
return { label: "missing", source: "missing" };
};
const formatAuthLabel = (auth: { label: string; source: string }) => {
if (!auth.source || auth.source === auth.label || auth.source === "missing") {
return auth.label;
}
return `${auth.label} (${auth.source})`;
};
export type InlineDirectives = {
cleaned: string;
hasThinkDirective: boolean;
@@ -272,7 +279,7 @@ export async function handleDirectiveOnly(params: {
authStorage,
authPaths,
);
authByProvider.set(entry.provider, `${auth.label} (${auth.source})`);
authByProvider.set(entry.provider, formatAuthLabel(auth));
}
const current = `${params.provider}/${params.model}`;
const defaultLabel = `${defaultProvider}/${defaultModel}`;