Skip to content

feat(slack): enable Enterprise Grid identity, DMs, routing, actions, approvals, and presence - #121373

Merged
sjf-oa merged 24 commits into
mainfrom
sjf/remove-slack-enterprise-setting
Aug 10, 2026
Merged

sjf-oa merged 24 commits into
mainfrom
sjf/remove-slack-enterprise-setting

Conversation

@sjf-oa

@sjf-oa sjf-oa commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Slack Enterprise Grid org-wide installations need workspace-scoped identity and routing without relying on the retired enterpriseOrgInstall setting. Bare Slack user and channel IDs are not globally unique across a Grid organization, so detached operations and pairing requests must fail closed or retain an authoritative workspace.

Implemented In This PR

Area Enterprise Grid behavior
Installation identity Detects workspace versus org-wide installation from Slack auth.test, preserves bot and user identity, and recovers cleanly after temporary identity lookup failures.
Configuration Removes enterpriseOrgInstall from the Slack schema, types, UI hints, generated metadata, and docs; openclaw doctor --fix removes the retired root or account key.
Direct messages and pairing Supports disabled, open, allowlist, and workspace-qualified pairing. Pending pairing identities are qualified by workspace while retaining the raw Slack user ID for display and notification.
Routing and policies Partitions sessions, history, caches, replies, static bindings, and policy targets by Slack workspace. Supports match.teamId and workspace-qualified channel and user peers.
Actions and delivery Uses the validated listener workspace for scoped actions and delivery. Detached, queued, scheduled, and proactive operations require a workspace-qualified target unless the installation is positively identified as workspace-scoped. Unknown and degraded identity states fail closed.
Events and interactions Carries validated workspace scope through messages, mentions, memberships, reactions, pins, channel lifecycle events, Block Kit actions, modals, shortcuts, slash commands, and pairing-code replies.
Presence Polls and publishes presence through workspace-scoped clients, targets, state, cooldowns, and wake contexts.

Safety Boundaries

  • Detached Enterprise operations require team:<team-id>:channel:<channel-id> or team:<team-id>:user:<user-id> targets.
  • Bare detached targets remain blocked while installation identity is Enterprise, degraded, or unknown; a positively detected workspace installation may use bare targets.
  • Relay mode, channel-ID-change events, App Home, Agent and Assistant lifecycle events, configured ACP bindings, and runtime current-conversation bindings remain unavailable for org-wide installations.
  • Mutable name matching remains unavailable for Enterprise policies; stable Slack IDs are required.

Evidence

  • Focused regression coverage exercises runtime identity detection and recovery, workspace-qualified routing and policies, detached-target admission, actions, DM authorization and pairing, pairing-code delivery, events, and presence isolation.
  • Formatting and syntax checks passed for the follow-up Slack cleanup.
  • Read-only Slack auth.test verification confirmed an org-wide credential returns Enterprise, bot, and user identity without publishing identifier values.
  • No Slack messages were sent during verification.

AI-assisted: Codex implemented and reviewed this change. I understand the behavior and changes in this PR.

@clawsweeper

clawsweeper Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: slack Channel integration: slack gateway Gateway runtime cli CLI command changes size: XL maintainer Maintainer-authored PR labels Aug 10, 2026
@sjf-oa
sjf-oa force-pushed the sjf/remove-slack-enterprise-setting branch from fd17443 to 9cceab3 Compare August 10, 2026 03:45
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 10, 2026
@clawsweeper

clawsweeper Bot commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 10, 2026, 2:56 AM ET / 06:56 UTC.

ClawSweeper review

What this changes

This PR replaces Slack’s manual Enterprise Grid setting with runtime identity detection and carries workspace scope through Slack routing, delivery, pairing, actions, approvals, and presence.

Merge readiness

⚠️ Ready for maintainer review - 4 items remain

Keep open for maintainer review. The current head appears to address the prior standalone-send blocker, but its real Slack proof covers an earlier head and exact-head source hydration was unavailable locally; the maintainer label also requires human handling.

Priority: P1
Reviewed head: 157bbb24899e5c1941a04bf250ea97ec0cb23904
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The PR has substantial implementation and earlier live evidence, but final-head proof and complete source inspection are still missing.
Proof confidence 🦐 gold shrimp (3/6) Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
Evidence reviewed 6 items Current behavior requires a manual Enterprise setting: Current main admits or rejects detached Slack sends from enterpriseOrgInstall and target team scope, so replacing this policy changes both upgrade and delivery behavior.
Prior standalone-send finding appears addressed: The supplied current-head patch adds detached-target admission whose comment distinguishes absent monitor state from detected degraded or Enterprise identity; this directly addresses the prior review’s bare standalone workspace-send blocker.
Pairing is a cross-boundary change: Current main passes only an opaque pairing ID through the core adapter and gateway handler; the proposed metadata propagation is therefore needed to preserve Slack workspace-qualified pairing identity.
Findings None None.
Security None None.

How this fits together

The bundled Slack plugin turns Slack events and detached sends into OpenClaw agent runs and outbound messages. This change records authenticated installation identity and uses workspace scope to avoid treating Enterprise Grid IDs as globally unique.

flowchart LR
A[Slack auth and events] --> B[Installation identity]
B --> C[Workspace scope]
C --> D[Routing and policy]
C --> E[Delivery and actions]
D --> F[Agent runs]
E --> G[Slack messages]
Loading

Decision needed

Question Recommendation
Should OpenClaw adopt this broad expansion of the bundled Slack Enterprise Grid contract after current-head proof and upgrade validation, or keep the narrower shipped capability? Require current-head proof and land the expanded contract: Recommended: verify fresh and upgraded configurations plus the three detached-target identity states on the exact head, then review the broadened Enterprise support as one product change.

Why: The PR intentionally expands supported Enterprise events, actions, pairing, approvals, and presence while retiring a documented configuration mode; that compatibility and product-scope choice needs maintainer intent.

Before merge

  • Resolve merge risk (P1) - Existing Slack configurations containing enterpriseOrgInstall will become schema-invalid until Doctor removes it; the migration needs exact-head upgrade proof.
  • Resolve merge risk (P1) - Detected Enterprise or degraded identity must reject bare detached targets while absent monitor identity must permit ordinary standalone workspace sends; an error in that three-state boundary can block delivery or mis-scope it.
  • Resolve merge risk (P1) - The available live Slack proof predates the final head, and incomplete CI plus unavailable PR blobs prevent treating the current broad patch as fully verified.
Agent review details

Security

None.

PR surface

Source +343, Tests +698, Docs +8, Generated 0. Total +1049 across 69 files.

View PR surface stats
Area Files Added Removed Net
Source 38 1017 674 +343
Tests 27 1241 543 +698
Docs 2 61 53 +8
Config 0 0 0 0
Generated 2 120 120 0
Other 0 0 0 0
Total 69 2439 1390 +1049

Review metrics

Metric Value Why it matters
Production versus test delta production +1,017/-674; tests +1,241/-543; docs/generated +181/-173 The substantial production expansion is justified only if maintainers accept the wider Enterprise Grid contract and its full upgrade and delivery proof.
Retired configuration surface 1 Slack installation-mode key removed, with root and per-account Doctor migration Existing Enterprise Grid configurations need a verified repair path before the schema rejection becomes safe.

Stored data model

Persistent data-model change detected: migration/backfill/repair: extensions/slack/src/doctor-contract.test.ts, migration/backfill/repair: extensions/slack/src/doctor-contract.ts, serialized state: extensions/slack/src/monitor/agent-view-state.ts, serialized state: extensions/slack/src/monitor/presence-monitor.ts, unknown-data-model-change: extensions/slack/src/doctor-contract.ts, unknown-data-model-change: src/config/bundled-channel-config-metadata.generated.ts, and 1 more. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Prove the migration and identity states (recommended)
    Run exact-head upgrade and real Slack checks for retired-config repair, workspace standalone sends, degraded identity rejection, and Enterprise qualified delivery before merge.
  2. Pause the expansion
    Defer the broad Enterprise feature expansion if maintainers do not want to take its new delivery and policy contract in this release window.

Technical review

Best possible solution:

Keep installation identity owned by the Slack plugin, retain Doctor migration for the retired setting, and obtain current-head proof for Enterprise delivery, degraded failure, and standalone workspace sends before landing.

Do we have a high-confidence way to reproduce the issue?

Not applicable as a feature PR; the contributor supplied credible Slack behavior evidence for a preceding head, but not for the final head.

Is this the best way to solve the issue?

Unclear: runtime-owned Slack identity is the right apparent owner boundary, but the exact-head code and its upgrade behavior could not be completely inspected from this partial checkout.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 6b365fa5d3c9.

Labels

Label changes:

  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P1: This broadens Slack routing and delivery behavior for existing channel operators and can block normal sends if identity admission is wrong.
  • merge-risk: 🚨 compatibility: The PR removes the documented enterpriseOrgInstall setting and relies on Doctor to migrate existing root and account configuration.
  • merge-risk: 🚨 message-delivery: Workspace identity controls whether Slack detached sends, replies, pairing notifications, and actions are admitted and correctly targeted.
  • merge-risk: 🚨 security-boundary: Enterprise Grid workspace qualification is the boundary preventing ambiguous cross-workspace user, channel, approval, and action operations.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.

Evidence

What I checked:

  • Current behavior requires a manual Enterprise setting: Current main admits or rejects detached Slack sends from enterpriseOrgInstall and target team scope, so replacing this policy changes both upgrade and delivery behavior. (extensions/slack/src/direct-send-admission.ts:4, bb02fc53ea8f)
  • Prior standalone-send finding appears addressed: The supplied current-head patch adds detached-target admission whose comment distinguishes absent monitor state from detected degraded or Enterprise identity; this directly addresses the prior review’s bare standalone workspace-send blocker. (extensions/slack/src/detached-target-admission.ts:1, 157bbb24899e)
  • Pairing is a cross-boundary change: Current main passes only an opaque pairing ID through the core adapter and gateway handler; the proposed metadata propagation is therefore needed to preserve Slack workspace-qualified pairing identity. (src/channels/plugins/pairing.ts:32, bb02fc53ea8f)
  • Feature provenance: Enterprise Grid support appears to originate in the original feature commit, which introduced the current documented configuration model. Public docs: docs/channels/slack.md. (docs/channels/slack.md:260, 245b91b83de0)
  • Current-head proof gap: The contributor’s Slack evidence explicitly says it was captured on the immediately preceding head and reused a cached image after the PR moved; it is not after-fix proof for 157bbb2. (157bbb24899e)
  • Local PR-source limitation: The checkout is a partial clone missing required PR blobs; attempting the exact-head diff triggered a promisor fetch, but DNS could not resolve github.com. Current-main source and supplied patch context were inspected, but an independent complete exact-head read was not possible.

Likely related people:

  • kevinlin-openai: Authored the original Enterprise Grid feature commit that current docs and the existing configuration model trace back to. (role: introduced the existing Enterprise Grid surface; confidence: high; commits: 245b91b83de0; files: extensions/slack/src/direct-send-admission.ts, docs/channels/slack.md)
  • Vyctor H. Brzezowski: Current-main blame attributes the existing Enterprise configuration, detached-send admission, and pairing boundary lines to this recent commit. (role: recent current-main contributor on the affected Slack and pairing paths; confidence: medium; commits: bb02fc53ea8f; files: extensions/slack/src/channel.ts, extensions/slack/src/direct-send-admission.ts, src/channels/plugins/pairing.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Capture a redacted exact-head Slack or terminal run covering standalone workspace send, degraded identity rejection, and qualified Enterprise delivery.
  • Show Doctor repairing a configuration containing the retired root and account enterpriseOrgInstall keys.
  • Wait for the exact-head required checks to complete, then request human product-scope review.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-08-10T03:51:11.621Z sha 9cceab34379f188a95212d8e264b34a9ad037a8a :: found issues before merge. :: [P1] Fail closed while Enterprise identity is degraded
  • reviewed 2026-08-10T06:49:05.910Z sha c897423 :: found issues before merge. :: [P1] Allow bare targets when no monitor identity exists

@sjf-oa
sjf-oa force-pushed the sjf/remove-slack-enterprise-setting branch from 9cceab3 to fcd7211 Compare August 10, 2026 04:08
@sjf-oa

sjf-oa commented Aug 10, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Proof is pending.

@clawsweeper

clawsweeper Bot commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@sjf-oa
sjf-oa enabled auto-merge (squash) August 10, 2026 05:45
@sjf-oa

sjf-oa commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor Author

Anonymous Grid presence and DM-pairing integration proof

This proof was captured against the immediately preceding head revision of this PR with Codex 0.147.0. The PR moved afterward; the retry reused that cached image rather than rebuilding the current head.

Runtime checks:

  • packaged and running app-server both reported codex-cli 0.147.0
  • native linux/arm64 runtime
  • gateway health was live and Slack Socket Mode was connected
  • only one Socket Mode consumer was active for each installation
  • presence changes were performed through the real Slack UI
Test Installation Result Anonymous evidence
PRES-1 Enterprise Grid PASS The test user changed active -> away -> active; one explicit-account heartbeat ran, one cooldown was stored, and one visible wake DM arrived.
PRES-2 Enterprise Grid PASS Later polling produced no second heartbeat, cooldown, or wake DM.
PRES-3 Enterprise Grid PASS With presenceEvents.mode: off, the same transition produced no heartbeat, cooldown, or wake DM.
PAIR-1 Enterprise Grid PASS The pairing-code DM arrived, the CLI listed and approved it, access persisted, and the post-approval DM reached the agent normally. Requester notification was not requested because the command omitted the opt-in --notify flag.
PAIR-2 Enterprise Grid PASS A made-up code was rejected and the real request remained pending.
PAIR-3 Enterprise Grid PASS A repeated DM retained one usable pending request; its listed code still approved successfully.
PRES-1 Non-Enterprise PASS A fresh-state retry produced exactly one heartbeat, one cooldown, and one visible wake DM 47 seconds after the transition. The baseline agent reply also succeeded.
PRES-2 Non-Enterprise PASS Later polling produced no second heartbeat, cooldown, or duplicate wake.
PRES-3 Non-Enterprise PASS Starting from clean state with presence disabled, the transition produced zero heartbeats, cooldowns, and wake DMs.
PAIR-1 Non-Enterprise PASS The pairing-code DM arrived, the CLI listed and approved it, access persisted, and the post-approval DM reached the agent normally. Requester notification was not requested because the command omitted the opt-in --notify flag.
PAIR-2 Non-Enterprise PASS A made-up code was rejected and the real request remained pending.
PAIR-3 Non-Enterprise PASS A repeated DM retained one non-conflicting pending request; its listed code still approved successfully.

Summary for that revision: 12 passed, 0 failed.

No workspace, organization, team, channel, app, bot, user, message, thread, run, host, private-link, pairing-code, commit, or internal-PR identifiers are included in this proof.

@sjf-oa
sjf-oa force-pushed the sjf/remove-slack-enterprise-setting branch from 9c8a8f9 to dd32f7a Compare August 10, 2026 05:55
@sjf-oa
sjf-oa enabled auto-merge (squash) August 10, 2026 05:57
sjf-oa pushed a commit that referenced this pull request Aug 10, 2026
@clawsweeper clawsweeper Bot added status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 10, 2026
…rprise-setting

# Conflicts:
#	docs/.generated/plugin-sdk-api-baseline.sha256
@sjf-oa
sjf-oa merged commit a968d15 into main Aug 10, 2026
122 checks passed
@sjf-oa
sjf-oa deleted the sjf/remove-slack-enterprise-setting branch August 10, 2026 07:10
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 11, 2026
…approvals, and presence (openclaw#121373)

* refactor(slack): detect Enterprise Grid installs at runtime

* fix(slack): preserve enterprise bot identity

* style(slack): format enterprise identity test

* fix(slack): scope enterprise config by workspace

* fix(slack): preserve qualified binding casing

* feat(slack): enable enterprise presence polling

* fix(slack): normalize enterprise binding accounts

* fix(slack): require workspace-scoped Grid targets

* docs(slack): document Enterprise policy target forms

* fix(slack): preserve Grid pairing workspace scope

* refactor(slack): simplify scoped target formatting

* fix(slack): repair Enterprise Grid CI checks

* chore: refresh generated Slack metadata

* refactor(slack): simplify optional workspace scope

* test(slack): infer installation state handle types

* chore: resolve plugin SDK baseline conflict

* fix(ci): regenerate plugin SDK API baseline on Linux

* fix(slack): allow standalone workspace sends

---------

Co-authored-by: Sarah Fortune <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: slack Channel integration: slack cli CLI command changes docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants