Skip to content

feat(agent): resume persisted Edge always-on sync scopes - #2032

Open
branarakic wants to merge 1 commit into
codex/rfc64-m1-chain-provenancefrom
codex/rfc64-m1-edge-scoped-reconciler
Open

feat(agent): resume persisted Edge always-on sync scopes#2032
branarakic wants to merge 1 commit into
codex/rfc64-m1-chain-provenancefrom
codex/rfc64-m1-edge-scoped-reconciler

Conversation

@branarakic

Copy link
Copy Markdown
Contributor

User impact

An Edge node can keep broad sync-on-connect disabled and still resume only the context graphs that the user explicitly persisted as always-on before the process restarted.

  • Runtime-only selections, on-demand subscriptions, and unsubscribed graphs are not promoted into automatic work.
  • The scoped Edge round does not bootstrap the Agents or Ontology system graphs.
  • If the user removes or demotes a subscription while a round is in flight, the agent revalidates intent before every later asynchronous phase and stops work for that graph.
  • Only the module-owned periodic reconciler can authorize this exception; JavaScript callers cannot forge the trigger with a public string or object.
  • Core behavior and the legacy three-argument sync call shape remain unchanged.

This is stacked on #2031 and should be reviewed after that parent.

Before

sequenceDiagram
    participant User
    participant Edge
    participant Reconciler
    participant Peer

    User->>Edge: Persist CG A as always-on
    Edge->>Edge: Restart and rehydrate CG A
    Reconciler->>Edge: Periodic retry
    alt Broad sync-on-connect is disabled
        Edge-->>Reconciler: Exit without resuming CG A
    else Broad sync-on-connect is enabled
        Edge->>Peer: Sync system graphs and configured scope
    end
Loading

After

sequenceDiagram
    participant User
    participant Edge
    participant Reconciler
    participant Peer

    User->>Edge: Persist CG A as always-on
    Edge->>Edge: Restart and rehydrate explicit CG A
    Reconciler->>Edge: Branded periodic invocation
    Edge->>Edge: Revalidate live persisted intent
    Edge->>Peer: Durable sync for CG A only
    Edge->>Edge: Revalidate after durable work
    Edge->>Peer: Plan SWM for current live scope
    Edge->>Edge: Revalidate after planning
    alt CG A is still always-on
        Edge->>Peer: SWM sync for CG A only
        Edge-->>Reconciler: Record verified scoped evidence
    else User changed CG A to on-demand or unsubscribed
        Edge-->>Reconciler: Stop remaining work for CG A
    end
Loading

Verification

  • pnpm --filter @origintrail-official/dkg-storage build
  • pnpm --filter @origintrail-official/dkg-agent build
  • pnpm --filter @origintrail-official/dkg-agent exec vitest run --config vitest.unit.config.ts test/sync-coverage-evidence-runtime.test.ts test/sync-on-connect-retry.test.ts
    • 2 files, 76 tests passed
  • git diff --check

The focused tests cover trigger forgery, runtime-only and on-demand exclusions, no system-graph bootstrap, and subscription demotion during protocol discovery, durable transfer, and SWM planning.

Comment thread packages/agent/src/dkg-agent-lifecycle.ts
Comment thread packages/agent/src/sync/on-connect/sync-on-connect.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.

2 participants