Skip to content

Commit 322c8dc

Browse files
authored
Merge pull request #1208 from 24601/fix/slack-bolt-import
fix(slack): handle bolt import for CJS/ESM compatibility
2 parents 0f9f510 + cf04b0e commit 322c8dc

12 files changed

+61
-24
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Docs: https://docs.clawd.bot
1717
- CLI: avoid duplicating --profile/--dev flags when formatting commands.
1818
- Auth: dedupe codex-cli profiles when tokens match custom openai-codex entries. (#1264) — thanks @odrobnik.
1919
- Agents: avoid misclassifying context-window-too-small errors as context overflow. (#1266) — thanks @humanwritten.
20+
- Slack: resolve Bolt default-export shapes for monitor startup. (#1208) — thanks @24601.
2021

2122
## 2026.1.19-3
2223

src/cli/devices-cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { Command } from "commander";
22

33
import { callGateway } from "../gateway/call.js";
44
import { GATEWAY_CLIENT_MODES, GATEWAY_CLIENT_NAMES } from "../utils/message-channel.js";
5-
import { defaultRuntime } from "./runtime.js";
5+
import { defaultRuntime } from "../runtime.js";
66
import { withProgress } from "./progress.js";
77

88
type DevicesRpcOpts = {

src/config/config.identity-defaults.test.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import fs from "node:fs/promises";
22
import path from "node:path";
33
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
4+
import { DEFAULT_AGENT_MAX_CONCURRENT, DEFAULT_SUBAGENT_MAX_CONCURRENT } from "./agent-limits.js";
45
import { withTempHome } from "./test-helpers.js";
56

67
describe("config identity defaults", () => {
@@ -284,7 +285,7 @@ describe("config identity defaults", () => {
284285
});
285286
});
286287

287-
it("does not synthesize agent/session when absent", async () => {
288+
it("does not synthesize agent list/session when absent", async () => {
288289
await withTempHome(async (home) => {
289290
const configDir = path.join(home, ".clawdbot");
290291
await fs.mkdir(configDir, { recursive: true });
@@ -306,7 +307,9 @@ describe("config identity defaults", () => {
306307

307308
expect(cfg.messages?.responsePrefix).toBeUndefined();
308309
expect(cfg.messages?.groupChat?.mentionPatterns).toBeUndefined();
309-
expect(cfg.agents).toBeUndefined();
310+
expect(cfg.agents?.list).toBeUndefined();
311+
expect(cfg.agents?.defaults?.maxConcurrent).toBe(DEFAULT_AGENT_MAX_CONCURRENT);
312+
expect(cfg.agents?.defaults?.subagents?.maxConcurrent).toBe(DEFAULT_SUBAGENT_MAX_CONCURRENT);
310313
expect(cfg.session).toBeUndefined();
311314
});
312315
});

src/gateway/protocol/schema/frames.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,16 @@ export const ConnectParamsSchema = Type.Object(
3939
permissions: Type.Optional(Type.Record(NonEmptyString, Type.Boolean())),
4040
role: Type.Optional(NonEmptyString),
4141
scopes: Type.Optional(Type.Array(NonEmptyString)),
42-
device: Type.Object(
43-
{
44-
id: NonEmptyString,
45-
publicKey: NonEmptyString,
46-
signature: NonEmptyString,
47-
signedAt: Type.Integer({ minimum: 0 }),
48-
},
49-
{ additionalProperties: false },
42+
device: Type.Optional(
43+
Type.Object(
44+
{
45+
id: NonEmptyString,
46+
publicKey: NonEmptyString,
47+
signature: NonEmptyString,
48+
signedAt: Type.Integer({ minimum: 0 }),
49+
},
50+
{ additionalProperties: false },
51+
),
5052
),
5153
auth: Type.Optional(
5254
Type.Object(

src/gateway/server.auth.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ describe("gateway server auth/connect", () => {
7373
});
7474

7575
test("rejects invalid token", async () => {
76-
const { server, ws, port, prevToken } = await startServerWithClient("secret");
76+
const { server, ws, prevToken } = await startServerWithClient("secret");
7777
const res = await connectReq(ws, { token: "wrong" });
7878
expect(res.ok).toBe(false);
7979
expect(res.error?.message ?? "").toContain("unauthorized");

src/gateway/server.cron.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ describe("gateway server cron", () => {
185185
test("accepts jobId for cron.update", async () => {
186186
const dir = await fs.mkdtemp(path.join(os.tmpdir(), "clawdbot-gw-cron-"));
187187
testState.cronStorePath = path.join(dir, "cron", "jobs.json");
188+
testState.cronEnabled = false;
188189
await fs.mkdir(path.dirname(testState.cronStorePath), { recursive: true });
189190
await fs.writeFile(testState.cronStorePath, JSON.stringify({ version: 1, jobs: [] }));
190191

@@ -218,6 +219,7 @@ describe("gateway server cron", () => {
218219
await server.close();
219220
await rmTempDir(dir);
220221
testState.cronStorePath = undefined;
222+
testState.cronEnabled = undefined;
221223
});
222224

223225
test("disables cron jobs via enabled:false patches", async () => {

src/gateway/server/ws-connection/message-handler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ export function attachGatewayWsMessageHandler(params: {
551551
deviceFamily: connectParams.client.deviceFamily,
552552
modelIdentifier: connectParams.client.modelIdentifier,
553553
mode: connectParams.client.mode,
554-
instanceId: instanceId ?? connectParams.device?.id,
554+
instanceId: connectParams.device?.id ?? instanceId,
555555
reason: "connect",
556556
});
557557
incrementPresenceVersion();

src/infra/device-pairing.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,8 @@ export async function verifyDeviceToken(params: {
399399
return { ok: false, reason: "scope-mismatch" };
400400
}
401401
entry.lastUsedAtMs = Date.now();
402-
device.tokens = { ...(device.tokens ?? {}), [role]: entry };
402+
device.tokens ??= {};
403+
device.tokens[role] = entry;
403404
state.pairedByDeviceId[device.deviceId] = device;
404405
await persistState(state, params.baseDir);
405406
return { ok: true };

src/slack/monitor.tool-result.forces-thread-replies-replytoid-is-set.test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,10 @@ vi.mock("@slack/bolt", () => {
9595
start = vi.fn().mockResolvedValue(undefined);
9696
stop = vi.fn().mockResolvedValue(undefined);
9797
}
98-
return { App, default: { App } };
98+
class HTTPReceiver {
99+
requestListener = vi.fn();
100+
}
101+
return { App, HTTPReceiver, default: { App, HTTPReceiver } };
99102
});
100103

101104
const flush = () => new Promise((resolve) => setTimeout(resolve, 0));

src/slack/monitor.tool-result.sends-tool-summaries-responseprefix.test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,10 @@ vi.mock("@slack/bolt", () => {
9797
start = vi.fn().mockResolvedValue(undefined);
9898
stop = vi.fn().mockResolvedValue(undefined);
9999
}
100-
return { App, default: { App } };
100+
class HTTPReceiver {
101+
requestListener = vi.fn();
102+
}
103+
return { App, HTTPReceiver, default: { App, HTTPReceiver } };
101104
});
102105

103106
const flush = () => new Promise((resolve) => setTimeout(resolve, 0));

0 commit comments

Comments
 (0)