Skip to content

feat: unified status reactions for Discord and Telegram#20819

Closed
wolly-tundracube wants to merge 9 commits intoopenclaw:mainfrom
TundraCube:feat/unified-status-reactions
Closed

feat: unified status reactions for Discord and Telegram#20819
wolly-tundracube wants to merge 9 commits intoopenclaw:mainfrom
TundraCube:feat/unified-status-reactions

Conversation

@wolly-tundracube
Copy link

@wolly-tundracube wolly-tundracube commented Feb 19, 2026

Summary

Extracts Discord's inline status reaction system into a shared, channel-agnostic controller and adds Telegram support. Net result: -87 lines (removed 253, added 166).

What it does

Shows lifecycle emoji reactions on trigger messages as the agent progresses:

👀 (queued) → 🤔 (thinking) → 🔥/👨‍💻/⚡ (tool) → 👍 (done) or 😱 (error)

Features

  • Debouncing (700ms) — prevents API spam on rapid state changes
  • Stall detection — 🥱 after 25s, 😨 after 60s of no progress
  • Tool classification — different emojis for coding (exec, read, write), web (web_search, browser), and generic tools
  • Promise chain serialization — prevents race conditions
  • Fully configurable — override emojis and timing via config

Config

{
  "messages": {
    "statusReactions": {
      "enabled": true,
      "emojis": { "done": "🎉", "thinking": "🤔" },
      "timing": { "stallSoftMs": 30000 }
    }
  }
}

Changes

New files

  • src/channels/status-reactions.ts — shared controller with adapter pattern
  • src/channels/status-reactions.test.ts — 34 unit tests

Discord (pure refactor, no behavior change)

  • src/discord/monitor/message-handler.process.ts — replaced 250-line inline implementation with shared controller + adapter

Telegram (new feature)

  • src/telegram/bot-message-context.ts — controller creation with Telegram adapter
  • src/telegram/bot-message-dispatch.ts — lifecycle hooks (setThinking, setTool, setDone, setError)

Config schema

  • src/config/types.messages.tsStatusReactionsConfig with emoji + timing types
  • src/config/zod-schema.session.ts — validation schema
  • src/config/schema.labels.ts + schema.help.ts — labels and help text

Testing

  • 34 unit tests covering state machine, debouncing, stall timers, tool classification, adapter variants
  • Manually tested on Telegram (live)
  • Discord behavior preserved (adapter produces identical API call pattern)
  • pnpm build ✅ · oxlint ✅ · vitest

🤖 AI-Assisted Contribution

  • AI-assisted: Built with OpenClaw (Claude Opus 4.6 + Sonnet 4.5 sub-agents)
  • Testing level: Fully tested — 34 unit tests + live Telegram testing
  • Human oversight: Architecture decisions, emoji selection, and code review by human contributor
  • Understanding: We understand what the code does — it was designed iteratively with the existing Discord implementation as reference

Greptile Summary

Extracts Discord's status reaction system into a shared controller (src/channels/status-reactions.ts) and adds Telegram support. The refactor removes ~250 lines from Discord's message handler and replaces it with a configurable, channel-agnostic controller using an adapter pattern.

Key changes:

  • New shared controller with debouncing (700ms), stall detection, promise chain serialization, and terminal state protection
  • Discord refactored to use the shared controller (preserves API call patterns)
  • Telegram now supports status reactions via config (messages.statusReactions.enabled)
  • 34 unit tests covering state machine, timers, and adapters
  • Fully configurable via messages.statusReactions config (emojis + timing)

Potential concern:

  • Discord's stall timing changed from 10s/30s → 25s/60s (this was intentional per PR description but changes existing behavior)

Confidence Score: 4/5

  • This PR is safe to merge with one timing behavior change to verify
  • Well-architected refactor with comprehensive test coverage (34 tests), clean adapter pattern, and preserves Discord API call patterns. The implementation is sound with proper promise serialization, debouncing, and terminal state protection. Only concern is the intentional stall timing change (10s/30s → 25s/60s) that affects existing Discord users - should be verified this is acceptable.
  • Check src/channels/status-reactions.ts for timing values if the stall duration change is not acceptable

Last reviewed commit: 8457b1b

(2/5) Greptile learns from your feedback when you react with thumbs up/down!

@openclaw-barnacle openclaw-barnacle bot added channel: discord Channel integration: discord channel: telegram Channel integration: telegram size: XL labels Feb 19, 2026
@wolly-tundracube
Copy link
Author

@greptileai review

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

9 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Comment on lines +64 to +66
debounceMs: 700,
stallSoftMs: 25_000,
stallHardMs: 60_000,
Copy link
Contributor

Choose a reason for hiding this comment

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

stall timing changed from Discord's original 10s/30s → 25s/60s - check this behavior change is intentional for existing Discord users

Suggested change
debounceMs: 700,
stallSoftMs: 25_000,
stallHardMs: 60_000,
stallSoftMs: 10_000,
stallHardMs: 30_000,
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/channels/status-reactions.ts
Line: 64-66

Comment:
stall timing changed from Discord's original 10s/30s → 25s/60s - check this behavior change is intentional for existing Discord users

```suggestion
  stallSoftMs: 10_000,
  stallHardMs: 30_000,
```

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

Copy link
Author

Choose a reason for hiding this comment

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

Resolved — reverted defaults to 10s/30s for Discord compatibility. Telegram uses 25s/60s via messages.statusReactions.timing config override. See commit 30e3736.

@thewilloftheshadow
Copy link
Member

Superseded by #22190 (continued here because I don't have push permissions on the fork).

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

Labels

channel: discord Channel integration: discord channel: telegram Channel integration: telegram size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants