Skip to content

fix(slack): preserve accepted reply parts after later delivery failures - #127130

Merged
steipete merged 1 commit into
mainfrom
codex/autoqa-181-slack-partial
Aug 21, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/autoqa-181-slack-partial

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Closes #127120

Additional instructions

MUST: Keep Allow edits from maintainers enabled for this PR so maintainers
can help update the branch when needed.

What Problem This Solves

Fixes an issue where Slack users could receive duplicate replies or attachments when an ordinary multipart reply successfully delivered an earlier attachment or text chunk but a later part failed before its own dispatch. The later operation's no-dispatch error previously made the entire logical reply look safely replayable even though Slack had already accepted visible content.

Why This Change Was Made

The existing Slack transport already reports every accepted physical upload, chunk, or Block Kit fallback part through its delivery callback. The ordinary Slack reply owner now collects those accepted results separately for each logical reply and, only when a later operation fails, wraps the original error in the existing channel partial-delivery contract with an ordered aggregate receipt. Existing successful results, first-send failures, terminal hook ownership, dispatcher behavior, retry policy, plugin boundaries, and public SDK contracts remain unchanged.

Production delta is +53/-37 (net +16): most changed lines simply move the existing sender into its logical-reply scope. The remaining growth is the unavoidable ownership boundary for retaining accepted physical-send receipts before the overall send settles; replacing the successful aggregate result with the final callback result would silently discard earlier successful receipt parts.

User Impact

Slack replies and attachments already accepted by the provider are no longer misclassified as wholly undelivered after a later multipart failure, preventing duplicate fallback/replay. Genuinely undispatched first attempts retain their original error and remain eligible for the existing recovery behavior.

Evidence

Before the fix, the focused regression failed in all three relevant places: an accepted attachment lost its receipt, an accepted internal chunk lost its receipt, and the real reply dispatcher propagated the later no-dispatch error as safely replayable.

After the fix:

  • node scripts/run-vitest.mjs extensions/slack/src/monitor/replies.test.ts: 51 passed, including first-attachment success followed by a real provider-shaped no-dispatch failure, original-cause identity, ordered receipts, single failure hook, internal chunk acceptance, unchanged successful multipart result/hook, unchanged first-send failure, and strict per-logical-reply isolation.
  • The boundary regression drives the actual Slack send transport through a fake Slack Web API: two ordered chunks are accepted, the third fails, the aggregate receipt retains both provider IDs, the real public-SDK reply dispatcher records failedAfterSend: 1, failedBeforeSend: 0, and anyVisibleDelivered: true, the error callback fires once, and retry propagation does not occur.
  • node scripts/run-vitest.mjs extensions/slack: 135 files / 2,428 tests passed across the complete Slack plugin lane.
  • node scripts/run-vitest.mjs src/auto-reply/reply/before-deliver.test.ts src/channels/turn/delivery-result.test.ts extensions/matrix/src/matrix/monitor/replies.test.ts extensions/discord/src/monitor/reply-delivery.test.ts extensions/mattermost/src/mattermost/reply-delivery.test.ts extensions/msteams/src/reply-dispatcher.test.ts extensions/telegram/src/chunk-delivery.test.ts extensions/whatsapp/src/auto-reply/deliver-reply.test.ts: eight focused dispatcher, receipt, and sibling-channel shards passed. The unchanged dispatcher fallback regression proves that attached fallback runs only after a proven invisible failure and does not run after a visible post-send failure.
  • node scripts/check-changed.mjs -- extensions/slack/src/monitor/replies.ts extensions/slack/src/monitor/replies.test.ts: passed formatting, production/test TypeScript, strict lint, plugin-boundary checks, import-cycle checks, and all changed-file guards.
  • git diff --check: clean. Independent structured autoreview: clean, no actionable findings.

Live Slack proof is intentionally unavailable because this repair must not use Slack credentials, services, real API calls, or operator state. The existing mock-Gateway harness exercises qa-channel, not the Slack owner; the existing Slack QA adapter requires two live Slack credential leases and real identity calls. The actual owner + actual Slack transport + fake provider API + actual dispatcher boundary above is therefore the strongest authorized changed-path proof.

AI-assisted; no changelog, dependency, core, SDK, configuration, persistence, security, authentication, product, retry-policy, protocol, or public-contract changes.

@openclaw-barnacle openclaw-barnacle Bot added channel: slack Channel integration: slack size: M maintainer Maintainer-authored PR labels Aug 21, 2026
@steipete
steipete marked this pull request as ready for review August 21, 2026 09:18
@clawsweeper

clawsweeper Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready verification for exact head e3b2bb0d64fc2d4b5916f194c56bfc7790f639a9:

  • node scripts/run-vitest.mjs extensions/slack/src/monitor/replies.test.ts: 51 tests passed, including the production Slack transport + fake provider + real dispatcher partial-delivery boundary.
  • node scripts/run-vitest.mjs extensions/slack: 135 files / 2,428 tests passed.
  • Eight focused dispatcher and Matrix/Discord/Mattermost/Teams/Telegram/WhatsApp sibling shards passed.
  • node scripts/check-changed.mjs -- extensions/slack/src/monitor/replies.ts extensions/slack/src/monitor/replies.test.ts: full changed gate passed; formatting and git diff --check passed.
  • Exact-head CI completed successfully: https://github.com/openclaw/openclaw/actions/runs/32467273614
  • Native OPENCLAW_TESTBOX=1 scripts/pr prepare-run 127130 passed hosted CI/Testbox gates in hosted_exact_or_recent_parent mode with exact verified head; no rebase or head change.
  • Fresh structured autoreview and independent adversarial exact-head review: no actionable findings.
  • Exact-head ClawSweeper review completed successfully: https://github.com/openclaw/clawsweeper/actions/runs/32467403537. Its generated review reports the patch correct, zero findings, zero risks, and no rank-up moves; its independent terminal proof reran the focused suite and confirmed all 51 tests passed. The public review publisher is queued, so the completed artifact was verified directly.
  • Production delta is +53/-37, net +16 lines; regression tests are +179/-17.

Live Slack credentials and real Slack calls are intentionally prohibited. The generic mock Gateway does not load the Slack plugin, so the real Slack owner + transport callback + fake Slack API + production dispatcher test is the strongest authorized changed-boundary proof.

@steipete
steipete merged commit f7cbe9e into main Aug 21, 2026
169 checks passed
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

@steipete
steipete deleted the codex/autoqa-181-slack-partial branch August 21, 2026 09:32
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: slack Channel integration: slack maintainer Maintainer-authored PR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Slack multipart replies can replay accepted attachments after a later send fails

1 participant