Skip to content

Commit 9220761

Browse files
committed
fix(slack): surface arg menu fallback warning
1 parent a7847ac commit 9220761

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

extensions/slack/src/monitor/slash.test.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,7 @@ describe("Slack native command argument menus", () => {
589589
const commands = new Map<string, (args: unknown) => Promise<void>>();
590590
const actions = new Map<string | RegExp, (args: unknown) => Promise<void>>();
591591
const postEphemeral = vi.fn().mockResolvedValue({ ok: true });
592+
const runtimeLog = vi.fn();
592593
const app = {
593594
client: { chat: { postEphemeral } },
594595
command: (name: string, handler: (args: unknown) => Promise<void>) => {
@@ -604,7 +605,7 @@ describe("Slack native command argument menus", () => {
604605
};
605606
const ctx = {
606607
cfg: { commands: { native: true, nativeSkills: false } },
607-
runtime: {},
608+
runtime: { log: runtimeLog },
608609
botToken: "bot-token",
609610
botUserId: "bot",
610611
teamId: "T1",
@@ -637,6 +638,12 @@ describe("Slack native command argument menus", () => {
637638
// Registration should not throw despite app.options() throwing
638639
await registerCommands(ctx, account);
639640
expect(commands.size).toBeGreaterThan(0);
641+
expect(runtimeLog).toHaveBeenCalledTimes(1);
642+
expect(runtimeLog).toHaveBeenCalledWith(
643+
expect.stringContaining(
644+
"slack: external arg-menu registration failed; falling back to static slash command menus.",
645+
),
646+
);
640647
expect(
641648
Array.from(actions.keys()).some(
642649
(key) => key instanceof RegExp && String(key) === String(/^openclaw_cmdarg/),

extensions/slack/src/monitor/slash.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import {
1818
} from "openclaw/plugin-sdk/native-command-config-runtime";
1919
import type { ReplyPayload } from "openclaw/plugin-sdk/reply-runtime";
2020
import type { ResolvedAgentRoute } from "openclaw/plugin-sdk/routing";
21-
import { danger, logVerbose } from "openclaw/plugin-sdk/runtime-env";
21+
import { danger, logVerbose, warn } from "openclaw/plugin-sdk/runtime-env";
2222
import { loadSessionStore, resolveStorePath } from "openclaw/plugin-sdk/session-store-runtime";
2323
import {
2424
normalizeLowercaseStringOrEmpty,
@@ -927,6 +927,11 @@ export async function registerSlackMonitorSlashCommands(params: {
927927
registerArgOptions();
928928
} catch (err) {
929929
supportsExternalArgMenus = false;
930+
runtime.log?.(
931+
warn(
932+
"slack: external arg-menu registration failed; falling back to static slash command menus. Enable verbose logs for details.",
933+
),
934+
);
930935
logVerbose(
931936
`slack: external arg-menu registration failed, falling back to static menus: ${formatErrorMessage(err)}`,
932937
);

0 commit comments

Comments
 (0)