Skip to main content

Module conflict

Module conflict 

Source
Expand description

APEX-MEM conflict resolution for cardinality-1 predicates.

When multiple head edges share (subject, canonical_relation) and the predicate has cardinality = 1, this module selects one authoritative edge per the configured ConflictStrategy:

  • Recency: picks the edge with the greatest valid_from.
  • Confidence: picks the edge with the highest confidence.
  • Llm: delegates to an LLM provider with a 500 ms hard timeout, falling back to Recency.

§Invariants

  • The resolver is only invoked for cardinality-1 predicates; cardinality-n predicates pass all head edges through unchanged.
  • The LLM strategy respects a 500 ms mandatory timeout and a per-turn budget cap; both exhaustion paths fall back to Recency.
  • Losing edges are optionally retained in alternatives (disabled by default).

§Unique index vs conflict resolver

The partial unique index uq_graph_edges_active_head prevents same-target duplicates for a cardinality-1 predicate (i.e., two rows for the exact same target entity cannot both be active). The conflict resolver handles the orthogonal case: two head edges with different targets for the same cardinality-1 predicate (e.g., works_at Acme vs works_at Globex).

Structs§

ApexMetrics
Atomic counters for APEX-MEM Prometheus metrics.
ConflictResolver
Conflict resolver for cardinality-1 predicate groups.
ConflictResult
Output of conflict resolution for a single (subject, canonical_relation) group.

Enums§

ConflictStrategy
Conflict resolution strategy for cardinality-1 predicates.

Constants§

SUPERSEDE_DEPTH_CAP
Maximum allowed depth when walking a supersedes chain for cycle detection. Defined here as a named constant per critic nit #7.