openclaw/extensions/slack
Alix-007 5a36317384
fix(slack): report failed terminal session status updates (#145778)
Related: #142772. This fixes terminal API-failure diagnostics, not Slack Desktop's working-indicator behavior.

## What Problem This Solves

Fixes silent Slack session-status cleanup failures when Slack accepts `processing` but rejects the terminal `active` update.

## User Impact

Operators receive one normal-level diagnostic and can enable verbose logging for the underlying Slack API failure. Rejected or unsupported processing writes do not produce this new diagnostic. Status requests, cleanup ordering and retry behavior are unchanged; typing reactions are still removed. No configuration or migration is required.

An accepted status request is not proof that Slack Desktop has refreshed its UI, so the broader issue remains open.

## Why This Change Was Made

Preserve API acceptance through the existing monitor context and consume it in the existing dispatch cleanup owner. A successful write remains successful when another agent keeps Slack's aggregate status at `processing`, or when a subsequent title rename fails. The diagnostic contains no token, channel/thread identifiers, title or raw API error.

The integration preserves current main's inferred context type rather than restoring its retired type file, and updates the existing delivery-trace fixture to the same acceptance contract. Unnecessary helper logging and wording-pinned test assertions were removed.

## Evidence

Actual before/after proof ran on Linux arm64 / Node 24.19.0 through the supported Gateway CLI, the registered **signed Slack HTTP webhook**, real agent dispatch and typing callbacks, and the installed Slack WebClient against a loopback API. Only external Slack/model endpoints were fixtures; the monitor, dispatch, context, SDK response handling and normal file logger were real.

| Scenario | Baseline diagnostics | Candidate diagnostics |
| --- | ---: | ---: |
| Processing accepted, active rejected | **0** | **1** |
| Both writes accepted | 0 | 0 |
| Processing rejected | 0 | 0 |
| Active accepted, aggregate still processing | 0 | 0 |

Every scenario delivered the scripted final reply, wrote `processing` then `active` exactly once, and completed typing-reaction cleanup. Each isolated Gateway was stopped before reading its log. The baseline failed the required diagnostic assertion; the candidate passed the same driver.

Observed normal-level error:

```text
Slack session status could not return to active after processing. Enable verbose logging to inspect the Slack API failure.
```

- Baseline: `7a932d9794`; the affected owners were unchanged on subsequently checked main `2e053112b6`.
- Candidate: `947b7bd6622af803009bf9ce31b772ec6b2777e1`; committed production hashes match the observed runtime.
- Regression on unmodified baseline: **4 expected failures and 5 passing controls**. The candidate also covers no thread, repeated cleanup, quiet accepted/aggregate-status controls, privacy, failed title rename, and cleanup when the logger throws.
- **501 focused tests passed across seven files**: 471 Slack tests and 30 shared typing lifecycle tests. The nine diagnostic cases and real Gateway flow were rerun after final message-guidance cleanup. Media fixtures used deterministic DNS inside the network-isolated container; no media or network-policy source was changed.
- Targeted type-aware Oxlint, Oxfmt, counted-line growth check and `git diff --check` passed. Full static/matrix validation remains hosted.

```bash
node scripts/run-vitest.mjs \
  extensions/slack/src/monitor/message-handler/dispatch.status-diagnostics.test.ts \
  extensions/slack/src/monitor/context.test.ts \
  extensions/slack/src/monitor/message-handler/dispatch.preview-fallback.test.ts \
  extensions/slack/src/monitor/message-handler/prepare.test.ts \
  extensions/slack/src/monitor/events/agent.test.ts \
  extensions/slack/src/delivery-trace.test.ts \
  src/channels/typing.test.ts
```

No live Slack workspace or Desktop rendering was exercised, and no retry, status reordering, dependency, schema or permission change is included.

Co-authored-by: Ayaan Zaidi <hi@obviy.us>
2026-09-19 14:12:19 +05:30
..
assets feat: give every plugin a compact chat activity icon (#147333) 2026-09-13 13:49:51 -07:00
scripts
skills
src fix(slack): report failed terminal session status updates (#145778) 2026-09-19 14:12:19 +05:30
account-inspect-api.ts
api.ts
channel-config-api.ts
channel-entry.ts refactor: simplify runtime adapters and remove obsolete code (#152277) 2026-09-18 19:35:45 -07:00
channel-plugin-api.ts
config-api.ts
config-doctor-api.ts
configured-state.ts
contract-api.ts
directory-contract-api.ts
doctor-contract-api.ts
http-routes-api.ts
index.test.ts
index.ts
message-tool-api.ts
openclaw.plugin.json feat(plugins): define package-owned categories (#142710) 2026-09-09 19:05:40 -07:00
package.json chore(release): close out 2026.9.5 on main (#151823) 2026-09-19 01:37:16 -07:00
README.md
runtime-api.ts
runtime-setter-api.ts
secret-contract-api.ts
security-contract-api.ts
setup-entry.ts refactor: simplify runtime adapters and remove obsolete code (#152277) 2026-09-18 19:35:45 -07:00
setup-plugin-api.ts
test-api.test.ts
test-api.ts
tsconfig.json

OpenClaw Slack

Official OpenClaw channel plugin for Slack channels, DMs, commands, and app events.

Install from OpenClaw:

openclaw plugins install @openclaw/slack

Configure the Slack app credentials and allowed workspaces/channels in OpenClaw. The plugin lets agents receive Slack events and reply through the configured Slack app.