Skip to content

fix: protect freshly accepted DIPs rules with durable state#1227

Merged
MoonBoi9001 merged 4 commits into
main-dipsfrom
mb9/track-accepted-dips-agreements-locally
Jun 3, 2026
Merged

fix: protect freshly accepted DIPs rules with durable state#1227
MoonBoi9001 merged 4 commits into
main-dipsfrom
mb9/track-accepted-dips-agreements-locally

Conversation

@MoonBoi9001

@MoonBoi9001 MoonBoi9001 commented Jun 1, 2026

Copy link
Copy Markdown
Member

TL;DR

Replaces an in-memory, time-based workaround that protected freshly accepted DIPs indexing rules with durable local state, so the protection survives an agent restart and drops the fixed timer. No behaviour change in the normal case — it closes a gap where a freshly paid-for rule could be deleted.

Motivation

When the agent accepts a DIPs indexing agreement on-chain, it creates a local indexing rule for that deployment. A separate cleanup loop deletes DIPs rules that aren't backed by either a pending proposal or an agreement the indexing-payments subgraph reports as active. For a few blocks after acceptance the agreement is neither — it's been accepted, but the subgraph hasn't indexed it yet — so the freshly created rule looks unbacked.

Until now a 300-second in-memory grace window bridged that gap, but it didn't survive an agent restart: a restart during the window could let the cleanup delete a rule the indexer is actively being paid to serve, churning the deployment and its allocation until the subgraph caught up. The agent already records each acceptance durably, so the fix is to keep the rule alive from that record instead.

Summary

  • Keep a freshly accepted agreement's rule alive from its durable local accepted record.
  • Retire that record once the network data lists its agreement, instead of racing two clocks.
  • Fall back to the subgraph's progress as a backstop when an agreement isn't listed yet.
  • Skip a single failed retire and retry it next cycle, rather than aborting the cleanup pass.
  • Warn and list the stuck deployments when no indexing-payments subgraph is configured.
  • Remove the in-memory grace window and its fixed 300-second timer.
  • Cover the keep, retire, reap, and missing-subgraph paths with tests.

@github-project-automation github-project-automation Bot moved this to 🗃️ Inbox in Indexer Jun 1, 2026
@MoonBoi9001 MoonBoi9001 marked this pull request as draft June 1, 2026 05:45
@MoonBoi9001 MoonBoi9001 changed the title fix: stop deleting freshly accepted DIPs indexing rules fix: protect freshly accepted DIPs rules with durable state Jun 1, 2026
Base automatically changed from mb9/configurable-dips-acceptance-interval-and-cleanup to main-dips June 1, 2026 19:20
MoonBoi9001 and others added 2 commits June 2, 2026 16:34
The agent already stores a row per indexing-agreement proposal and flips it to
'accepted' once accepted on-chain, but nothing read those accepted rows back. Add a
lookup for them and a way to retire them, and expose each row's last-updated time.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
A freshly accepted agreement's rule was shielded from cleanup by an in-memory, 300-second
grace window that didn't survive a restart. Keep these rules alive from the durable 'accepted'
proposal rows instead, retiring each row once the subgraph has indexed past its acceptance.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@MoonBoi9001 MoonBoi9001 force-pushed the mb9/track-accepted-dips-agreements-locally branch from c4b35a3 to 05efa66 Compare June 2, 2026 04:34
MoonBoi9001 and others added 2 commits June 2, 2026 17:22
A freshly accepted agreement keeps its rule alive via a local row until the network data lists
it. Retiring that row by comparing two separately-read timestamps could retire it too early and
delete a live rule; retire once the data lists the agreement, and isolate a failed retire.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Accepting a proposal needs the indexing-payments subgraph, so the local accepted rows can only
appear without one if it was unset after acceptance. The retirement path then can't run and the
rules are kept silently; warn with the stuck deployments so the misconfiguration is visible.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@MoonBoi9001 MoonBoi9001 force-pushed the mb9/track-accepted-dips-agreements-locally branch from 05efa66 to ac722ca Compare June 2, 2026 05:22
@MoonBoi9001 MoonBoi9001 marked this pull request as ready for review June 2, 2026 05:35
@MoonBoi9001 MoonBoi9001 requested a review from Maikol June 2, 2026 05:39
@github-project-automation github-project-automation Bot moved this from 🗃️ Inbox to ✅ Approved in Indexer Jun 3, 2026
@MoonBoi9001 MoonBoi9001 merged commit 1015659 into main-dips Jun 3, 2026
3 checks passed
@MoonBoi9001 MoonBoi9001 deleted the mb9/track-accepted-dips-agreements-locally branch June 3, 2026 14:19
@github-project-automation github-project-automation Bot moved this from ✅ Approved to 🚗 Merged in Indexer Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: 🚗 Merged

Development

Successfully merging this pull request may close these issues.

2 participants