fix(review): mount the slack channels subtree so Slack pings actually deliver

Merged
KH
6mo ago
+32-1

User description

Problem

The pr-reviewer's Slack notifications (ready-for-review ping, failure warning, merge :tada:) never fire, even with SLACK_CHANNEL configured.

Root cause (traced end-to-end)

Cloud mounts an integration's relayfile subtree only from its scope (or from triggers — this persona has github triggers only). The persona declared slack: {} with no scope:

  • cloud persona-deploy.ts relayfilePathsFromScope() returns [] when scope is not a record — the /slack/** provider-root fallback sits inside the isRecord branch and is unreachable for a missing scope.
  • → relayfileMountPathsForPersona emits zero slack paths → RELAYFILE_MOUNT_PATHS and the relayfile token exclude /slack/** → the mount daemon never watches the slack subtree.
  • slackClient().post() (relay-helpers → adapter-core writeJsonFile) writes its draft JSON to unmounted local disk, polls 3s for a writeback receipt that can never come, and returns {channel, ts: ''} with no error — a perfectly silent no-op at all three post sites in review/agent.ts.
  • GitHub comments work only because the github triggers mount /github/... paths — which is why only Slack was missing.

Fix

Declare a slack scope so the integration mounts. The channel is picked at deploy time (SLACK_CHANNEL input), so the scope can't name one statically — mount the channels subtree, which covers the /slack/channels/{channelId}/messages writeback path for any picked channel and excludes DMs/users:

slack: {
  scope: { paths: '/slack/channels/**' }
}

Shape constraints (both verified against persona-kit + cloud code):

  • persona-kit parseIntegrationConfig discards empty scope objects client-side, so scope: {} (to reach cloud's /slack/** fallback) would silently regress to the broken shape — the scope must be a non-empty string map.
  • cloud uses leading-/ scope values verbatim, so /slack/channels/** lands as-is in the mount paths and token scope.

Test

New regression test pins both halves: the persona's slack scope survives parseIntegrations as a non-empty map and covers /slack/channels. Verified red against the old slack: {} shape and against scope: {}.

npm test: 20/20 pass. npm run typecheck: clean. agentworkforce persona compile review/persona.ts: compiled artifact carries the scope.

Notes for deploy

  • Requires a redeploy of the pr-reviewer persona to take effect (mount paths are derived at deploy/delivery time).
  • The success ping additionally requires SLACK_CHANNEL to be set on the deployment and the harness to end with the READY sentinel — worth confirming the live deployment has a channel value once this lands.
  • A possible cloud-side follow-up: derive /slack/channels/<input>/messages/** from slack-picker input values at delivery time, which would scope the mount to the one configured channel.

🤖 Generated with Claude Code


Summary by cubic

Mounts the Slack channels subtree via integration scope so PR reviewer Slack notifications deliver. Adds a regression test to pin the scope shape and coverage.

  • Bug Fixes

    • Set Slack integration scope: { paths: '/slack/channels/**' } to mount the message writeback path.
    • Added a test verifying @agentworkforce/persona-kit keeps a non-empty Slack scope and that it covers /slack/channels/**.
  • Migration

    • Redeploy the PR reviewer persona.
    • Ensure SLACK_CHANNEL is set and the harness ends with READY for the success ping.

CodeAnt-AI Description

Make Slack review pings deliver reliably

What Changed

  • Slack review notifications now use a scope that mounts the channels subtree, so ready-for-review, failure, and merge pings can actually be sent.
  • The Slack setup no longer relies on an empty configuration, which previously caused messages to be written to unmounted storage and dropped without an error.
  • Added a test to confirm the Slack scope remains non-empty after persona parsing and still covers channel message delivery.

Impact

✅ Slack review pings now reach the channel
✅ Fewer silent missed notifications
✅ Earlier awareness when PRs are ready or fail

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.