mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-07 18:42:25 +00:00
fix(slack): surface arg menu fallback warning
This commit is contained in:
@@ -589,6 +589,7 @@ describe("Slack native command argument menus", () => {
|
||||
const commands = new Map<string, (args: unknown) => Promise<void>>();
|
||||
const actions = new Map<string | RegExp, (args: unknown) => Promise<void>>();
|
||||
const postEphemeral = vi.fn().mockResolvedValue({ ok: true });
|
||||
const runtimeLog = vi.fn();
|
||||
const app = {
|
||||
client: { chat: { postEphemeral } },
|
||||
command: (name: string, handler: (args: unknown) => Promise<void>) => {
|
||||
@@ -604,7 +605,7 @@ describe("Slack native command argument menus", () => {
|
||||
};
|
||||
const ctx = {
|
||||
cfg: { commands: { native: true, nativeSkills: false } },
|
||||
runtime: {},
|
||||
runtime: { log: runtimeLog },
|
||||
botToken: "bot-token",
|
||||
botUserId: "bot",
|
||||
teamId: "T1",
|
||||
@@ -637,6 +638,12 @@ describe("Slack native command argument menus", () => {
|
||||
// Registration should not throw despite app.options() throwing
|
||||
await registerCommands(ctx, account);
|
||||
expect(commands.size).toBeGreaterThan(0);
|
||||
expect(runtimeLog).toHaveBeenCalledTimes(1);
|
||||
expect(runtimeLog).toHaveBeenCalledWith(
|
||||
expect.stringContaining(
|
||||
"slack: external arg-menu registration failed; falling back to static slash command menus.",
|
||||
),
|
||||
);
|
||||
expect(
|
||||
Array.from(actions.keys()).some(
|
||||
(key) => key instanceof RegExp && String(key) === String(/^openclaw_cmdarg/),
|
||||
|
||||
@@ -18,7 +18,7 @@ import {
|
||||
} from "openclaw/plugin-sdk/native-command-config-runtime";
|
||||
import type { ReplyPayload } from "openclaw/plugin-sdk/reply-runtime";
|
||||
import type { ResolvedAgentRoute } from "openclaw/plugin-sdk/routing";
|
||||
import { danger, logVerbose } from "openclaw/plugin-sdk/runtime-env";
|
||||
import { danger, logVerbose, warn } from "openclaw/plugin-sdk/runtime-env";
|
||||
import { loadSessionStore, resolveStorePath } from "openclaw/plugin-sdk/session-store-runtime";
|
||||
import {
|
||||
normalizeLowercaseStringOrEmpty,
|
||||
@@ -927,6 +927,11 @@ export async function registerSlackMonitorSlashCommands(params: {
|
||||
registerArgOptions();
|
||||
} catch (err) {
|
||||
supportsExternalArgMenus = false;
|
||||
runtime.log?.(
|
||||
warn(
|
||||
"slack: external arg-menu registration failed; falling back to static slash command menus. Enable verbose logs for details.",
|
||||
),
|
||||
);
|
||||
logVerbose(
|
||||
`slack: external arg-menu registration failed, falling back to static menus: ${formatErrorMessage(err)}`,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user