Skip to content

fix(slack): wrap session key in backticks to prevent emoji shortcode parsing#30266

Merged
Takhoffman merged 3 commits intoopenclaw:mainfrom
pushkarsingh32:fix/slack-session-key-emoji-shortcodes
Mar 1, 2026
Merged

fix(slack): wrap session key in backticks to prevent emoji shortcode parsing#30266
Takhoffman merged 3 commits intoopenclaw:mainfrom
pushkarsingh32:fix/slack-session-key-emoji-shortcodes

Conversation

@pushkarsingh32
Copy link
Contributor

Summary

  • Wraps the session key in the usage footer with backticks (inline code) so Slack doesn't auto-parse colon-delimited segments (:main:, :slack:, :direct:) as emoji shortcodes

Before: Usage: 3 in / 1.8k out · session agent:main:slack:direct:u045c0gtsmb
(:main:, :slack:, :direct: rendered as grey emoji placeholder boxes)

After: Usage: 3 in / 1.8k out · session `agent:main:slack:direct:u045c0gtsmb`
(session key rendered as inline code — no emoji parsing)

Changes

  • src/auto-reply/reply/agent-runner.ts: Wrap sessionKey in backticks when appending to usage footer
  • src/auto-reply/reply/agent-runner.misc.runreplyagent.test.ts: Update test assertion to match new format

Test plan

  • Existing test suite passes (pnpm test — 23/23 tests pass in the affected file)
  • Manual verification: send a message via Slack DM with responseUsage: "full" and confirm the session key renders as inline code without emoji shortcode parsing

Fixes #30258

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 1, 2026

Greptile Summary

Wraps the session key in backticks when appending to the usage footer (when responseUsage="full") to prevent Slack from parsing colon-delimited segments like :main:, :slack:, :direct: as emoji shortcodes.

  • Modified agent-runner.ts to wrap sessionKey in backticks in the formatted usage string
  • Updated test assertion in agent-runner.misc.runreplyagent.test.ts to match the new format with backticks
  • This is a targeted fix that only affects the display of session keys to end users in Slack, not internal logging or processing
  • The change is minimal and well-tested

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The change is minimal (wrapping a single variable in backticks), well-targeted to fix a specific Slack rendering issue, and includes a corresponding test update. No logical errors or edge cases identified.
  • No files require special attention

Last reviewed commit: 4cc21dc

pushkarsingh32 and others added 3 commits March 1, 2026 09:02
…parsing

Session keys like `agent:main:slack:direct:u045c0gtsmb` contain
colon-delimited segments that Slack auto-parses as emoji shortcodes.
Wrapping the session key in backticks (inline code) prevents Slack
from interpreting `:main:`, `:slack:`, `:direct:` as emoji.

Fixes openclaw#30258
@Takhoffman Takhoffman force-pushed the fix/slack-session-key-emoji-shortcodes branch from 4cc21dc to d6aabc4 Compare March 1, 2026 15:23
@openclaw-barnacle openclaw-barnacle bot added the channel: slack Channel integration: slack label Mar 1, 2026
@Takhoffman Takhoffman merged commit 4ba0a4d into openclaw:main Mar 1, 2026
9 checks passed
@Takhoffman
Copy link
Contributor

PR #30266 - fix(slack): wrap session key in backticks to prevent emoji shortcode parsing (#30266)

Merged via squash.

  • Merge commit: 4ba0a4d
  • Verified: pnpm build, pnpm check, pnpm test:macmini
  • Changes made:
    M\tCHANGELOG.md
    M\textensions/slack/src/channel.test.ts
  • Why these changes were made:
    Added the required changelog entry and updated the Slack plugin config test to match the current async snapshot API ( argument + awaited return), so the PR remains minimal and passes strict gates on latest main.
  • Changelog: CHANGELOG.md updated=true required=true opt_out=false

Thanks @pushkarsingh32!

@Takhoffman
Copy link
Contributor

Correction on merge summary details:

  • Changes made: CHANGELOG.md, extensions/slack/src/channel.test.ts
  • Why: add required changelog entry and update Slack config test to current async snapshot API (cfg argument + awaited return) so gates pass on latest main.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

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: d6aabc4591

ℹ️ 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".

});
if (formatted && responseUsageMode === "full" && sessionKey) {
formatted = `${formatted} · session ${sessionKey}`;
formatted = `${formatted} · session \`${sessionKey}\``;

Choose a reason for hiding this comment

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

P2 Badge Escape backticks before wrapping session key in code span

This interpolation wraps sessionKey in single backticks without escaping the key itself, so any backtick inside the key prematurely closes the code span and produces malformed markdown in the footer. Session keys are built from peer IDs that are lowercased but not punctuation-sanitized (src/routing/session-key.ts:129-142), and some channels can supply IDs/nicks containing ` (for example via extensions/irc/src/inbound.ts:280-288), so with responseUsage=full the Slack formatting fix can regress to broken rendering and re-enable shortcode parsing on the trailing segment.

Useful? React with 👍 / 👎.

zooqueen added a commit to hanzoai/bot that referenced this pull request Mar 1, 2026
ansh pushed a commit to vibecode/openclaw that referenced this pull request Mar 2, 2026
…parsing (openclaw#30266) thanks @pushkarsingh32

Verified:
- pnpm build
- pnpm check
- pnpm test:macmini

Co-authored-by: pushkarsingh32 <29558481+pushkarsingh32@users.noreply.github.com>
Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
steipete pushed a commit to Sid-Qin/openclaw that referenced this pull request Mar 2, 2026
…parsing (openclaw#30266) thanks @pushkarsingh32

Verified:
- pnpm build
- pnpm check
- pnpm test:macmini

Co-authored-by: pushkarsingh32 <29558481+pushkarsingh32@users.noreply.github.com>
Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
safzanpirani pushed a commit to safzanpirani/clawdbot that referenced this pull request Mar 2, 2026
…parsing (openclaw#30266) thanks @pushkarsingh32

Verified:
- pnpm build
- pnpm check
- pnpm test:macmini

Co-authored-by: pushkarsingh32 <29558481+pushkarsingh32@users.noreply.github.com>
Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
steipete pushed a commit to Sid-Qin/openclaw that referenced this pull request Mar 2, 2026
…parsing (openclaw#30266) thanks @pushkarsingh32

Verified:
- pnpm build
- pnpm check
- pnpm test:macmini

Co-authored-by: pushkarsingh32 <29558481+pushkarsingh32@users.noreply.github.com>
Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
robertchang-ga pushed a commit to robertchang-ga/openclaw that referenced this pull request Mar 2, 2026
…parsing (openclaw#30266) thanks @pushkarsingh32

Verified:
- pnpm build
- pnpm check
- pnpm test:macmini

Co-authored-by: pushkarsingh32 <29558481+pushkarsingh32@users.noreply.github.com>
Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
hanqizheng pushed a commit to hanqizheng/openclaw that referenced this pull request Mar 2, 2026
…parsing (openclaw#30266) thanks @pushkarsingh32

Verified:
- pnpm build
- pnpm check
- pnpm test:macmini

Co-authored-by: pushkarsingh32 <29558481+pushkarsingh32@users.noreply.github.com>
Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
execute008 pushed a commit to execute008/openclaw that referenced this pull request Mar 2, 2026
…parsing (openclaw#30266) thanks @pushkarsingh32

Verified:
- pnpm build
- pnpm check
- pnpm test:macmini

Co-authored-by: pushkarsingh32 <29558481+pushkarsingh32@users.noreply.github.com>
Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
dorgonman pushed a commit to kanohorizonia/openclaw that referenced this pull request Mar 3, 2026
…parsing (openclaw#30266) thanks @pushkarsingh32

Verified:
- pnpm build
- pnpm check
- pnpm test:macmini

Co-authored-by: pushkarsingh32 <29558481+pushkarsingh32@users.noreply.github.com>
Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
sachinkundu pushed a commit to sachinkundu/openclaw that referenced this pull request Mar 6, 2026
…parsing (openclaw#30266) thanks @pushkarsingh32

Verified:
- pnpm build
- pnpm check
- pnpm test:macmini

Co-authored-by: pushkarsingh32 <29558481+pushkarsingh32@users.noreply.github.com>
Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
zooqueen pushed a commit to hanzoai/bot that referenced this pull request Mar 6, 2026
…parsing (openclaw#30266) thanks @pushkarsingh32

Verified:
- pnpm build
- pnpm check
- pnpm test:macmini

Co-authored-by: pushkarsingh32 <29558481+pushkarsingh32@users.noreply.github.com>
Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
zooqueen added a commit to hanzoai/bot that referenced this pull request Mar 6, 2026
Mateljan1 pushed a commit to Mateljan1/openclaw that referenced this pull request Mar 7, 2026
…parsing (openclaw#30266) thanks @pushkarsingh32

Verified:
- pnpm build
- pnpm check
- pnpm test:macmini

Co-authored-by: pushkarsingh32 <29558481+pushkarsingh32@users.noreply.github.com>
Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: slack Channel integration: slack size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Usage footer session key breaks in Slack — colons parsed as emoji shortcodes

2 participants