Repository navigation
fix(gateway): label redelivery after mid-recovery crash - #70700
fangliquanflq wants to merge 5 commits into
Conversation
|
Thanks for the focused recovery-state fix. The premise is confirmed on current The proposed state transition, prior-attempt marker fallback, and pre-send checkpoint directly address that gap. The added tests cover both the existing-row compatibility case and the second-recovery marker behavior. The patch adds no tool, configuration, cache, or message-alternation surface. Automated hermes-sweeper review. |
Claiming a pending obligation now stamps attempting and treats prior attempts as needing the recovered marker, so a crash mid-redelivery cannot silently duplicate a platform-ACK'd send.
57eb6a3 to
544c7b9
Compare
…ecovery-marker # Conflicts: # contributors/emails/fangliquan@qq.com # tests/gateway/test_delivery_ledger.py
What does this PR do?
Fixes honest at-least-once labeling for delivery-ledger recovery: after a pending obligation is claimed and the gateway crashes mid-send, the next reclaim now carries
RECOVERED_MARKERinstead of silently resending.Bug Cause
sweep_recoverableclaimed dead-owner rows by restamping owner/attemptsbut leftstate='pending', andneeds_markerwas onlystate != "pending"._redeliver_pending_obligationsalso never calledmark_attemptingbeforeadapter.send. A crash after the first recovery send could therefore reclaim the same row again withneeds_marker=False.Reproduction Steps
pendingdelivery obligation instate.db.sweep_recoverableclaims it and startsadapter.sendwithout the recovered marker.mark_delivered.Expected: second redelivery is prefixed with
RECOVERED_MARKER.Before fix: second redelivery is plain text (
needs_marker=False, state stillpending).Fix
UPDATEsetsstate='attempting'.needs_markeris true whenstate != "pending"or pre-claimattempts >= 1(covers stuck pre-fix rows).mark_attemptingimmediately beforeadapter.send.Related Issue
No issue
Type of Change
Changes Made
gateway/delivery_ledger.py- claim transitions toattempting;needs_markerhonors prior attemptsgateway/run.py- callmark_attemptingbefore recoveryadapter.sendtests/gateway/test_delivery_ledger.py- reclaim / stuck-pending / second-boot marker coverageHow to Test
needs_marker=True.Checklist
Code
scripts/run_tests.shon relevant tests and they passDocumentation & Housekeeping
cli-config.yaml.exampleif I added/changed config keys - or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows - or N/A