Repository navigation
Clear draft recovery once every recovered message was sent - #319
Merged
Merged
Conversation
When startup reconciliation found that every recovered draft had already been sent, the composer wrote Recovery.empty(), which has no version. The backend refuses unversioned records with recovery_invalid, so the stale record stayed on disk, the retry ladder ran six times, and the save warning returned on every launch. Write the versioned inactive record that clearComposeRecovery already uses. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
At startup,
reconcileComposeReceipts()asks the outbox whether recovered drafts with apendingSendIdwere delivered. When every one of them wassent,finish()wroteRecovery.empty()tocompose.recoverySave. That object is presentation state and has noversion. The backend (src/compose/mod.rs) refuses records withoutversion: 1withrecovery_invalid.Because
-32000is inunsentRefusals, the retry ladder resent the same payload six times (1, 2, 4, 8, 16, 32 s). The stale record never left disk, so the same failure and the "Draft recovery could not be saved" warning returned on every launch. Receipt acks, which wait for a durable save, were never released.A local diagnostics report showed this as repeated
compose.recoverySave→recovery_invalidbursts, spaced exactly by the retry ladder.Fix
When nothing is left to restore, write
{"version":1,"active":false}, the same recordclearComposeRecovery()already writes.Recovery.empty()stays as UI state. The backend is unchanged: refusing unversioned records is correct.Verification
version === 1andactive === falseassertions to the existingtest_sent_receipt_is_not_restored_and_is_acknowledged_only_after_durable_save. Before the fix it failed withActual: undefined, Expected: 1. After the fix the file passes 99/99.make testandmake validatepass locally.Release Notes
Draft recovery no longer keeps failing to save, or warns on every launch, after a recovered message turns out to have been sent already.
🤖 Generated with Claude Code