Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@pvoo
Copy link
Contributor

@pvoo pvoo commented Jan 23, 2026

Proposed PR: Discord autoThread ack fixes + exec schema fix

PR Title

fix(discord): autoThread ack reactions + exec approval null handling


Description

This PR fixes issues with Discord autoThread behavior and a schema validation bug in exec approvals.

Discord autoThread Fixes

Main Issue: When autoThread: true was enabled on a channel, the bot would respond to any message in any thread - including user-created threads where the bot wasn't mentioned. This was because the code skipped mention requirements for ALL threads when autoThread was enabled, not just bot-created threads.

Problems:

  1. Bot responding to messages in user-created threads without being mentioned (main bug)
  2. Ack reactions weren't being added to bot-owned threads
  3. Ack reactions weren't being added in open channels (where mentions aren't required)

Solution:

  • Only skip mention requirement in threads created by the bot itself (check threadOwnerId === botId)
  • Add ack reactions to bot-owned autoThreads
  • Add ack reactions in channels where requireMention: false
  • Extract isDiscordAutoThreadOwnedByBot() helper for DRY
  • Pass pre-computed value to avoid redundant checks

Exec Approval Schema Fix

Problem: Intermittent invalid exec.approval.request params: at /resolvedPath: must be string errors when running exec commands.

Root cause: ExecApprovalRequestParamsSchema used Type.Optional(Type.String()) which accepts undefined but NOT null. The calling code in bash-tools.exec.ts passes null.

Solution: Changed schema to Type.Optional(Type.Union([Type.String(), Type.Null()])) for all optional string fields.

Wimmie and others added 5 commits January 23, 2026 19:56
- Ack reactions in bot-owned autoThreads
- Ack reactions in open channels (no mention required)
- DRY: Pass pre-computed isAutoThreadOwnedByBot to avoid redundant checks
- Consolidate ack logic with explanatory comment
The ExecApprovalRequestParamsSchema was rejecting null values for optional
fields like resolvedPath, but the calling code in bash-tools.exec.ts passes
null. This caused intermittent 'invalid exec.approval.request params'
validation errors.

Fix: Accept Type.Union([Type.String(), Type.Null()]) for all optional string
fields in the schema. Update test to reflect new behavior.
@steipete steipete force-pushed the fix/discord-thread-clean branch from 0aa7974 to cfc15d4 Compare January 23, 2026 20:01
@steipete steipete merged commit 7d0a0ae into openclaw:main Jan 23, 2026
18 of 22 checks passed
@steipete
Copy link
Contributor

Landed via temp rebase onto main.

  • Gate: pnpm lint && pnpm build && pnpm test
  • Land commit: cfc15d4
  • Merge commit: 7d0a0ae

Thanks @pvoo!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants