You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat: reply with the outcome in the slack bot thread (CM-1841) - #4924
Last PR of the onboarding-core sequence (after #4916, #4918, #4919): every outcome of a request made through the Slack bot is posted back in the thread where the bot was mentioned.
@crowd/slack: parseSlackPermalink(url) extracts channel, ts and parent thread from the permalink stored as sourceUrl (honours ?thread_ts= when the mention was already inside a thread); replyInSlackThread(sourceUrl, text) posts with the bot token.
@crowd/project-onboarding: botThreadReply.ts holds the reply texts (skipped, review, auto-apply disabled, onboarded, error) with mrkdwn escaping and reason truncation. buildInsightsProjectUrl replaces the duplicated Insights URL constant in the onboarding worker.
Evaluation worker: for slack-bot rows a skip (routing or LLM) replies in the thread instead of the webhook alert; after the review card is posted the thread gets "needs a human review"; with CROWD_ONBOARDING_AUTO_APPLY=false the removed row gets "automatic onboarding is disabled". GitHub discussion rows keep the webhook alerts.
Onboarding worker: onboarded replies with the Insights link (or "connected to its existing project" for create_integration / update_integration), error replies with the reason, and a new notifySkippedBotRequest activity re-reads the row and replies with its skipReason. All replies run as notify activities with a single attempt (see CM-1791).
Backend: a reject from the review channel replies in the bot thread with the reason. Approve does not reply, the onboarding worker does once it finishes.
Deployment note
automatic_onboarding_worker only used incoming webhooks so far: it now needs CROWD_SLACK_BOT_TOKEN to post thread replies. Backend and projects_evaluation_worker already have it.
Test plan
Unit tests: permalink parsing and thread reply, reply builders, immediate onboarding plan, review decision reject reply
pnpm lint --deny-warnings, pnpm format, pnpm tsc-check
Staging: mention the bot with a known LF repo, reject the card, check the thread; mention a non-LF repo with auto-apply on, check the onboarded reply
Medium Risk
Adds bot-token thread posts across evaluation, onboarding, and review paths; mis-parsed permalinks or missing CROWD_SLACK_BOT_TOKEN on automatic_onboarding_worker would silently skip user-facing feedback but should not corrupt catalog state.
Overview
Slack-bot project catalog requests now get outcome replies in the original mention thread (via stored sourceUrl), instead of relying only on review-channel webhooks for human-visible feedback.
New plumbing:@crowd/slack adds permalink parsing and replyInSlackThread; @crowd/project-onboarding centralizes reply copy (skipped, review, auto-apply off, onboarded, error) with escaping/truncation and buildInsightsProjectUrl.
Evaluation worker routes slack-bot skips, “posted to review,” and auto-apply-disabled removals to the thread; GitHub discussion rows still use skip/onboard alerts. Immediate-onboarding refs carry sourceUrl so disabled auto-apply can notify after row deletion (including retry/idempotency when the row was already removed).
Onboarding worker threads onboarded/success, errors, and newly skipped outcomes (notifySkippedBotRequest); distinguishes already-skipped from fresh skipped so only new skips trigger replies. Backend review reject also replies in the thread (approve still waits for onboarding worker).
Failed thread posts are logged and must not fail the surrounding Temporal batch.
Reviewed by Cursor Bugbot for commit c755a2d. Bugbot is set up for automated code reviews on this repo. Configure here.
Addressed both findings in the follow-up commit: onboardAndUpdateProject now returns already-skipped when another run recorded the skip, so only the run that applied it replies in the thread; applyImmediateOnboarding counts a row that no longer exists as removed by an earlier attempt, so a retried activity still returns it and the auto-apply reply is posted.
The reason will be displayed to describe this comment to others. Learn more.
Retry drops skipped thread reply
Medium Severity
resolveUnclaimedOutcome returns already-skipped whenever action is already skip, including when an earlier attempt of this same activity wrote that skip and then failed before Temporal stored the result. onboardProjects posts the thread reply only for skipped, and onboardAndUpdateProject is allowed a second attempt, so that retry never sends the outcome.
A reason containing an embedded triple-backtick closes this code block early, so the remainder is rendered as mrkdwn instead of as the quoted reason. This is plausible for LLM-generated skip reasons and breaks the reply formatting; neutralize embedded fences before wrapping the text.
Both follow-up findings describe the same case: a worker crash between the skip commit and the activity result being recorded, on the onboarding worker's only skip path (deleted Insights project). Telling that retry apart from a competing run needs a notification marker on the row; without it the choice is between a lost reply and a duplicate one, and the pipeline already prefers a lost notification (CM-1791). Leaving it as is for now, a marker column can follow in a separate ticket if it shows up in practice.
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
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.
Summary
Last PR of the onboarding-core sequence (after #4916, #4918, #4919): every outcome of a request made through the Slack bot is posted back in the thread where the bot was mentioned.
@crowd/slack:parseSlackPermalink(url)extracts channel,tsand parent thread from the permalink stored assourceUrl(honours?thread_ts=when the mention was already inside a thread);replyInSlackThread(sourceUrl, text)posts with the bot token.@crowd/project-onboarding:botThreadReply.tsholds the reply texts (skipped, review, auto-apply disabled, onboarded, error) with mrkdwn escaping and reason truncation.buildInsightsProjectUrlreplaces the duplicated Insights URL constant in the onboarding worker.slack-botrows a skip (routing or LLM) replies in the thread instead of the webhook alert; after the review card is posted the thread gets "needs a human review"; withCROWD_ONBOARDING_AUTO_APPLY=falsethe removed row gets "automatic onboarding is disabled". GitHub discussion rows keep the webhook alerts.onboardedreplies with the Insights link (or "connected to its existing project" forcreate_integration/update_integration),errorreplies with the reason, and a newnotifySkippedBotRequestactivity re-reads the row and replies with itsskipReason. All replies run as notify activities with a single attempt (see CM-1791).Deployment note
automatic_onboarding_workeronly used incoming webhooks so far: it now needsCROWD_SLACK_BOT_TOKENto post thread replies. Backend andprojects_evaluation_workeralready have it.Test plan
pnpm lint --deny-warnings,pnpm format,pnpm tsc-check