Skip to content

A4 — VM-reconcile damping (negative cache + single-peer catch-up)#1144

Merged
Jurij89 merged 28 commits into
integration/issue-1138from
codex/issue-1138-a4-vm-reconcile-damping
Jun 14, 2026
Merged

A4 — VM-reconcile damping (negative cache + single-peer catch-up)#1144
Jurij89 merged 28 commits into
integration/issue-1138from
codex/issue-1138-a4-vm-reconcile-damping

Conversation

@Jurij89

@Jurij89 Jurij89 commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Damps the 60 s VM-reconcile loop: a per-UAL negative cache (5 min base, x2, 6 h cap) that scopes recompute with a cheap bound ASK gate instead of CG-wide counters.
  • Replaces all-peers-parallel catch-up with a single peer chosen from preferred/core-first ordering, then round-robin, plus a per-CG fetch cooldown.
  • Adds optional tombstoning (DKG_VM_RECONCILE_TOMBSTONE_AFTER_MS, default OFF) to advance the cursor after sustained max-backoff.
  • Folds the still-relevant fix(agent): harden chain-driven VM reconcile robustness (audit follow-ups) #934 hardening into A4: transient head-fetch watermark hold, existence-gated core-host recording, tracked core-host persistence on shutdown, deterministic finalization op selection, failed warm-core unpin retry, typed keep-root coverage, and sync checkpoint/since threading tests.

Related

Files changed

File What
packages/agent/src/dkg-agent-swm-host.ts Negative cache, scoped recompute gate, single-peer round-robin, tombstone, existence-gated core-host recording
packages/agent/src/chain-reconciler.ts Hold watermark persistence on transient head-fetch failure
packages/agent/src/dkg-agent-base.ts VM reconcile cache state and tracked core-host recording promises
packages/agent/src/dkg-agent-lifecycle.ts Track async core-host recording from StorageACK hook
packages/agent/src/dkg-agent.ts Flush tracked core-host recording promises during stop
packages/agent/src/finalization-handler.ts Deterministic operation selection for merkle-root match
packages/agent/src/p2p/warm-core-connections.ts Retry failed warm-core unpins

Plus focused regression tests for A4 and #934 fold-in behavior.

Test plan

  • node node_modules/typescript/bin/tsc -p packages/agent/tsconfig.json
  • node ../../node_modules/vitest/vitest.mjs run --config vitest.config.ts test/chain-reconciler.test.ts test/core-fills-gap.test.ts test/warm-core-connections.test.ts test/chain-reconcile-e2e.test.ts test/durable-sync-since-threading.test.ts test/sync-checkpoint-key.test.ts --reporter verbose
  • node ../../node_modules/vitest/vitest.mjs run --config vitest.config.ts test/sync-on-connect-retry.test.ts test/sync-requester-progress.test.ts --reporter verbose
  • $env:NODE_PATH=(Resolve-Path .\node_modules).Path; node ../../node_modules/vitest/vitest.mjs run --config vitest.config.ts test/agent.part-16.test.ts --reporter verbose

Targets integration/issue-1138 (not main) so the heavy overlaps on agent lifecycle/base code are resolved once on the integration branch, which is promoted to main in gated waves (see #1138).

Comment thread packages/agent/src/dkg-agent-swm-host.ts Outdated
Comment thread packages/agent/src/dkg-agent-swm-host.ts Outdated
Comment thread packages/agent/src/dkg-agent-swm-host.ts Outdated
Comment thread packages/agent/src/dkg-agent-swm-host.ts Outdated
Comment thread packages/agent/src/dkg-agent-swm-host.ts Outdated
Comment thread packages/agent/src/dkg-agent-lifecycle.ts Outdated
Comment thread packages/agent/src/dkg-agent-lifecycle.ts Outdated
Comment thread packages/agent/src/dkg-agent-swm-host.ts Outdated
Comment thread packages/agent/src/dkg-agent-swm-host.ts Outdated
Comment thread packages/agent/src/dkg-agent-base.ts
Comment thread packages/agent/src/dkg-agent-lifecycle.ts Outdated
Comment thread packages/agent/src/dkg-agent-swm-host.ts
Comment thread packages/agent/src/dkg-agent-lifecycle.ts Outdated
Comment thread packages/agent/src/dkg-agent-swm-host.ts Outdated
Comment thread packages/agent/src/dkg-agent-swm-host.ts Outdated
Comment thread packages/agent/src/dkg-agent-swm-host.ts
Comment thread packages/agent/src/dkg-agent-lifecycle.ts Outdated
Comment thread packages/agent/src/dkg-agent-swm-host.ts Outdated
Comment thread packages/agent/src/dkg-agent-swm-host.ts Outdated

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Codex review completed — no issues found.

Comment thread packages/agent/src/p2p/warm-core-connections.ts Outdated
Comment thread packages/agent/src/dkg-agent-swm-host.ts Outdated
Comment thread packages/agent/src/dkg-agent-swm-host.ts
Comment thread packages/agent/src/dkg-agent-swm-host.ts
Comment thread packages/agent/src/dkg-agent-swm-host.ts Outdated
Comment thread packages/agent/src/chain-reconciler.ts Outdated
Comment thread packages/agent/src/p2p/warm-core-connections.ts Outdated
Comment thread packages/agent/src/dkg-agent-swm-host.ts Outdated
Comment thread packages/agent/src/dkg-agent-swm-host.ts
Comment thread packages/agent/src/dkg-agent-context-graph.ts Outdated
Comment thread packages/agent/src/dkg-agent-swm-host.ts Outdated
Comment thread packages/agent/src/dkg-agent.ts Outdated
Comment thread packages/agent/src/dkg-agent-swm-host.ts Outdated
Comment thread packages/agent/src/dkg-agent-swm-host.ts Outdated
Comment thread packages/agent/src/dkg-agent-lifecycle.ts
Comment thread packages/agent/src/dkg-agent-swm-host.ts Outdated
Comment thread packages/agent/src/dkg-agent-swm-host.ts Outdated
Comment thread packages/agent/src/dkg-agent-swm-host.ts
Comment thread packages/agent/src/dkg-agent-swm-host.ts Outdated
Comment thread packages/agent/src/p2p/warm-core-connections.ts Outdated
Comment thread packages/agent/src/p2p/warm-core-connections.ts Outdated
Comment thread packages/agent/src/dkg-agent-swm-host.ts
Comment thread packages/agent/src/dkg-agent-lifecycle.ts Outdated
Comment thread packages/agent/src/dkg-agent.ts
Comment thread packages/agent/src/dkg-agent-swm-host.ts
Comment thread packages/agent/src/dkg-agent-lifecycle.ts Outdated
Comment thread packages/agent/src/dkg-agent-lifecycle.ts Outdated
Comment thread packages/agent/src/dkg-agent-swm-host.ts Outdated
Comment thread packages/agent/src/dkg-agent-swm-host.ts
Comment thread packages/agent/src/dkg-agent-lifecycle.ts
Comment thread packages/chain/src/evm-adapter-context-graph.ts
Comment thread packages/agent/src/dkg-agent-swm-host.ts Outdated
Comment thread packages/agent/src/dkg-agent-lifecycle.ts Outdated
Comment thread packages/agent/src/dkg-agent-lifecycle.ts
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.

1 participant