fix: honor zalouser default runtime account

This commit is contained in:
Tak Hoffman
2026-04-03 13:46:36 -05:00
parent f66c9b829e
commit 534b0c663e
2 changed files with 24 additions and 1 deletions

View File

@@ -124,6 +124,27 @@ describe("zalouser account resolution", () => {
expect(resolved.config.allowFrom).toEqual(["123"]);
});
it("uses configured defaultAccount when accountId is omitted", () => {
const cfg = asConfig({
channels: {
zalouser: {
defaultAccount: "work",
accounts: {
work: {
name: "Work",
profile: "work-profile",
},
},
},
},
});
const resolved = resolveZalouserAccountSync({ cfg });
expect(resolved.accountId).toBe("work");
expect(resolved.name).toBe("Work");
expect(resolved.profile).toBe("work-profile");
});
it("resolves account config when account key casing differs from normalized id", () => {
const cfg = asConfig({
channels: {

View File

@@ -47,7 +47,9 @@ function resolveProfile(config: ZalouserAccountConfig, accountId: string): strin
}
function resolveZalouserAccountBase(params: { cfg: OpenClawConfig; accountId?: string | null }) {
const accountId = normalizeAccountId(params.accountId);
const accountId = normalizeAccountId(
params.accountId ?? resolveDefaultZalouserAccountId(params.cfg),
);
const baseEnabled =
(params.cfg.channels?.zalouser as ZalouserConfig | undefined)?.enabled !== false;
const merged = mergeZalouserAccountConfig(params.cfg, accountId);