Skip to content

fix(slack_app): post project command replies at channel root for top-level mentions - #73097

Merged
VojtechBartos merged 1 commit into
masterfrom
vojtab/slack-project-show-visible-reply
Jul 23, 2026
Merged

fix(slack_app): post project command replies at channel root for top-level mentions#73097
VojtechBartos merged 1 commit into
masterfrom
vojtab/slack-project-show-visible-reply

Conversation

@VojtechBartos

@VojtechBartos VojtechBartos commented Jul 23, 2026

Copy link
Copy Markdown
Member

Problem

@PostHog project (and the other project / rules / help command replies) gave no visible response when the command was a top-level mention. The reply used the mention's own ts as the thread anchor, and Slack only renders a thread-anchored ephemeral to a user who is actively viewing that thread. Posted at the channel root, the user was never in that thread, so it read as the bot ignoring them. See ticket 64409.

Changes

One line in handle_posthog_code_slack_mention_command_activity: anchor the reply to thread_ts only when the command was actually posted in a thread. For a top-level mention (or a slash command outside a thread) the anchor is empty, so the reply lands at the channel root where the user sees it.

-    thread_ts = event.get("thread_ts") or event.get("ts") or ""
+    thread_ts = event.get("thread_ts") or ""

The empty-anchor-posts-at-root behavior already existed for the slash surface; this just stops the mention surface from falling back to its own ts. It covers every project / rules / help reply on both surfaces and keeps them ephemeral, so it also fixes the original ticket (the "Default set to…" confirmation on project <id> now shows even when the project is unchanged) without needing the no-op special-casing from #73021.

The rules add picker is untouched — the workflow computes its own thread anchor for the interactive flow.

How did you test this code?

Corrected the existing parameterized test in test_mention_command_activity.py: its "in thread" case only set ts (no thread_ts), so it was really a top-level mention asserting the old buggy anchor. Split it into a genuine top-level case (ts only → root) and a real in-thread case (thread_ts set → threads there), plus the existing slash case. The top-level case is the regression guard — if the or event.get("ts") fallback comes back, it fails. 3 cases pass locally. Ran ruff. Not tested in a live Slack workspace.

Screenshot 2026-07-23 at 11 17 15

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

I (Vojta) directed this. Claude traced the mention → command workflow → handle_posthog_code_slack_mention_command_activity → handler path. We first tried making just the project show reply a visible chat_postMessage, then landed on this smaller root-cause fix: keep everything ephemeral and only drop the thread anchor for top-level mentions, which fixes all the command replies at once. /writing-tests was invoked for the test change.

@VojtechBartos VojtechBartos self-assigned this Jul 23, 2026
@VojtechBartos VojtechBartos added the skip-agent-review Save $$$, skip auto agent reviews (Greptile) — use for trivial or chore PRs label Jul 23, 2026
@trunk-io

trunk-io Bot commented Jul 23, 2026

Copy link
Copy Markdown

😎 This pull request was merged.

…ntions

The @PostHog command reply used the mention's own ts as the thread anchor
when the mention wasn't already in a thread. Slack renders a thread-anchored
ephemeral only to a user actively viewing that thread, so from a top-level
mention it read as no response. Anchor to thread_ts only when the command was
posted in a real thread; otherwise post at channel root where the user sees it.

This covers every project/rules/help reply on both the mention and slash
surfaces, and keeps them ephemeral.
@VojtechBartos
VojtechBartos force-pushed the vojtab/slack-project-show-visible-reply branch from 2bd5581 to 46eb877 Compare July 23, 2026 09:13
@VojtechBartos VojtechBartos changed the title fix(slack_app): reply visibly to project command instead of ephemeral fix(slack_app): post project command replies at channel root for top-level mentions Jul 23, 2026
@VojtechBartos
VojtechBartos requested a review from a team July 23, 2026 09:17
@VojtechBartos
VojtechBartos marked this pull request as ready for review July 23, 2026 09:17
@greptile-apps

greptile-apps Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "fix(slack_app): post command replies at ..." | Re-trigger Greptile

@VojtechBartos
VojtechBartos enabled auto-merge (squash) July 23, 2026 09:30
@VojtechBartos
VojtechBartos merged commit f6e7039 into master Jul 23, 2026
351 of 354 checks passed
@VojtechBartos
VojtechBartos deleted the vojtab/slack-project-show-visible-reply branch July 23, 2026 09:42
@deployment-status-posthog

deployment-status-posthog Bot commented Jul 23, 2026

Copy link
Copy Markdown

Deploy status

Environment Status Deployed At Workflow
dev ✅ Deployed 2026-07-23 10:16 UTC Run
prod-us ✅ Deployed 2026-07-23 10:36 UTC Run
prod-eu ✅ Deployed 2026-07-23 10:37 UTC Run

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

Labels

skip-agent-review Save $$$, skip auto agent reviews (Greptile) — use for trivial or chore PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants