惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

月光博客
月光博客
Martin Fowler
Martin Fowler
博客园_首页
量子位
T
Tailwind CSS Blog
博客园 - Franky
G
Google Developers Blog
D
DataBreaches.Net
Vercel News
Vercel News
B
Blog
Recent Announcements
Recent Announcements
S
SegmentFault 最新的问题
M
MIT News - Artificial intelligence
爱范儿
爱范儿
博客园 - 【当耐特】
The Cloudflare Blog
H
Help Net Security
云风的 BLOG
云风的 BLOG
P
Proofpoint News Feed
C
Check Point Blog
有赞技术团队
有赞技术团队
Microsoft Security Blog
Microsoft Security Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(slack): hash token cache keys · openclaw/openclaw@d39...
steipete · 2026-04-25 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -12,6 +12,7 @@ Docs: https://docs.openclaw.ai

1212

### Fixes

1313
1414

- Slack/messages: serialize write-client requests and whole outbound sends per target so rapid multi-message Slack replies preserve send order. Fixes #69101. (#69105) Thanks @nightq and @ztexydt-cqh.

15+

- Slack/messages: keep Slack bot tokens out of internal message-ordering and DM cache keys.

1516

- Slack/exec approvals: resolve native approval button clicks over the Gateway instead of delivering `/approve ...` as plain agent text, preserving retry buttons if Gateway resolution fails. Fixes #71023. (#71025) Thanks @marusan03.

1617

- Browser/tool: expose browser doctor diagnostics to agents and extend `openclaw doctor` browser readiness notes for managed Chromium launch prerequisites. (#62948, #62936) Thanks @seanc-dev.

1718

- Slack/files: return non-image `download-file` results as local file paths instead of image payloads, and include Slack file IDs in inbound file placeholders so agents can call `download-file`. Fixes #71212. Thanks @teamrazo.

Original file line numberDiff line numberDiff line change

@@ -14,6 +14,7 @@ vi.mock("@slack/web-api", () => {

1414
1515

let createSlackWebClient: typeof import("./client.js").createSlackWebClient;

1616

let createSlackWriteClient: typeof import("./client.js").createSlackWriteClient;

17+

let createSlackTokenCacheKey: typeof import("./client.js").createSlackTokenCacheKey;

1718

let getSlackWriteClient: typeof import("./client.js").getSlackWriteClient;

1819

let clearSlackWriteClientCacheForTest: typeof import("./client.js").clearSlackWriteClientCacheForTest;

1920

let resolveSlackWebClientOptions: typeof import("./client.js").resolveSlackWebClientOptions;

@@ -27,6 +28,7 @@ beforeAll(async () => {

2728

({

2829

createSlackWebClient,

2930

createSlackWriteClient,

31+

createSlackTokenCacheKey,

3032

getSlackWriteClient,

3133

clearSlackWriteClientCacheForTest,

3234

resolveSlackWebClientOptions,

@@ -121,6 +123,17 @@ describe("slack web client config", () => {

121123

expect(second).not.toBe(first);

122124

expect(WebClient).toHaveBeenCalledTimes(2);

123125

});

126+
127+

it("builds stable non-secret token cache keys", () => {

128+

const token = "xoxb-sensitive-token";

129+

const first = createSlackTokenCacheKey(token);

130+

const second = createSlackTokenCacheKey(token);

131+
132+

expect(first).toBe(second);

133+

expect(first).toMatch(/^sha256:/);

134+

expect(first).not.toContain(token);

135+

expect(createSlackTokenCacheKey("xoxb-other-token")).not.toBe(first);

136+

});

124137

});

125138
126139

describe("slack proxy agent", () => {

Original file line numberDiff line numberDiff line change

@@ -1,3 +1,4 @@

1+

import { createHash } from "node:crypto";

12

import { type WebClientOptions, WebClient } from "@slack/web-api";

23

import { resolveSlackWebClientOptions, resolveSlackWriteClientOptions } from "./client-options.js";

34

@@ -19,21 +20,26 @@ export function createSlackWriteClient(token: string, options: WebClientOptions

1920

return new WebClient(token, resolveSlackWriteClientOptions(options));

2021

}

2122
23+

export function createSlackTokenCacheKey(token: string): string {

24+

return `sha256:${createHash("sha256").update(token).digest("base64url")}`;

25+

}

26+
2227

export function getSlackWriteClient(token: string): WebClient {

23-

const cached = slackWriteClientCache.get(token);

28+

const tokenKey = createSlackTokenCacheKey(token);

29+

const cached = slackWriteClientCache.get(tokenKey);

2430

if (cached) {

25-

slackWriteClientCache.delete(token);

26-

slackWriteClientCache.set(token, cached);

31+

slackWriteClientCache.delete(tokenKey);

32+

slackWriteClientCache.set(tokenKey, cached);

2733

return cached;

2834

}

2935

const client = createSlackWriteClient(token);

3036

if (slackWriteClientCache.size >= SLACK_WRITE_CLIENT_CACHE_MAX) {

31-

const oldestToken = slackWriteClientCache.keys().next().value;

32-

if (oldestToken) {

33-

slackWriteClientCache.delete(oldestToken);

37+

const oldestTokenKey = slackWriteClientCache.keys().next().value;

38+

if (oldestTokenKey) {

39+

slackWriteClientCache.delete(oldestTokenKey);

3440

}

3541

}

36-

slackWriteClientCache.set(token, client);

42+

slackWriteClientCache.set(tokenKey, client);

3743

return client;

3844

}

3945
Original file line numberDiff line numberDiff line change

@@ -19,7 +19,7 @@ import type { SlackTokenSource } from "./accounts.js";

1919

import { resolveSlackAccount } from "./accounts.js";

2020

import { buildSlackBlocksFallbackText } from "./blocks-fallback.js";

2121

import { validateSlackBlocksArray } from "./blocks-input.js";

22-

import { getSlackWriteClient } from "./client.js";

22+

import { createSlackTokenCacheKey, getSlackWriteClient } from "./client.js";

2323

import { markdownToSlackMrkdwnChunks } from "./format.js";

2424

import { SLACK_TEXT_LIMIT } from "./limits.js";

2525

import { loadOutboundMediaFromUrl } from "./runtime-api.js";

@@ -188,7 +188,9 @@ function createSlackSendQueueKey(params: {

188188

}): string {

189189

const isUserId = params.recipient.kind === "user" || /^U[A-Z0-9]+$/i.test(params.recipient.id);

190190

const recipientKey = `${isUserId ? "user" : params.recipient.kind}:${params.recipient.id}`;

191-

return `${params.accountId}:${params.token}:${recipientKey}:${params.threadTs ?? ""}`;

191+

return `${params.accountId}:${createSlackTokenCacheKey(params.token)}:${recipientKey}:${

192+

params.threadTs ?? ""

193+

}`;

192194

}

193195
194196

async function runQueuedSlackSend<T>(key: string, task: () => Promise<T>): Promise<T> {

@@ -215,7 +217,9 @@ function createSlackDmCacheKey(params: {

215217

token: string;

216218

recipientId: string;

217219

}): string {

218-

return `${params.accountId ?? "default"}:${params.token}:${params.recipientId}`;

220+

return `${params.accountId ?? "default"}:${createSlackTokenCacheKey(params.token)}:${

221+

params.recipientId

222+

}`;

219223

}

220224
221225

function setSlackDmChannelCache(key: string, channelId: string): void {