Repository navigation
[3555 by Claude Opus 5.5] Official plugin: Slack app mode (threads per pull request, mention to start a task) - #3586
Conversation
…ck app, a team gets one thread per pull request, and mentioning the bot in a mapped channel creates a GitHub issue with the trigger label. Incoming-webhook mode is unchanged and stays the default.
Tests: these pass:
- all plugin suites (56 tests), including the new `packages/plugins/test/slackApp.test.ts`.
- the new core test `packages/core/test/slackPluginEvents.test.ts`.
- the existing core plugin and webhook suites and the API plugin route suites.
- `plugins:check`, zero-warning lint and typecheck on the plugins package.
I broke the code on purpose in three places (retry de-duplication, HTML escaping, thread reuse) and the new tests failed each time. I did not run the full repository suite, the docs build, or the existing Plugins Playwright specs. Nothing was tested against a real Slack workspace; the README has a manual checklist for that.
What changed
- Manifest:
- new connections: a bot token (sent only to `slack.com`) and a signing secret.
- new permission: `issues.create`.
- new settings: Delivery mode (`incoming-webhook` by default, or `app`), Repository channels (repository → channel ID), Default channel, allowed user IDs, allowed user group, and Trigger label (default `AI`).
- one inbound `events` webhook, verified with `slack-v0`, plus a function that answers Slack's URL verification challenge at once.
- Mentions (`slack/mentions.ts`): a mention from a person (bots, edits and other message subtypes are ignored) creates one issue in the repository mapped to the channel. The title is the first line, the body quotes the request with a link back to Slack, and the only label is the trigger label. The bot replies in the thread with the issue link. People not on the allow-list get a polite refusal. An unmapped channel, a channel mapped to several repositories, or an empty mention gets a short explanation and creates nothing.
- Untrusted text: the request text only ever becomes the issue's title and body. HTML and `<!-- … -->` markers are escaped and `@mentions` are made inert. The repository comes from the channel, the label from settings, and the model from ProPR's own routing.
- Retries: each handled message is remembered in `ctx.state`, so a retried Slack event or delivery creates no second issue. If issue creation fails in a way that may still have created the issue, the delivery fails and is not retried, so a request never produces two issues.
- Threads (`slack/threads.ts`, `slack/appDelivery.ts`): the first update about a pull request starts its thread and later updates reply there. A pull request whose issue came from a mention uses the mention's thread. If the thread's first message was deleted, a new thread is started.
- Docs: the README has the Slack app manifest, the scopes (`app_mentions:read`, `chat:write`, `usergroups:read`), a manual smoke-test checklist and links to the Slack documentation I checked. `docs/docs/plugins/slack.md` has a new app-mode section, and the plugin list in `docs/docs/features/plugins.md` is updated.
- Shared test changes: I loosened the Slack-specific expectations in `chatNotifications.test.ts` for the new connections, and added an `official` option to the core test helper `pluginHandlerFixture`.
Limitations:
- App mode only talks to `slack.com`, so GovSlack workspaces need incoming-webhook mode.
- The plugin keeps the 150 most recent thread mappings; older pull requests start a new thread.
I captured five previews of the Slack plugin's page (connections, webhook URL, settings, phone width). They are built from the real manifest with mocked API data, using a temporary Playwright spec that I deleted afterwards.
Acceptance criteria
- AC1: met — `packages/core/test/slackPluginEvents.test.ts` (signed fixtures in `slack/fixtures/events.json` accepted; a tampered body, wrong secret, stale or missing timestamp refused; the challenge answered through the real receiver) and the challenge test in `packages/plugins/test/slackApp.test.ts`
- AC2: met — `slackApp.test.ts` ("a mention from an allowed user … retries create no second issue") and `slackPluginEvents.test.ts` (one issue for the event and its Slack retry through the real receiver)
- AC3: met — `slackApp.test.ts` ("a non-allowed user, an unmapped channel, a bot message or an empty mention creates nothing"), covering own-bot and other-bot messages
- AC4: met — `slackApp.test.ts` ("message text cannot set the labels, the repository or the model (injection)"), using the `injection` fixture
- AC5: met — `slackApp.test.ts` ("events for a pull request reuse its stored thread…" and "the incoming-webhook mode keeps working…"), and the unchanged incoming-webhook cases in `chatNotifications.test.ts`
- AC6: met — `slackApp.test.ts` ("no message contains code, logs, prompt text, tool output or credentials (sentinel)"), plus the existing sentinel test in `chatNotifications.test.ts`
- AC7: met — `packages/plugins/slack/README.md` (app manifest, required scopes, smoke-test checklist, Slack doc links) and `docs/docs/plugins/slack.md` (new app-mode section)
|
/ultrafix goal=8 max=10 |
|
🔄 Ultrafix loop started (goal: 8/10, max cycles: 10) First action:
|
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR adds Slack app delivery and mention-driven issue creation with clear separation from incoming-webhook delivery. It needs changes before merge because bounded mention history breaks the promised retry deduplication. ✅ Verified inbound requests — The manifest selects ✅ Controlled issue creation — Repository selection and labels come from settings; request text is confined to title and body. ✅ Existing delivery preserved — Incoming-webhook mode remains the default and delegates to the existing delivery implementation. This review is a static analysis of the supplied code; no commands were run. The supplied current-head status has no failures and five pending checks. Merge blockersEvery finding below was introduced by this PR and must be resolved before merging. F1: 🔴 Eviction allows retries to create duplicate issues
SuggestionsThese are optional follow-ups and are not sent to S1: 🟢 Verify concurrent delivery behaviorThe supplied receiver test waits for the runner to become idle before submitting a retry. A follow-up test with overlapping deliveries would clarify whether runner serialization protects the separate read/check/write operations in mention handling and thread creation. This is optional here because the supplied excerpts do not establish a reachable concurrent execution defect. S2: 🟢 Complete the workspace smoke testThe documented manual checklist would provide useful evidence for actual Slack installation, thread deletion, and user-group behavior beyond mocked responses. This is additional integration confidence, not a separately verified code blocker. ScoreThe implementation has useful focused coverage and preserves existing delivery, but its deduplication retention policy violates a central acceptance criterion and can initiate duplicate work. Pending checks provide no evidence of failure. Score: 6/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
|
✅ Applied the requested follow-up changes in commit 3a6dbae
Summary of ChangesI fixed F1: once a mention has created an issue, or might have, no later mention can push its record out while a retry of that message is still possible. A replay after many other mentions now finds the record and creates nothing. What changed
Tests
Behaviour changes to know about
Found separately, not fixed (outside F1): the mention records are updated by read-then-write, with nothing stopping two handler runs at once. Two deliveries for the same message running together could both find no record and create two issues. Two runs for different messages in the same shard could overwrite each other's records. This has the same effect as F1 but a different cause (concurrency rather than eviction), and fixing it needs an atomic compare-and-set or per-message serialisation in plugin state. Review digestRisk-tiered paths
Validation evidence
Diff size: 7 files changed, +255/−37 lines 🤖 Implementation Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
…ave, no later mention can push its record out while a retry of that message is still possible. A replay after many other mentions now finds the record and creates nothing.
I fixed F1: once a mention has created an issue, or might have, no later mention can push its record out while a retry of that message is still possible. A replay after many other mentions now finds the record and creates nothing.
**What changed**
- **New `packages/plugins/slack/mentionRecords.ts`:** the mention records moved here from `threads.ts`.
- **Issue records are never dropped early.** Records that stand for an issue (`pending`, `created`, `replied`) stay until they expire. When space runs out, the oldest refused and ignored records go first. Losing one of those can at worst repeat a reply, never create an issue.
- **A full store defers new mentions.** If issue records alone fill a shard, `writeMention` returns false. The handler then fails the delivery as retryable (in 10 minutes) before calling `createIssue`, instead of forgetting a record it still needs.
- **Space is reserved up front.** Each unfinished record is counted at its largest size (with an issue number and link), so recording the created issue and the reply never needs more room than was set aside. Issue links over 200 characters aren't stored; the reply then names the issue without a link.
- **Records are kept long enough.** A record lasts about 26 hours past the later of its message time and its last write. That covers the one-hour intake window plus the longest a delivery can be retried: four retries at the 6-hour maximum `Retry-After`, plus handler timeouts, plus an hour of margin.
- **More room.** Records are spread over four state keys (`mentions:0` to `mentions:3`, chosen by a hash of the message), each capped at 12 KB, under the 16 KB per-value limit.
- **`mentions.ts`:** a mention received more than an hour after it was posted is now ignored (reason `expired`) before any record is read, and nothing is replied. The check uses `receivedAt`, which ProPR's retries of a delivery keep, so an old event cannot reach creation again after its record has expired.
- **Docs:** the README and `docs/docs/plugins/slack.md` now describe the one-hour window, the retention, and deferral when the store is full.
**Tests**
- **New `packages/plugins/test/slackMentionRecords.test.ts`**, with four tests:
- An allowed mention, then 1,000 distinct refused mentions, then a replay of the original: still one issue. This is the regression the finding proposed.
- An uncertain creation (a `pending` record), then 1,000 refused mentions, then a retry: `createIssue` is not called again.
- Issues are created until a shard fills: the next mention is deferred as retryable and creates nothing, and a retry of every earlier issue's message is still a duplicate.
- A mention just past the one-hour window is ignored without any request; one at the edge is still accepted. An expired record is dropped by the next write to its shard while unexpired ones stay.
- **Negative checks:** with issue records evictable again, the first three tests fail; with the age check removed, the fourth fails.
- **Passing:** all plugin suites (60 tests, including the updated storage-limit assertion in `slackApp.test.ts`), `packages/core/test/slackPluginEvents.test.ts`, plugins typecheck, zero-warning lint, and `plugins:check` ("5 plugins checked"). I did not run the docs build or the full repository suite. No previews, since nothing visible changed.
**Behaviour changes to know about**
- A mention delivered more than an hour after it was posted creates nothing and gets no reply.
- If a shard fills (roughly 40 to 100 mentions with issues within about 26 hours, depending on how many are unfinished), new mentions are retried with no reply in the thread. A mention still deferred when its retries run out fails without creating an issue.
**Found separately, not fixed (outside F1):** the mention records are updated by read-then-write, with nothing stopping two handler runs at once. Two deliveries for the same message running together could both find no record and create two issues. Two runs for different messages in the same shard could overwrite each other's records. This has the same effect as F1 but a different cause (concurrency rather than eviction), and fixing it needs an atomic compare-and-set or per-message serialisation in plugin state.
PR: #3586
Comment by: @propr-ultrafix (ID: 0)
Model: Claude Opus 5.5
|
⏳ Ultrafix is waiting for CI before the next These blocking checks on
Checks matching this repository's non-blocking checks never gate Ultrafix. The loop continues automatically once the blocking checks pass; if they have not settled within 2 hours, Ultrafix stops. |
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR adds Slack app delivery, mention-driven issue creation, and persistent thread mappings while preserving incoming-webhook delivery. It needs a localized recovery fix before merge. ✅ Verified inbound requests — The receiver verifies signatures and timestamps before invoking the challenge responder or mention handler. ✅ Controlled issue creation — Repository selection and labels come from settings, while request HTML and attribution-like markers are escaped. ✅ Broad test coverage — Tests cover authorization, sequential retries, bounded mention storage, thread reuse, and sensitive-content exclusion. Current-head checks report 24 passed and no failures. This review used static analysis of the supplied code; no commands were run. Merge blockersEvery finding below was introduced by this PR and must be resolved before merging. F2: 🔴 Restore thread mapping during recovery
SuggestionsThese are optional follow-ups and are not sent to S3: 🟢 Exercise overlapping webhook deliveriesThe retry tests process deliveries sequentially. A receiver-level test submitting the original event and its retry before awaiting runner completion would provide useful evidence that runner serialization protects the mention records’ read-modify-write operations. This is optional coverage: the supplied excerpts do not establish a reachable concurrency defect. ScoreThe implementation is focused and well tested, with passing current-head checks. One recoverable interruption can permanently break the promised thread association, requiring a small correction. Score: 6/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
|
✅ Applied the requested follow-up changes in commit 2d22dd2
Summary of ChangesI fixed F2. When a Slack mention is delivered again and its record says the issue was Change ( Regression test (
With the fix removed, this test fails. Verification: these all pass:
I did not run the full repository suite. Other paths with the same assumption:
No previews: the change is not visible in the UI. Review digestRisk-tiered paths
Validation evidence
Diff size: 2 files changed, +23/−1 lines 🤖 Implementation Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
… record says the issue was `created` but no reply has gone out yet, the handler now saves the issue's thread before posting the reply and marking the mention `replied`. So if the first attempt stopped after creating the issue but before saving the thread, the issue's pull request still posts in the mention's thread.
I fixed F2. When a Slack mention is delivered again and its record says the issue was `created` but no reply has gone out yet, the handler now saves the issue's thread before posting the reply and marking the mention `replied`. So if the first attempt stopped after creating the issue but before saving the thread, the issue's pull request still posts in the mention's thread.
**Change** (`packages/plugins/slack/mentions.ts`, in `handleSlackEvent`'s `created` recovery branch): the handler first checks with `findThread` whether the issue already has a thread. If not, it saves the mention's thread with `rememberThread`, then replies. If a thread is already saved, it is left alone. That covers the case where app mode started a new thread because the original first message was deleted.
**Regression test** (`packages/plugins/test/slackApp.test.ts`, in the existing reply-retry test): the first attempt is made to fail on the thread write, right after the `created` record is saved, standing in for a handler timeout. The test then checks that:
- there is no thread and no reply after that attempt.
- the retry saves the thread in the mention's channel and thread.
- exactly one issue-link reply is posted.
- a later `pull_request.opened` event for that issue reuses the mention's thread.
With the fix removed, this test fails.
**Verification:** these all pass:
- every plugin suite.
- `packages/core/test/slackPluginEvents.test.ts`.
- `plugins:check` ("5 plugins checked").
- the plugins package typecheck.
- zero-warning lint on the two changed files.
I did not run the full repository suite.
**Other paths with the same assumption:**
- A `replied` record always has its thread saved, because the thread is written before `replied`. It can still lose the thread to the existing 150-thread limit, which is already listed under Limitations.
- An attempt that stops while the mention is still `pending` cannot be recovered this way, because the issue number was never recorded. That is the at-most-one-issue behaviour that was already there, so I left it.
No previews: the change is not visible in the UI.
PR: #3586
Comment by: @propr-ultrafix (ID: 0)
Model: Claude Opus 5.5
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR adds Slack app notifications, thread reuse, and mention-to-issue creation while retaining incoming-webhook delivery. It is merge-ready within the supplied review scope; I found no verified merge blockers. ✅ Restricted issue creation — Repository selection comes from channel mappings, authorization defaults to denying users, and issue labels come exclusively from settings. ✅ Careful retry handling — Mention records distinguish pending creation from confirmed creation, allowing failed replies to resume without recreating issues. Capacity handling preserves records associated with issues. ✅ Relevant coverage — Added tests exercise signed webhook reception, thread reuse, authorization, injection handling, and record capacity. Current-head checks report 24 passed, none failed or pending. This was a static review of the supplied code and context. No commands were run or files modified. Merge blockersNo merge blockers. SuggestionsThese are optional follow-ups and are not sent to S4: 🟢 Exercise overlapping deliveriesThe new integration test waits for the first delivery to finish before submitting its retry. Consider testing overlapping deliveries through the real runner, including different messages sharing a mention shard. S5: 🟢 Verify retention across delayed recovery
ScoreThe implementation addresses the objective with substantial targeted coverage and passing current-head checks. Static inspection found no demonstrated defect requiring correction before merge. Score: 8/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
|
ℹ️ GitHub auto-merge is turned off for this repository, so ProPR merges this PR itself once it is ready (checks passed or no CI configured, and the review goal met). To let GitHub merge it the moment required checks pass, enable Settings → General → Pull Requests → Allow auto-merge. |
AI Implementation Summary
Closes #3555
Branch:
3555/claude-opus-5-5-official-plugin-slack-app-20261116-1521-orrCommits: ✅ Changes committed (ab3b6f8)
AI Processing Completed
Execution Details:
Summary:
I've added a Slack app mode to the
slackplugin. With their own Slack app, a team gets one thread per pull request, and mentioning the bot in a mapped channel creates a GitHub issue with the trigger label. Incoming-webhook mode is unchanged and stays the default.Tests: these pass:
packages/plugins/test/slackApp.test.ts.packages/core/test/slackPluginEvents.test.ts.plugins:check, zero-warning lint and typecheck on the plugins package.I broke the code on purpose in three places (retry de-duplication, HTML escaping, thread reuse) and the new tests failed each time. I did not run the full repository suite, the docs build, or the existing Plugins Playwright specs. Nothing was tested against a real Slack workspace; the README has a manual checklist for that.
What changed
slack.com) and a signing secret.issues.create.incoming-webhookby default, orapp), Repository channels (repository → channel ID), Default channel, allowed user IDs, allowed user group, and Trigger label (defaultAI).eventswebhook, verified withslack-v0, plus a function that answers Slack's URL verification challenge at once.slack/mentions.ts): a mention from a person (bots, edits and other message subtypes are ignored) creates one issue in the repository mapped to the channel. The title is the first line, the body quotes the request with a link back to Slack, and the only label is the trigger label. The bot replies in the thread with the issue link. People not on the allow-list get a polite refusal. An unmapped channel, a channel mapped to several repositories, or an empty mention gets a short explanation and creates nothing.<!-- … -->markers are escaped and@mentionsare made inert. The repository comes from the channel, the label from settings, and the model from ProPR's own routing.ctx.state, so a retried Slack event or delivery creates no second issue. If issue creation fails in a way that may still have created the issue, the delivery fails and is not retried, so a request never produces two issues.slack/threads.ts,slack/appDelivery.ts): the first update about a pull request starts its thread and later updates reply there. A pull request whose issue came from a mention uses the mention's thread. If the thread's first message was deleted, a new thread is started.app_mentions:read,chat:write,usergroups:read), a manual smoke-test checklist and links to the Slack documentation I checked.docs/docs/plugins/slack.mdhas a new app-mode section, and the plugin list indocs/docs/features/plugins.mdis updated.chatNotifications.test.tsfor the new connections, and added anofficialoption to the core test helperpluginHandlerFixture.Limitations:
slack.com, so GovSlack workspaces need incoming-webhook mode.I captured five previews of the Slack plugin's page (connections, webhook URL, settings, phone width). They are built from the real manifest with mocked API data, using a temporary Playwright spec that I deleted afterwards.
Acceptance criteria
packages/core/test/slackPluginEvents.test.ts(signed fixtures inslack/fixtures/events.jsonaccepted; a tampered body, wrong secret, stale or missing timestamp refused; the challenge answered through the real receiver) and the challenge test inpackages/plugins/test/slackApp.test.tsslackApp.test.ts("a mention from an allowed user … retries create no second issue") andslackPluginEvents.test.ts(one issue for the event and its Slack retry through the real receiver)slackApp.test.ts("a non-allowed user, an unmapped channel, a bot message or an empty mention creates nothing"), covering own-bot and other-bot messagesslackApp.test.ts("message text cannot set the labels, the repository or the model (injection)"), using theinjectionfixtureslackApp.test.ts("events for a pull request reuse its stored thread…" and "the incoming-webhook mode keeps working…"), and the unchanged incoming-webhook cases inchatNotifications.test.tsslackApp.test.ts("no message contains code, logs, prompt text, tool output or credentials (sentinel)"), plus the existing sentinel test inchatNotifications.test.tspackages/plugins/slack/README.md(app manifest, required scopes, smoke-test checklist, Slack doc links) anddocs/docs/plugins/slack.md(new app-mode section)Review digest
Acceptance criteria (7 of 7 met, as stated by the agent)
Signature and timestamp verification and the challenge response work (fixtures).—`packages/core/test/slackPluginEvents.test.ts` (signed fixtures in `slack/fixtures/events.json` accepted; a tampered body, wrong secret, stale or missing timestamp refused; the challenge answered through the real receiver) and the challenge test in `packages/plugins/test/slackApp.test.ts`A mention from an allowed user in a mapped channel creates one issue with the trigger label and replies in thread; retries of the same Slack event create no second issue.—`slackApp.test.ts` ("a mention from an allowed user … retries create no second issue") and `slackPluginEvents.test.ts` (one issue for the event and its Slack retry through the real receiver)A mention from a non-allowed user, in an unmapped channel, or a bot's own message creates nothing.—`slackApp.test.ts` ("a non-allowed user, an unmapped channel, a bot message or an empty mention creates nothing"), covering own-bot and other-bot messagesMessage text cannot set labels, the repository or the model (injection test).—`slackApp.test.ts` ("message text cannot set the labels, the repository or the model (injection)"), using the `injection` fixtureEvents for a pull request reuse the stored thread; the incoming-webhook mode from the previous issue keeps working.—`slackApp.test.ts` ("events for a pull request reuse its stored thread…" and "the incoming-webhook mode keeps working…"), and the unchanged incoming-webhook cases in `chatNotifications.test.ts`No message contains code, logs, prompt text, tool output or credentials (sentinel test).—`slackApp.test.ts` ("no message contains code, logs, prompt text, tool output or credentials (sentinel)"), plus the existing sentinel test in `chatNotifications.test.ts`README with the Slack app manifest, required scopes and a manual smoke-test checklist; `docs/docs/plugins/slack.md` updated.—`packages/plugins/slack/README.md` (app manifest, required scopes, smoke-test checklist, Slack doc links) and `docs/docs/plugins/slack.md` (new app-mode section)Risk-tiered paths
packages/plugins/slack/api.ts(added, +94/−0)packages/plugins/slack/appDelivery.ts(added, +59/−0)packages/plugins/slack/handlers.ts(+21/−6)packages/plugins/slack/manifest.json(+83/−6)packages/plugins/slack/mentions.ts(added, +262/−0)packages/plugins/slack/threads.ts(added, +86/−0)docs/docs/features/plugins.md(+1/−1)docs/docs/plugins/slack.md(+197/−16)packages/core/test/helpers/pluginHandlerFixture.ts(+4/−3)packages/core/test/slackPluginEvents.test.ts(added, +119/−0)packages/plugins/slack/README.md(+169/−20)packages/plugins/slack/fixtures/events.json(added, +67/−0)packages/plugins/slack/fixtures/webApi.json(added, +15/−0)packages/plugins/test/chatNotifications.test.ts(+6/−4)packages/plugins/test/slackApp.test.ts(added, +340/−0)Validation evidence
Diff size: 15 files changed, +1,523/−56 lines
Detailed Logs:
52848955-3ab6-4bc4-b5b0-c744ece6839dLog files stored at:
/usr/src/app/logs/executions/issue-3555-2026-11-16T15-45-00-348Z-conversation.json/usr/src/app/logs/executions/issue-3555-2026-11-16T15-45-00-348Z-output.txtLatest Conversation Messages
This PR was created automatically by ProPR after processing issue #3555.
💡 Need changes?
Comment on this PR to request refinements — the AI agent monitors comments and will update the implementation based on your feedback. Keep iterating until you're satisfied!
Visual preview
Slack app connections
Plugins › Slack, Connect step at 1440px: the new Bot token and Signing secret (app mode) connections and the plugin's events webhook URL (Slack slack-v0 verification) to paste as the Events API request URL. Rendered from the real slack/manifest.json with mocked API data.
Full-size original
Who may start tasks and trigger label
Configure step: the allow-list (Slack user IDs and user group ID) and the Trigger label put on issues created from mentions.
Full-size original
Delivery mode setting
Configure step: Delivery mode set to app, with its help text; incoming-webhook stays the default.
Full-size original
Repository channels on a phone
Configure step at 390px: Repository channels mapping integry/propr to a Slack channel ID, Default channel and the user allow-list.
Full-size original
Events API request URL
The Webhook URLs section of the Slack plugin: the events webhook with Copy and Regenerate.
Full-size original