fix(agent): tell Slack app not to wrap links in bold#2504
Closed
joshsny wants to merge 1 commit into
Closed
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:*https://...*breaks.<url|text>syntax for labeled links, again with no surrounding formatting.*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.agent-server.test.tsverifying the new# Slack formattingsection is present for Slack-origin prompts. Note: theagent-server.test.tssuite could not be executed in the sandbox because itsbeforeEachcallscreateTestRepo(git/env dependency) which fails here independently of this change; the added assertions are plain substring checks against the generated prompt string.Automatic notifications
Created with PostHog Code