Skip to content

fix(agent): tell Slack app not to wrap links in bold#2504

Closed
joshsny wants to merge 1 commit into
mainfrom
posthog-code/slack-no-bold-links
Closed

fix(agent): tell Slack app not to wrap links in bold#2504
joshsny wants to merge 1 commit into
mainfrom
posthog-code/slack-no-bold-links

Conversation

@joshsny

@joshsny joshsny commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Problem

The PostHog Slack app frequently emits messages where a URL is wrapped in bold, e.g. *<https://github.com/PostHog/posthog/pull/61933*>. In Slack mrkdwn, bold is a single asterisk pair, so the trailing * ends up attached to the URL — when opened in a browser the link includes the stray * and 404s.

Changes

Added a Slack formatting section to the Slack-origin identity system prompt in agent-server.ts (buildCloudSystemPrompt). It tells the agent:

  • Never wrap a URL or link in bold (or any) formatting, with a concrete example of how *https://...* breaks.
  • Use Slack's <url|text> syntax for labeled links, again with no surrounding formatting.
  • Bold is a single asterisk pair (*text*), not double (**text**), and should only be used for short labels — never around links.

This guidance is only injected for Slack-origin runs, alongside the existing identity block.

How did you test this?

  • pnpm --filter agent typecheck — passes.
  • Added assertions to the existing identity-instructions tests in agent-server.test.ts verifying the new # Slack formatting section is present for Slack-origin prompts. Note: the agent-server.test.ts suite could not be executed in the sandbox because its beforeEach calls createTestRepo (git/env dependency) which fails here independently of this change; the added assertions are plain substring checks against the generated prompt string.

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

Created with PostHog Code

The Slack app frequently emits messages like `*<https://...pull/61933*>`, wrapping URLs in bold. In Slack mrkdwn bold is a single asterisk pair, so the trailing `*` attaches to the URL and breaks the link when opened in a browser.

Add a "Slack formatting" section to the Slack-origin identity system prompt instructing the agent to never wrap URLs/links in bold or other formatting, to use `<url|text>` for labeled links, and that bold is a single (not double) asterisk pair.

Generated-By: PostHog Code
Task-Id: f64ca0d9-fab3-49ff-9989-84a971f1a311
@joshsny joshsny closed this Jun 9, 2026
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.

1 participant