Skip to content

Fail loudly when delivery feedback cannot reach the session - #2004

Merged
Aaronontheweb merged 1 commit into
devfrom
refactor/delivery-failure-drift
Aug 19, 2026
Merged

Fail loudly when delivery feedback cannot reach the session#2004
Aaronontheweb merged 1 commit into
devfrom
refactor/delivery-failure-drift

Conversation

@Aaronontheweb

@Aaronontheweb Aaronontheweb commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

What

Phase 3 of the code-reduction stack (on top of #2002). Fixes a confirmed behavioral drift between channel binding actors, found while diffing the triplicated code for this refactor series.

The drift: NotifyDeliveryFailedAsync sends DeliveryFailed feedback to the session when a transport post fails. If that feedback send itself throws:

  • Slack logs and rethrows — the exception escapes the CommandAsync handler, supervision restarts the actor, and recovery re-creates the pipeline (the comment documents this intent).
  • Discord and Mattermost logged and swallowed — the session never learns the turn failed and waits forever on a delivery report that will never arrive. A zombie session, and a violation of the repo's no-silent-fallbacks rule.

The fix: align Discord and Mattermost with Slack's log-and-rethrow. Blast radius is narrow — the rethrow fires only when the session feedback pipe is already dead. An ordinary transport failure (a post that fails) still takes the normal notify-and-return path.

Test

New cross-channel contract test Feedback_send_failure_faults_the_actor in SessionBindingContractTests, which runs against all three channels:

  • Drives a transport post failure into a feedback-pipe failure (RecordingSessionPipeline.FeedbackException, new test hook)
  • Asserts the supervised restart via a second pipeline CreateAsync call (new CreateCount counter)
  • Before the fix: Slack passed, Discord and Mattermost failed. After: all three pass.

Verification

  • Full Netclaw.Actors.Tests: 3,442 passed, 0 failed, 1 skipped (pre-existing Windows-only skip)
  • dotnet slopwatch analyze: 0 issues; header verification passes

Stack

PR 3 of 4. Base: refactor/channel-warmups (#2002). Next: binding-actor consolidation (gap-hydration engine + approval flow).

@Aaronontheweb
Aaronontheweb force-pushed the refactor/delivery-failure-drift branch from 825233e to 2f48c30 Compare August 19, 2026 02:08
@Aaronontheweb
Aaronontheweb marked this pull request as ready for review August 19, 2026 02:09
@Aaronontheweb Aaronontheweb added bug Something isn't working reliability Retries, resilience, graceful degradation labels Aug 19, 2026
@Aaronontheweb
Aaronontheweb force-pushed the refactor/delivery-failure-drift branch from 2f48c30 to 918cd9d Compare August 19, 2026 02:51
@Aaronontheweb
Aaronontheweb force-pushed the refactor/delivery-failure-drift branch from 918cd9d to 2f48c30 Compare August 19, 2026 03:39
Base automatically changed from refactor/channel-warmups to dev August 19, 2026 12:26
Discord and Mattermost swallowed a SendFeedbackAsync failure inside
NotifyDeliveryFailedAsync. Slack already rethrows to force a supervised
restart and a pipeline reinit. The swallowed path left a zombie session:
the session waited on a delivery report that never arrived.

Align Discord and Mattermost with the Slack behavior. The rethrow fires
only when the feedback pipe itself fails. A normal transport failure
still takes the notify-and-return path.

Add a cross-channel contract test that drives a post failure into a
feedback pipe failure and asserts a supervised restart re-creates the
pipeline. The test passed on Slack and failed on Discord and Mattermost
before the fix.
@Aaronontheweb
Aaronontheweb force-pushed the refactor/delivery-failure-drift branch from 2f48c30 to bac0f84 Compare August 19, 2026 12:26
@Aaronontheweb
Aaronontheweb merged commit 88fe3ad into dev Aug 19, 2026
23 checks passed
@Aaronontheweb
Aaronontheweb deleted the refactor/delivery-failure-drift branch August 19, 2026 16:41
@Aaronontheweb Aaronontheweb added the channels Discord, Slack, and other channels. label Aug 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working channels Discord, Slack, and other channels. reliability Retries, resilience, graceful degradation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant