You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Cooperative close: node-as-buyer periodic reconcile of node→node channels #972
Follow-up to #947 (closed). On a cache miss a node pulls from an upstream provider and acts as the client, opening a buyer-side PaymentChannel (crates/incentive/src/buyer_channel.rs, #744). Today it "lets the upstream close & settle — or reclaims its own deposit after expiry." There is no fast path: idle buyer channels lock the node's deposit until expiry.
Scope (node-as-buyer side)
A periodic reconcile task in the node runtime that, for idle/quiescent buyer channels, runs the client-initiated cooperative-close flow (issue for that lands first — this builds on it) to reclaim the deposit immediately instead of waiting for expiry.
Pick idle channels (no voucher activity for N intervals — voucher_activity.rs already tracks this).
Drive the request-waiver + submit-cooperativeClose flow against the upstream.
Best-effort: on decline/offline, leave the existing expiry-reclaim path untouched.
Out of scope
The client flow primitive itself (separate issue — this depends on it).
Issue #972 requests a periodic background task in the node runtime to cooperatively close idle buyer-side PaymentChannels opened when the node acts as a client during cache-miss upstream pulls (crates/incentive/src/buyer_channel.rs). Without this, idle channels lock the node's USDC deposit until expiry. The implementation builds directly on the client-initiated cooperative-close primitive tracked in #971, which must land first.
📊 Assessment
Dimension
Value
Reasoning
Type
Enhancement
New periodic reconcile task; no existing behavior broken
Labels
enhancement, technical, economics, blocked, medium
Feature addition in Rust; touches payment channels and deposit recovery; explicitly blocked on #971; deposit-lock is a capital-efficiency issue, not a correctness blocker
Well-scoped: detect idle channels via voucher_activity.rs, invoke the cooperative-close flow from #971, fall back gracefully. Unambiguous success criteria. Ready to assign after the dependency lands.
On any failure (provider offline, declined, network error) log at warn level and continue — the existing expiry-reclaim path is the safety net; do not disrupt it.
Unit tests: (a) mock upstream declining waiver → assert expiry path is left undisturbed; (b) mock upstream accepting → assert cooperativeClose is submitted.
Key files to touch
crates/node/src/ — new reconcile task wiring
crates/incentive/src/buyer_channel.rs — idle-detection hook / state query
crates/incentive/src/voucher_activity.rs — source of idle-interval data
Activity
github-actions commentedon Jun 22, 2026
🎯 Triage report
Issue #972 requests a periodic background task in the node runtime to cooperatively close idle buyer-side
PaymentChannels opened when the node acts as a client during cache-miss upstream pulls (crates/incentive/src/buyer_channel.rs). Without this, idle channels lock the node's USDC deposit until expiry. The implementation builds directly on the client-initiated cooperative-close primitive tracked in #971, which must land first.📊 Assessment
enhancement,technical,economics,blocked,mediumvoucher_activity.rs, invoke the cooperative-close flow from #971, fall back gracefully. Unambiguous success criteria. Ready to assign after the dependency lands.🔗 Similar issues
cooperativeCloseat contract level; Cooperative close: node-as-buyer periodic reconcile of node→node channels #972 is the final missing leg (node-as-buyer auto-reclaim).💡 Notes and suggestions
Implementation sketch
ReconcileTaskincrates/node/src/as atokio::spawnloop with a configurable interval.voucher_activity.rsfor buyer channels idle for ≥ N intervals (N should be config-tunable viaconfig-types).CooperativeCloseRequest→ receiveCooperativeCloseAuth→ submitcooperativeCloseon-chain via the binding incrates/incentive/src/payment_channel.rs.warnlevel and continue — the existing expiry-reclaim path is the safety net; do not disrupt it.cooperativeCloseis submitted.Key files to touch
crates/node/src/— new reconcile task wiringcrates/incentive/src/buyer_channel.rs— idle-detection hook / state querycrates/incentive/src/voucher_activity.rs— source of idle-interval datacrates/incentive/src/payment_channel.rs— existingcooperativeCloseon-chain bindingconfig-types— optional: expose the idle-interval threshold as a tunableAnti-panic note: all indexing and
Resulthandling must use combinators (nounwrap/expect) per the workspace Clippy deny policy.Add this agentic workflows to your repo
To install this agentic workflow, run
feat(client-pull,cli): client-initiated cooperative close (#973)
feat(node): idle buyer-channel cooperative-close reconcile sweep (#987)
feat(node): buyer-side unilateral close→settle for unreachable provid…
refactor(node): remove dead pairwise-channel dispute/close/settle met…
refactor(node): drop PaymentPool close monitor; lean on the redeem sw…