Repository navigation
feat(discord): proactive claim lifecycle on the outbox ClaimBackend (5b fence) - #3122
Merged
qingyun-wu merged 1 commit intoAug 18, 2026
Merged
Conversation
…5b fence) The proactive leg's private .sending machinery becomes a fence pairing each file move with a durable backend record: claim/confirm/release/fail/recover in src/proactive_claim_fence.py, driven on the ClaimBackend contract (Design A today; Design C slots in when #3104 lands). File renames stay — they are how peer bridges' *.txt globs stop seeing a claimed file. What the backend replaces: the in-memory transient attempt counter (attempt counts now survive restarts — a real defect: a crash-looping bridge could retry a transient failure forever) and pid-scoped orphan recovery (incarnation-based recover() is strictly stronger post pid-reuse). decide_failed_send is extracted as the single failure-decision owner; resolve_failed_send (legacy executors) and the fence both consult it. Vendored ag2_sparrow copy of send_failure_policy synced verbatim. Delegation pins updated one hop (send-failure-delegation, claim-release, foreign-target, dm-failure-preserves-file, progress-flag, recovery); sending-suffix guard extended to see method claim sites, mutation-tested red-without-gate. 119-suite discord/telegram/slack/proactive sweep green. Signed: @sutando-qingyun-001:ag2.space Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Collaborator
Author
|
For the record: this was accidentally squash-merged into the PARENT branch ( |
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.
What
5b of the owner's execution order: the discord bridge's proactive leg migrates its private
.sendingclaim machinery onto the outboxClaimBackendseam. Newsrc/proactive_claim_fence.pypairs every file move with a durable backend record — claim / confirm / release / fail / recover — constructed on the contract (Design A today;DesignCClaimBackendslots in with a one-line constructor change when #3104 lands).What stays: the file renames. They are the inter-bridge visibility mechanism (a claimed file leaves every
*.txtglob peers poll) — backend records can't provide that. Quarantine remains byte-preserving; presenter-mode and routing/destination gates run before claim exactly as before.What the backend replaces (both real defects, not refactor gloss):
_transient_send_attempts— in-memory, so attempt counts were lost on every restart; a crash-looping bridge could retry a "capped" transient failure forever. Attempts are now durable (pinned: the cap parks across simulated restarts)..sendingorphan recovery → incarnation-basedbackend.recover()(strictly stronger post the feat(sparrow): DesignCClaimBackend — namespace-as-state claiming behind the ClaimBackend seam #3104 pid-reuse fix). The file sweep stays for crash-between-move-and-record gaps.Decision/executor split preserved:
decide_failed_sendextracted as the single failure-decision owner insend_failure_policy; the legacyresolve_failed_sendexecutor and the fence both consult it. Vendoredag2_sparrowcopy synced verbatim (delegation test green).Evidence
tests/proactive-claim-fence.test.py: 13 checks on a REAL backend — file semantics, durable attempts (cap enforced across fence restarts), partial-delivery parks (never re-sends confirmed chunks), permanent parks first-time, crash recovery, mtime-scoped fresh cycles.sending-suffix-is-proactive-onlyguard extended to see method claim sites (helper-function claims resolved via enclosing-function scan; loop and delegating-caller resolution untouched). Mutation-tested: removing the fence's family gate turns the guard red (5/6), restoring it green (6/6).scripts/review-checks.shPASS on the staged diff.Stacking
Parent: #3095 (
feat/discord-delivery-provider) — merge order #3092 → #3094 → #3095 → this. Will rebase over #3113 when it lands (both touchpoll_proactive; this PR's claim sites sit below #3113's destination gate, conflict expected trivial). Live round trip owed at the post-merge bridge restart, alongside the #3110/#3113 round trips already queued for that restart.Signed: @sutando-qingyun-001:ag2.space
🤖 Generated with Claude Code