Skip to content

fix(slack): preserve thread context in auto-replies#251

Merged
steipete merged 1 commit into
openclaw:mainfrom
scald:fix/slack-thread-replies
Jan 6, 2026
Merged

fix(slack): preserve thread context in auto-replies#251
steipete merged 1 commit into
openclaw:mainfrom
scald:fix/slack-thread-replies

Conversation

@scald

@scald scald commented Jan 5, 2026

Copy link
Copy Markdown
Contributor

Summary

When replying to a message in a Slack thread, the response now stays in the thread instead of going to the channel root.

Changes

  • Added optional threadTs parameter to deliverReplies
  • Passes ctxPayload.ReplyToId (which contains thread_ts ?? ts) through to message delivery
  • Removes hardcoded const threadTs = undefined in favor of using the passed value

Testing

  • Existing Slack tests pass
  • Tested manually in GUMBO workspace

Fixes #250

@scald scald force-pushed the fix/slack-thread-replies branch from 68b2b3e to 7b274f8 Compare January 5, 2026 23:12
@scald scald marked this pull request as draft January 5, 2026 23:16
@scald scald marked this pull request as ready for review January 5, 2026 23:22
@steipete

steipete commented Jan 6, 2026

Copy link
Copy Markdown
Contributor

Clean change, thank you! Will add regression tests and merge.

When replying to a message in a Slack thread, the response now stays
in the thread instead of going to the channel root.

Only threads replies when the incoming message was already in a thread
(has thread_ts). Top-level messages get top-level replies.

Fixes openclaw#250
@steipete steipete force-pushed the fix/slack-thread-replies branch from 7b274f8 to 7034d4f Compare January 6, 2026 04:10
@steipete steipete merged commit e54865b into openclaw:main Jan 6, 2026
13 checks passed
dgarson added a commit to dgarson/clawdbot that referenced this pull request Feb 9, 2026
* feat(agents): add runtime tool-approval orchestrator with approvals.tools config

- Add approvals.tools config types + zod schema (enabled, mode, timeoutMs, policy, routing, classifier)
- Create tool-approval orchestrator module (decision engine, param redaction, gateway integration)
- Integrate orchestrator into before-tool-call wrapper path (runs after plugin hooks, before execution)
- Add ToolApprovalBlockedError with stable machine-readable error shape
- Add 90 tests covering all mode/decision/risk branches
- Backward-compatible: no behavior change when approvals.tools is missing or disabled

* feat: upgrade /approve and Discord handler to canonical tool approvals

- /approve now queries tool.approvals.get for canonical records and resolves
  via tool.approval.resolve (with requestHash); falls back to legacy
  exec.approval.resolve when no canonical record is found
- Discord handler listens for tool.approval.requested/resolved events and
  renders generic tool approval embeds for non-exec tools
- resolveApproval prefers tool.approval.resolve when requestHash is cached,
  keeping legacy exec path for backward compatibility
- Updated command description to 'tool approval requests'
- Added shouldHandleToolApproval for canonical event filtering
- Extended tests with canonical, legacy-fallback, and gateway-error scenarios

* refactor: rename .clawdbrain → .openclaw and fix repo/domain references

- Settings dir: ~/.clawdbrain → ~/.openclaw
- Repo references: openclaw/clawdbrain → dgarson/clawdbrain
- Domain: clawdbrain.bot → openclaw.ai
- CLI command: clawdbrain login → openclaw login
- 48 files changed across src/, docs/, apps/web/, ui/

* cron timeout fixes

* feat(agents): wire tool approval context from config into tool creation path

- Inject approvals.tools config into wrapToolWithBeforeToolCallHook context
- Populate channel field from messageProvider via resolveGatewayMessageChannel
- Wire callGatewayTool as the gateway call adapter for approval requests
- Approval context is only constructed when approvals.tools exists and is enabled

* fix: address review gaps in tool approval handler

- Exec dedup: store canonical request for exec tools and defer embed
  creation by 200ms so the legacy mirror gets first shot; if the mirror
  never arrives, fall back to a generic tool embed (future-proofs against
  legacy event removal)
- Extract sendToolApprovalEmbed to eliminate code duplication
- Add buildApprovalCustomId / parseApprovalData generic aliases (same
  wire format, clearer naming for non-exec tool code paths)
- Add alias identity tests

* fix: minor tool approval request fixes

* auto-reply/approval integration fix

* include exec approval doc

* fix: agent-runner-execution integration into auto-reply, executor/kernel fixes

* more work on agent runner and memory/heartbeta integration

* lots of tests resulting from unification of exec kernel; refactored

* Redact arrays in approval helper

* lancedb fixes

* more fixes/test updates

---------

Co-authored-by: Claude <noreply@anthropic.com>
dgarson added a commit to dgarson/clawdbot that referenced this pull request Feb 22, 2026
…bug Timeline (HIGH)

- Scrubable playback timeline with event markers, play/pause/speed controls (1×/2×/5×/10×)
- Event list: user, assistant, tool_call, tool_result, context_shift, error, system types
- Gap annotations between events (>500ms)
- Event inspector: detail / raw JSON / context tabs
- Tool I/O panel: input/output diff, duration, success/fail indicator
- Context window panel: before/after token counts, compaction savings
- Stats strip: live event/tool/error/token counts at scrub position
- Filter chips per event type
- 3 rich mock debug sessions (luis main, xavier review, piper subagent)
- 0 TS errors, strict types, no any, no replaceAll
Fato07 referenced this pull request in Fato07/elav Mar 26, 2026
fix(heartbeat): prevent false process_lost failures on queued and non-child-process runs
lovewanwan pushed a commit to lovewanwan/openclaw that referenced this pull request Apr 28, 2026
fix(slack): preserve thread context in auto-replies
@smallwei0301

Copy link
Copy Markdown

Grounded verification note (runtime / tests / risk)

I verified that Slack thread-context preservation is present in the runtime send path, not only in helper code.

What is grounded in runtime now

  • Slack thread target resolution exists in src/slack/threading.ts:45-58
    • resolves replyThreadTs
    • resolves statusThreadTs
    • distinguishes genuine thread replies from top-level cases
  • Tool/runtime bridge exists in src/slack/threading-tool-context.ts:18-27
    • uses MessageThreadId ?? ReplyToId
    • exposes currentThreadTs
    • upgrades reply mode to all when there is an explicit thread target
  • Outbound plugin surface exists in src/channels/plugins/outbound/slack.ts:61-84
    • computes threadTs from replyToId or threadId
    • passes it through to Slack send
  • Actual Slack send path uses thread_ts in src/slack/send.ts
    • postMessage: src/slack/send.ts:88-129
    • file upload completion: src/slack/send.ts:237-243
    • normal send flow: src/slack/send.ts:283-349

Runtime artifact evidence

  • Built runtime bundles in /app/dist contain thread_ts: params.threadTs in send paths
  • Built runtime bundles also contain Slack thread resolution/runtime context code

Tests I ran just now

  • pnpm vitest run src/slack/threading.test.ts src/slack/threading-tool-context.test.ts src/channels/plugins/outbound/slack.test.ts
  • Result: 3 files passed, 23 tests passed

Current risk boundary

  • Thread context is already wired into runtime send paths.
  • Remaining risk is surface-specific behavior regressions at inbound event normalization or account config level, not missing threadTs propagation in outbound runtime.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 9, 2026
fix(slack): preserve thread context in auto-replies
matin added a commit to matin/openclaw that referenced this pull request Jun 9, 2026
…o-accented (tulgey openclaw#251) (#18)

Without speechConfig.languageCode, Gemini TTS infers the spoken language
from the text's script: Arabic -> Persian (Farsi correct), but Latin
defaults to English, so Latin-script Spanish was read with an English
accent. Add an optional, omit-when-absent languageCode to the shared
generateContent body and resolve it per turn by precedence:
directive/talk override > operator config > Spanish auto-detection > omit.

Omit-when-absent preserves Gemini's script-based auto-selection (the
Arabic-script -> Persian path Farsi relies on). The auto-detector abstains
unless it is confident the text is Spanish (stopword scorer + inverted
punctuation; never touches non-Latin scripts and strips the audio-profile
wrapper before scoring), so Farsi keeps its Persian voice and English stays
English. Default detected locale es-MX; operators can pin a locale via
config/`[[tts:language=...]]` or disable detection with detectLanguage:false.

Refs tulgey openclaw#247 / ADR 0024.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

Slack: auto-replies don't stay in thread

3 participants