fix(discord): clear failed startup probe status

This commit is contained in:
Vincent Koc
2026-05-03 23:54:58 -07:00
parent 3f045d9129
commit 8a8a12559d
3 changed files with 40 additions and 0 deletions

View File

@@ -56,6 +56,7 @@ Docs: https://docs.openclaw.ai
### Fixes
- Discord: clear stale startup probe bot/application status when the async bot probe throws, not just when it returns a degraded probe result. Thanks @vincentkoc.
- Web search: scope explicit bundled `web_search` provider runtime loading through manifest ownership, so selecting DuckDuckGo/Gemini/etc. does not import unrelated bundled providers or log their optional dependency failures. Thanks @vincentkoc.
- Release/beta smoke: resolve the dispatched Telegram beta E2E run from `gh run list` when `gh workflow run` returns no run URL, so the maintainer helper does not fail immediately after dispatch. Thanks @vincentkoc.
- Media/images: keep HEIC/HEIF attachments fail-closed when optional Sharp conversion is unavailable instead of sending originals that still need conversion. Thanks @vincentkoc.

View File

@@ -515,6 +515,38 @@ describe("discordPlugin outbound", () => {
);
});
it("clears stale Discord probe metadata when the async startup probe throws", async () => {
probeDiscordMock.mockRejectedValue(new Error("probe timed out"));
monitorDiscordProviderMock.mockResolvedValue(undefined);
const cfg = createCfg();
const statusPatches: Array<Record<string, unknown>> = [];
const ctx = createStartAccountContext({
account: resolveAccount(cfg),
cfg,
statusPatchSink: (next) => statusPatches.push({ ...next }),
});
ctx.setStatus({
accountId: "default",
bot: { username: "OldBot" },
application: { intents: { messageContent: "enabled" } },
});
await discordPlugin.gateway!.startAccount!(ctx);
await vi.waitFor(() =>
expect(
statusPatches.some(
(patch) =>
"bot" in patch &&
"application" in patch &&
patch.bot === undefined &&
patch.application === undefined,
),
).toBe(true),
);
});
it("stagger starts later accounts in multi-bot setups", async () => {
probeDiscordMock.mockResolvedValue({
ok: true,

View File

@@ -130,6 +130,13 @@ function startDiscordStartupProbe(params: {
);
}
} catch (err) {
if (!params.abortSignal.aborted) {
params.setStatus({
accountId: params.accountId,
bot: undefined,
application: undefined,
});
}
if (getDiscordRuntime().logging.shouldLogVerbose()) {
params.log?.debug?.(`[${params.accountId}] bot probe failed: ${String(err)}`);
}