Skip to content

fix/discord numeric channel id 26139#26164

Closed
Nipurn123 wants to merge 1 commit intoopenclaw:mainfrom
Nipurn123:fix/discord-numeric-channel-id-26139
Closed

fix/discord numeric channel id 26139#26164
Nipurn123 wants to merge 1 commit intoopenclaw:mainfrom
Nipurn123:fix/discord-numeric-channel-id-26139

Conversation

@Nipurn123
Copy link
Copy Markdown

@Nipurn123 Nipurn123 commented Feb 25, 2026

  • feat(telegram): add sendDice action for animated dice rolling
  • Update src/telegram/send.ts
  • Update src/agents/tools/telegram-actions.ts
  • refactor: provider handler registry for extra-params.ts
  • fix: use validEmoji for type-safe dice emoji param
  • ci: trigger CI rerun
  • gateway: add orphan transcript cleanup on startup (closes Sessions: orphan transcript .jsonl files accumulate in agents/main/sessions/ without cleanup #25373)
  • fix(agents): preserve thinking blocks in latest assistant message during compaction
  • fix(discord): correctly parse numeric channel id when guild is also numeric

Greptile Summary

This PR bundles several distinct changes: a Discord bug fix for numeric channel ID parsing, a Telegram sendDice feature, a provider handler registry refactoring in extra-params.ts, a fix to preserve thinking blocks in the latest assistant message during compaction (Anthropic API requirement), and orphan transcript cleanup on gateway startup.

  • fix(discord): When both guild and channel in a guild/channel input are numeric IDs, the parser now correctly returns channelId instead of treating the channel as a name to search — fixing resolution failures for numeric Discord channel IDs.
  • feat(telegram): Adds sendDice action across the full stack: Telegram API send function, action handler, channel plugin adapter, config gating, and tests. Minor typo in the error message for invalid emojis (missing space).
  • refactor(extra-params): Replaces the imperative if-chain for provider-specific stream wrappers with a registry-based Map<string, ProviderHandler[]> pattern. Behavior is preserved via Map insertion order, though the zai/z-ai handlers remain duplicated.
  • fix(thinking blocks): dropThinkingBlocks now preserves thinking blocks in the latest assistant message, preventing Anthropic API 400 errors during session compaction.
  • gateway: Adds cleanupOrphanTranscripts to archive session transcript files not referenced in the session store on startup, with a safety threshold of 10 files.

Confidence Score: 4/5

  • This PR is generally safe to merge — the changes are well-tested and follow existing patterns, with only a minor typo issue.
  • The PR includes multiple independent changes that are each well-structured and tested. The Discord fix is minimal and targeted with a clear test. The thinking block preservation fix addresses a real Anthropic API error with thorough test coverage. The extra-params refactoring preserves behavior via Map insertion order. The sendDice feature follows established Telegram action patterns. The orphan transcript cleanup has a safety threshold. The only issues found are a minor typo in an error message and a style-level redundant dynamic import.
  • src/agents/pi-embedded-runner/extra-params.ts deserves careful review since the refactoring to a registry pattern changes the control flow structure, though behavior should be equivalent. src/gateway/server-startup.ts introduces file archival logic that runs on every gateway startup.

Last reviewed commit: ca70631

Context used:

  • Context from dashboard - CLAUDE.md (source)

@openclaw-barnacle openclaw-barnacle bot added channel: discord Channel integration: discord channel: telegram Channel integration: telegram gateway Gateway runtime agents Agent runtime and tooling size: L labels Feb 25, 2026
@Nipurn123 Nipurn123 force-pushed the fix/discord-numeric-channel-id-26139 branch from 3bdd722 to ca70631 Compare February 25, 2026 05:34
@openclaw-barnacle openclaw-barnacle bot added size: XS and removed channel: telegram Channel integration: telegram gateway Gateway runtime agents Agent runtime and tooling size: L labels Feb 25, 2026
Copy link
Copy Markdown
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.

14 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Feb 25, 2026

Additional Comments (2)

src/agents/tools/telegram-actions.ts
Missing space in error message

There's a missing space between ⚽ and 🎳 in the error message string. The validation array on line 382 is correct, but the user-facing error message has them joined together as ⚽🎳 instead of ⚽ 🎳.

      throw new Error(`Invalid dice emoji: ${emoji}. Must be one of: 🎲 🎯 🏀 ⚽ 🎳 🎰`);
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/agents/tools/telegram-actions.ts
Line: 383

Comment:
**Missing space in error message**

There's a missing space between ⚽ and 🎳 in the error message string. The validation array on line 382 is correct, but the user-facing error message has them joined together as `⚽🎳` instead of `⚽ 🎳`.

```suggestion
      throw new Error(`Invalid dice emoji: ${emoji}. Must be one of: 🎲 🎯 🏀 ⚽ 🎳 🎰`);
```

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

src/gateway/server-startup.ts
Redundant dynamic imports of path and fs

path is already imported statically at the top of this file (line 1), so the dynamic await import("node:path") on line 44 is redundant — it just shadows the outer binding. Similarly, fs could be a static import since this module already has top-level imports and isn't lazy-loaded. Consider using static imports to keep the code consistent with the rest of the file.

  const fs = await import("node:fs");

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/gateway/server-startup.ts
Line: 43-44

Comment:
**Redundant dynamic imports of `path` and `fs`**

`path` is already imported statically at the top of this file (line 1), so the dynamic `await import("node:path")` on line 44 is redundant — it just shadows the outer binding. Similarly, `fs` could be a static import since this module already has top-level imports and isn't lazy-loaded. Consider using static imports to keep the code consistent with the rest of the file.

```suggestion
  const fs = await import("node:fs");
```

<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>

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

@openclaw-barnacle
Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle bot added the stale Marked as stale due to inactivity label Mar 3, 2026
@thewilloftheshadow
Copy link
Copy Markdown
Member

Superseded by #33142 which consolidates the fixes from this PR. Closing this in favor of that PR.

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

Labels

channel: discord Channel integration: discord size: XS stale Marked as stale due to inactivity

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sessions: orphan transcript .jsonl files accumulate in agents/main/sessions/ without cleanup

2 participants