Skip to content

Conversation

@suchapalaver
Copy link
Collaborator

@suchapalaver suchapalaver commented Dec 2, 2025

Adds periodic allocation reconciliation to the TAP agent to ensure reliable RAV finalization after network subgraph connectivity issues.

Previously, the allocation watcher was purely event-driven--if allocations closed during a connectivity outage and the list became static afterward, stale SenderAllocation actors would keep running indefinitely, never triggering mark_rav_last() for redemption.

This change introduces a configurable background task (default: 5 minutes) that periodically forces a re-check of all allocations against the current watcher state, ensuring closed allocations are detected and RAVs are properly marked as 'last' even after missed closure events.

Includes config validation (error if interval is 0, warning if < 60s), comprehensive test coverage, and observability improvements with a new tap_allocation_reconciliation_runs_total Prometheus counter and info-level logging.


Signed off by Joseph Livesey joseph@semiotic.ai

   Add a background task that periodically triggers allocation
   reconciliation to ensure recovery after subgraph connectivity issues.

   Previously, the allocation watcher was purely event-driven
   and only fired when the allocation list changed. If allocations were
   closed during a connectivity outage and the list became static afterward,
   no messages would fire and stale SenderAllocation actors would keep
   running, never triggering mark_rav_last().

   This change adds:
   - New config option
    (default: 5 min)
   - ReconcileAllocations message type for SenderAccount
   - Periodic task that sends ReconcileAllocations every
   interval
   - Handler that forces re-check of all allocations against
   the watcher

   This ensures closed allocations are detected and RAVs are
   properly marked
   as 'last' for redemption, even after connectivity issues.
@suchapalaver suchapalaver marked this pull request as ready for review December 2, 2025 02:54
@github-actions
Copy link
Contributor

github-actions bot commented Dec 2, 2025

Pull Request Test Coverage Report for Build 19845165736

Details

  • 130 of 150 (86.67%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.2%) to 63.232%

Changes Missing Coverage Covered Lines Changed/Added Lines %
crates/config/src/config.rs 6 13 46.15%
crates/tap-agent/src/agent/sender_account.rs 111 124 89.52%
Totals Coverage Status
Change from base Build 19238892062: 0.2%
Covered Lines: 9476
Relevant Lines: 14986

💛 - Coveralls

neithanmo
neithanmo previously approved these changes Dec 2, 2025
Copy link
Collaborator

@neithanmo neithanmo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is nice!
It is safe to have an extra check

   - Add unit test for ReconcileAllocations message handling that verifies
     it triggers UpdateAllocationIds with current allocations from watcher
   - Add config validation for allocation_reconciliation_interval_secs:
     error if 0, warn if < 60s
   - Add test for periodic task lifecycle verifying task spawn/abort
   - Update create_sender_account() test helper to expose
     indexer_allocations_tx and configurable reconciliation interval
   - Add tokio test-util feature for time control in tests
…ciliation

   - Add ALLOCATION_RECONCILIATION_RUNS counter metric
   - Elevate reconciliation logs from debug to info
   - Enhance config documentation explaining the connectivity failure
   scenario
@suchapalaver suchapalaver force-pushed the suchapalaver/fix/allocation-reconciliation branch from 7a82a10 to 7983f8f Compare December 2, 2025 15:33
@suchapalaver suchapalaver enabled auto-merge (squash) December 2, 2025 21:22
@suchapalaver suchapalaver merged commit f8f8522 into main Dec 2, 2025
12 checks passed
@suchapalaver suchapalaver deleted the suchapalaver/fix/allocation-reconciliation branch December 2, 2025 22:02
@github-actions github-actions bot mentioned this pull request Dec 2, 2025
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.

3 participants