Skip to content

fix: tolerate partial discord channel metadata - #68953

Merged
osolmaz merged 2 commits into
openclaw:mainfrom
osolmaz:fix/discord-partial-channel-slash
Apr 19, 2026
Merged

osolmaz merged 2 commits into
openclaw:mainfrom
osolmaz:fix/discord-partial-channel-slash

Conversation

@dutifulbob

Copy link
Copy Markdown
Contributor

Summary

  • safely read Discord channel names so slash commands do not crash on partial channel objects
  • reuse the same safe helper in the native command and model-picker route paths
  • add a regression test for a guild slash interaction whose channel.name getter throws

Testing

  • pnpm exec vitest run extensions/discord/src/monitor/native-command.commands-allowfrom.test.ts
  • pnpm exec vitest run extensions/discord/src/monitor/native-command.status-direct.test.ts
  • pnpm build

@openclaw-barnacle openclaw-barnacle Bot added channel: discord Channel integration: discord size: XS labels Apr 19, 2026
@greptile-apps

greptile-apps Bot commented Apr 19, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR introduces a resolveDiscordChannelNameSafe helper in a new channel-access.ts module that defensively reads channel.name by checking property existence first and then wrapping the access in a try/catch to handle Discord partial channel objects whose name getter throws at runtime. The helper is wired into three call sites in native-command.ts (×2) and native-command-ui.ts (×1), replacing ad-hoc inline casts, and a targeted regression test verifies the throw-path is silently tolerated.

Confidence Score: 5/5

Safe to merge — the fix is narrowly scoped, the logic is correct, and all three affected call sites are covered.

No P0/P1 findings. The helper correctly handles all three failure modes (non-object, missing property key, throwing getter). The regression test exercises the exact crash path described in the PR. Remaining observations are at most P2.

No files require special attention.

Reviews (1): Last reviewed commit: "fix: tolerate partial discord slash chan..." | Re-trigger Greptile

@openclaw-barnacle openclaw-barnacle Bot added size: S agents Agent runtime and tooling size: M and removed size: XS size: S labels Apr 19, 2026

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5a1fae69b5

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/shared/text/model-special-tokens.ts Resolved
@dutifulbob

Copy link
Copy Markdown
Contributor Author

This is ready.

What changed:

  • hardened Discord partial-channel access behind shared safe helpers and removed direct channel.name / channel.topic reads from the slash-command, picker/component, message, threading, and listener paths
  • kept component parent metadata thread-scoped so category parents do not affect component routing
  • continued control-token stripping after <channel|> delimiters on the visible-text path
  • sanitized block-reply delivery so Gemma text-end replies do not leak internal scaffolding into Discord
  • preserved indentation for leading fenced blocks while trimming delivery text

Validation:

  • pnpm exec vitest run extensions/discord/src/monitor/native-command.commands-allowfrom.test.ts extensions/discord/src/monitor/native-command.model-picker.test.ts src/shared/text/assistant-visible-text.test.ts src/agents/pi-embedded-subscribe.subscribe-embedded-pi-session.keeps-indented-fenced-blocks-intact.test.ts src/agents/pi-embedded-subscribe.subscribe-embedded-pi-session.emits-block-replies-text-end-does-not.test.ts
  • pnpm test extensions/discord/src/monitor/native-command.commands-allowfrom.test.ts extensions/discord/src/monitor/native-command.model-picker.test.ts src/shared/text/assistant-visible-text.test.ts src/agents/pi-embedded-subscribe.subscribe-embedded-pi-session.emits-block-replies-text-end-does-not.test.ts
  • pnpm build
  • full repo checks also passed in the commit flow (pnpm check, lint, tsgo, import-cycle checks)

Live smoke:

  • active Discord session: agent:main:discord:channel:1492296441803182130
  • switched to vllm/gemma4-e4b
  • prompt sent in #gemma-1: reply with exactly gemma-reply-check-1776607719 and nothing else
  • model run: provider=vllm model=gemma4-e4b
  • visible Bob message in Discord: gemma-reply-check-1776607719 (1495425949913710754)

The earlier review findings on component parent metadata and delimiter token stripping are addressed, and all current PR checks are green.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8b4be54016

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/shared/text/model-special-tokens.ts Resolved
@dutifulbob
dutifulbob force-pushed the fix/discord-partial-channel-slash branch from 8b4be54 to 1fc76ad Compare April 19, 2026 14:43
@openclaw-barnacle openclaw-barnacle Bot removed the agents Agent runtime and tooling label Apr 19, 2026
@dutifulbob

Copy link
Copy Markdown
Contributor Author

Scope split: the Discord partial-channel crash fix stays here, and the Gemma visible-output sanitization moved to #68986 so this PR stays narrow.

@dutifulbob dutifulbob changed the title fix: tolerate partial Discord slash channels fix: tolerate partial discord channel metadata Apr 19, 2026
@osolmaz
osolmaz merged commit 84cd786 into openclaw:main Apr 19, 2026
29 checks passed
@osolmaz
osolmaz deleted the fix/discord-partial-channel-slash branch April 19, 2026 15:00
@osolmaz

osolmaz commented Apr 19, 2026

Copy link
Copy Markdown
Member

Merged via squash.

Thanks @dutifulbob!

Mquarmoc pushed a commit to Mquarmoc/openclaw that referenced this pull request Apr 20, 2026
Merged via squash.

Prepared head SHA: 2026540
Co-authored-by: dutifulbob <[email protected]>
Co-authored-by: osolmaz <[email protected]>
Reviewed-by: @osolmaz
lovewanwan pushed a commit to lovewanwan/openclaw that referenced this pull request Apr 28, 2026
Merged via squash.

Prepared head SHA: 2026540
Co-authored-by: dutifulbob <[email protected]>
Co-authored-by: osolmaz <[email protected]>
Reviewed-by: @osolmaz
ogt-redknie pushed a commit to ogt-redknie/OPENX that referenced this pull request May 2, 2026
Merged via squash.

Prepared head SHA: 2026540
Co-authored-by: dutifulbob <[email protected]>
Co-authored-by: osolmaz <[email protected]>
Reviewed-by: @osolmaz
globalcaos pushed a commit to globalcaos/tinkerclaw that referenced this pull request May 13, 2026
Merged via squash.

Prepared head SHA: 2026540
Co-authored-by: dutifulbob <[email protected]>
Co-authored-by: osolmaz <[email protected]>
Reviewed-by: @osolmaz
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
Merged via squash.

Prepared head SHA: 2026540
Co-authored-by: dutifulbob <[email protected]>
Co-authored-by: osolmaz <[email protected]>
Reviewed-by: @osolmaz
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
Merged via squash.

Prepared head SHA: 2026540
Co-authored-by: dutifulbob <[email protected]>
Co-authored-by: osolmaz <[email protected]>
Reviewed-by: @osolmaz
vixco pushed a commit to vixco/openclaw that referenced this pull request Aug 16, 2026
Merged via squash.

Prepared head SHA: 2026540
Co-authored-by: dutifulbob <[email protected]>
Co-authored-by: osolmaz <[email protected]>
Reviewed-by: @osolmaz
Heetisk pushed a commit to Heetisk/openclaw that referenced this pull request Sep 28, 2026
Merged via squash.

Prepared head SHA: 2026540
Co-authored-by: dutifulbob <[email protected]>
Co-authored-by: osolmaz <[email protected]>
Reviewed-by: @osolmaz
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: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants