Skip to content

fix(send): flag the Sent copy undelivered when deliver fails - #56

Merged
TheGreatAxios merged 4 commits into
mainfrom
cl-9914-undelivered-sent
Oct 5, 2026
Merged

TheGreatAxios merged 4 commits into
mainfrom
cl-9914-undelivered-sent

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Contributor

Closes CL-9914

Problem: POST /me/inbox/send files the Sent copy, then awaits deliver. When deliver throws (e.g. 409 because the recipient run finished) the request fails, but the Sent copy is indistinguishable from a delivered one.

Fix: append-before-deliver is unchanged. On a deliver failure the Sent message gets the existing-column flag $Undelivered (no schema change), an undelivered event is published, the failure is logged, and the original error is rethrown so its HTTP status is preserved. The flag shows in the existing flags of list, read and thread responses. UNDELIVERED_FLAG is exported.

Reproduced: new e2e tests in e2e/mount-send.test.ts failed before the fix (no flag, no event) and pass after.

Gates: bun run check and bun run test:e2e pass.

@TheGreatAxios
TheGreatAxios merged commit da66191 into main Oct 5, 2026
2 checks passed
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.

1 participant