Skip to content

fix(api): stop uncertain neutral sends spinning as Sending - #525

Merged
setkyar merged 1 commit into
mainfrom
fix/outbound-uncertain-status
Nov 23, 2026
Merged

setkyar merged 1 commit into
mainfrom
fix/outbound-uncertain-status

Conversation

@setkyar

@setkyar setkyar commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Fixes #381.

Problem

A send on the neutral (channel-spine) path can end with an unknown outcome: the provider call failed in a way that may still have delivered it, or the dispatch lease expired. The intent then became uncertain, but its message row was never updated and no realtime update went out. Nothing ever picks up an uncertain intent again, so the message showed "Sending" forever.

Lease recovery also ran only at startup. An intent whose dispatcher died during its lease stayed dispatching until the next restart.

Fix

  • Such a message now gets the same treatment as on the legacy path. It stays pending (it may have been delivered, so it is neither retried nor failed) with metadata.error = send_outcome_unknown, and a realtime fanout tells the browser, which shows the amber "unconfirmed" mark.
  • A message that a delivery receipt has already moved past pending is left alone.
  • Lease recovery now also runs from the poll loop, once per lease period.
  • The message formatter now passes metadata.error to the client, so the amber mark survives a reload.

Tests

  • New channel-outbound-uncertain.integration.test.ts: the message is marked unconfirmed when the provider outcome is uncertain, and when a dispatch lease expires (including after startup, from the poll loop). A message a receipt already moved past pending is not marked.
  • message-formatters.test.ts: the stored error code reaches the client without the internal detail, and a message without an error gets none.
  • Rebased on main. Typecheck, biome and both suites pass on a fresh Postgres 18.

Release

No migration. worker: skip.

When a neutral-path send ended with an unknown outcome - the provider
call failed in a way that may still have delivered it, or the dispatch
lease expired - the intent became uncertain but its message was never
touched and no realtime update went out. Nothing re-claims an uncertain
intent, so the message showed "Sending" for ever.

Mark such a message the way the legacy path does: it stays pending (it
may have been delivered, so it is neither retried nor failed) with
metadata.error = send_outcome_unknown, and a realtime fanout tells the
browser. A message a receipt already moved past pending is left alone.

Lease recovery also ran only at startup, so an intent whose dispatcher
died inside its lease stayed dispatching; it now also runs from the
poll loop once per lease period.

The message formatter now passes metadata.error to the client, so the
amber unconfirmed mark also survives a reload.

Fixes #381
@setkyar
setkyar force-pushed the fix/outbound-uncertain-status branch from aa1b773 to 77ab8e4 Compare November 23, 2026 18:03
@setkyar
setkyar merged commit 3930756 into main Nov 23, 2026
9 checks passed
@setkyar
setkyar deleted the fix/outbound-uncertain-status branch November 23, 2026 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Detail Bug] Outbound messages can remain stuck as "Sending" when delivery outcome is uncertain or dispatch lease expires

1 participant