fix: honor qqbot setup account status

This commit is contained in:
Tak Hoffman
2026-04-03 12:02:17 -05:00
parent ddd250d130
commit e6a9408c3b
2 changed files with 36 additions and 3 deletions

View File

@@ -73,9 +73,11 @@ export const qqbotSetupWizard: ChannelSetupWizard = {
unconfiguredHint: "needs AppID + AppSecret",
configuredScore: 1,
unconfiguredScore: 6,
resolveConfigured: ({ cfg }) =>
listQQBotAccountIds(cfg).some((accountId) => {
const account = resolveQQBotAccount(cfg, accountId, { allowUnresolvedSecretRef: true });
resolveConfigured: ({ cfg, accountId }) =>
(accountId ? [accountId] : listQQBotAccountIds(cfg)).some((resolvedAccountId) => {
const account = resolveQQBotAccount(cfg, resolvedAccountId, {
allowUnresolvedSecretRef: true,
});
return Boolean(
account.appId &&
(Boolean(account.clientSecret) ||

View File

@@ -1,9 +1,12 @@
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
import { describe, expect, it } from "vitest";
import { createPluginSetupWizardStatus } from "../../../test/helpers/plugins/setup-wizard.js";
import { qqbotSetupPlugin } from "./channel.setup.js";
import { DEFAULT_ACCOUNT_ID } from "./config.js";
import { qqbotSetupWizard } from "./setup-surface.js";
const getQQBotSetupStatus = createPluginSetupWizardStatus(qqbotSetupPlugin);
describe("qqbot setup", () => {
it("treats SecretRef-backed default accounts as configured", () => {
const configured = qqbotSetupWizard.status.resolveConfigured?.({
@@ -43,6 +46,34 @@ describe("qqbot setup", () => {
expect(configured).toBe(true);
});
it("setup status honors the selected named account", async () => {
const status = await getQQBotSetupStatus({
cfg: {
channels: {
qqbot: {
appId: "123456",
clientSecret: {
source: "env",
provider: "default",
id: "QQBOT_CLIENT_SECRET",
},
accounts: {
bot2: {
appId: "654321",
},
},
},
},
} as OpenClawConfig,
accountOverrides: {
qqbot: "bot2",
},
});
expect(status.configured).toBe(false);
expect(status.statusLines).toEqual(["QQ Bot: needs AppID + AppSecret"]);
});
it("marks unresolved SecretRef accounts as configured in setup-only plugin status", () => {
const cfg = {
channels: {