Skip to content

Slack: validate runtime blocks in send and edit paths#18416

Closed
Solvely-Colin wants to merge 1 commit into
openclaw:mainfrom
Solvely-Colin:codex/slack-runtime-blocks-validation
Closed

Slack: validate runtime blocks in send and edit paths#18416
Solvely-Colin wants to merge 1 commit into
openclaw:mainfrom
Solvely-Colin:codex/slack-runtime-blocks-validation

Conversation

@Solvely-Colin

@Solvely-Colin Solvely-Colin commented Feb 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Extends Slack Block Kit validation to runtime send/edit paths so all call paths enforce the same payload rules.

  • export shared validateSlackBlocksArray helper
  • validate runtime sendMessageSlack(..., { blocks }) payloads
  • validate runtime editSlackMessage(..., { blocks }) payloads
  • add regression tests for malformed/empty/oversized runtime block arrays

Scope

  • src/slack/blocks-input.ts
  • src/slack/send.ts
  • src/slack/actions.ts
  • src/slack/send.blocks.test.ts
  • src/slack/actions.blocks.test.ts

Validation

  • pnpm test src/slack/send.blocks.test.ts src/slack/actions.blocks.test.ts
  • pnpm check

Dependency

Depends on:

If reviewing before dependencies merge, review tip commit: e88b0f53f.

@openclaw-barnacle openclaw-barnacle Bot added channel: slack Channel integration: slack agents Agent runtime and tooling size: XL labels Feb 16, 2026

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

17 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Comment on lines +361 to +374
const viewClosed = (
ctx.app as unknown as {
viewClosed?: (
matcher: RegExp,
handler: (args: { ack: () => Promise<void>; body: unknown }) => Promise<void>,
) => void;
}
).viewClosed;
if (typeof viewClosed !== "function") {
return;
}

// Handle modal close events so agent workflows can react to cancelled forms.
viewClosed(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unbound method may lose this context

viewClosed is extracted from ctx.app and called as a standalone function on line 374. Unlike ctx.app.action(...) and ctx.app.view(...) earlier in this function, calling viewClosed(...) without binding it to ctx.app may lose the this context. If the Bolt App implementation references this internally (e.g., to register the listener), this would fail at runtime.

Consider calling it as a bound method instead:

Suggested change
const viewClosed = (
ctx.app as unknown as {
viewClosed?: (
matcher: RegExp,
handler: (args: { ack: () => Promise<void>; body: unknown }) => Promise<void>,
) => void;
}
).viewClosed;
if (typeof viewClosed !== "function") {
return;
}
// Handle modal close events so agent workflows can react to cancelled forms.
viewClosed(
const viewClosed = (
ctx.app as unknown as {
viewClosed?: (
matcher: RegExp,
handler: (args: { ack: () => Promise<void>; body: unknown }) => Promise<void>,
) => void;
}
).viewClosed?.bind(ctx.app);
if (typeof viewClosed !== "function") {
return;
}
// Handle modal close events so agent workflows can react to cancelled forms.
viewClosed(
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/slack/monitor/events/interactions.ts
Line: 361:374

Comment:
**Unbound method may lose `this` context**

`viewClosed` is extracted from `ctx.app` and called as a standalone function on line 374. Unlike `ctx.app.action(...)` and `ctx.app.view(...)` earlier in this function, calling `viewClosed(...)` without binding it to `ctx.app` may lose the `this` context. If the Bolt `App` implementation references `this` internally (e.g., to register the listener), this would fail at runtime.

Consider calling it as a bound method instead:

```suggestion
  const viewClosed = (
    ctx.app as unknown as {
      viewClosed?: (
        matcher: RegExp,
        handler: (args: { ack: () => Promise<void>; body: unknown }) => Promise<void>,
      ) => void;
    }
  ).viewClosed?.bind(ctx.app);
  if (typeof viewClosed !== "function") {
    return;
  }

  // Handle modal close events so agent workflows can react to cancelled forms.
  viewClosed(
```

How can I resolve this? If you propose a fix, please make it concise.

@Solvely-Colin
Solvely-Colin force-pushed the codex/slack-runtime-blocks-validation branch from eaf2ee6 to 7ef19e5 Compare February 17, 2026 00:55
@greptile-apps

greptile-apps Bot commented Feb 17, 2026

Copy link
Copy Markdown
Contributor

Greptile encountered an error while reviewing this PR. Please reach out to [email protected] for assistance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: slack Channel integration: slack size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants