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

推荐订阅源

C
Check Point Blog
美团技术团队
Microsoft Security Blog
Microsoft Security Blog
大猫的无限游戏
大猫的无限游戏
T
Tailwind CSS Blog
G
Google Developers Blog
博客园 - 聂微东
爱范儿
爱范儿
博客园 - 叶小钗
J
Java Code Geeks
月光博客
月光博客
博客园 - Franky
MongoDB | Blog
MongoDB | Blog
The Cloudflare Blog
宝玉的分享
宝玉的分享
博客园 - 【当耐特】
Microsoft Azure Blog
Microsoft Azure Blog
The GitHub Blog
The GitHub Blog
小众软件
小众软件
WordPress大学
WordPress大学
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Vercel News
Vercel News
Y
Y Combinator Blog
量子位

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: harden slack interactive blocks · openclaw/openclaw@...
steipete · 2026-04-30 · via Recent Commits to openclaw:main

@@ -13,6 +13,10 @@ import { truncateSlackText } from "./truncate.js";

13131414

const SLACK_SECTION_TEXT_MAX = 3000;

1515

const SLACK_PLAIN_TEXT_MAX = 75;

16+

const SLACK_OPTION_VALUE_MAX = 75;

17+

const SLACK_BUTTON_VALUE_MAX = 2000;

18+

const SLACK_STATIC_SELECT_OPTIONS_MAX = 100;

19+

const SLACK_ACTION_BLOCK_ELEMENTS_MAX = 25;

16201721

export type SlackBlock = Block | KnownBlock;

1822

@@ -36,6 +40,10 @@ function resolveSlackButtonStyle(

3640

return undefined;

3741

}

384243+

function isWithinSlackLimit(value: string, maxLength: number): boolean {

44+

return value.length <= maxLength;

45+

}

46+3947

export function buildSlackInteractiveBlocks(interactive?: InteractiveReply): SlackBlock[] {

4048

const initialState = {

4149

blocks: [] as SlackBlock[],

@@ -58,26 +66,32 @@ export function buildSlackInteractiveBlocks(interactive?: InteractiveReply): Sla

5866

return state;

5967

}

6068

if (block.type === "buttons") {

61-

const elements = block.buttons.flatMap((button, choiceIndex) => {

62-

if (!button.value && !button.url) {

63-

return [];

64-

}

65-

const style = resolveSlackButtonStyle(button.style);

66-

return [

67-

{

68-

type: "button" as const,

69-

action_id: buildSlackReplyButtonActionId(state.buttonIndex + 1, choiceIndex),

70-

text: {

71-

type: "plain_text" as const,

72-

text: truncateSlackText(button.label, SLACK_PLAIN_TEXT_MAX),

73-

emoji: true,

69+

const elements = block.buttons

70+

.flatMap((button, choiceIndex) => {

71+

const value =

72+

button.value && isWithinSlackLimit(button.value, SLACK_BUTTON_VALUE_MAX)

73+

? button.value

74+

: undefined;

75+

if (!value && !button.url) {

76+

return [];

77+

}

78+

const style = resolveSlackButtonStyle(button.style);

79+

return [

80+

{

81+

type: "button" as const,

82+

action_id: buildSlackReplyButtonActionId(state.buttonIndex + 1, choiceIndex),

83+

text: {

84+

type: "plain_text" as const,

85+

text: truncateSlackText(button.label, SLACK_PLAIN_TEXT_MAX),

86+

emoji: true,

87+

},

88+

...(value ? { value } : {}),

89+

...(button.url ? { url: button.url } : {}),

90+

...(style ? { style } : {}),

7491

},

75-

...(button.value ? { value: button.value } : {}),

76-

...(button.url ? { url: button.url } : {}),

77-

...(style ? { style } : {}),

78-

},

79-

];

80-

});

92+

];

93+

})

94+

.slice(0, SLACK_ACTION_BLOCK_ELEMENTS_MAX);

8195

if (elements.length === 0) {

8296

return state;

8397

}

@@ -88,7 +102,10 @@ export function buildSlackInteractiveBlocks(interactive?: InteractiveReply): Sla

88102

});

89103

return state;

90104

}

91-

if (block.options.length === 0) {

105+

const options = block.options

106+

.filter((option) => isWithinSlackLimit(option.value, SLACK_OPTION_VALUE_MAX))

107+

.slice(0, SLACK_STATIC_SELECT_OPTIONS_MAX);

108+

if (options.length === 0) {

92109

return state;

93110

}

94111

state.blocks.push({

@@ -106,7 +123,7 @@ export function buildSlackInteractiveBlocks(interactive?: InteractiveReply): Sla

106123

),

107124

emoji: true,

108125

},

109-

options: block.options.map((option, _choiceIndex) => ({

126+

options: options.map((option, _choiceIndex) => ({

110127

text: {

111128

type: "plain_text",

112129

text: truncateSlackText(option.label, SLACK_PLAIN_TEXT_MAX),