molecule-core/workspace-server/internal/memory
Hongming Wang b5435b4732 fix(memory v2): warn at boot when cutover env half-configured
MEMORY_V2_CUTOVER=true gates the admin export/import path on the v2
plugin, but the cutoverActive() check in admin_memories.go silently
returns false when the plugin isn't wired:

  func (h *AdminMemoriesHandler) cutoverActive() bool {
      if os.Getenv(envMemoryV2Cutover) != "true" {
          return false
      }
      return h.plugin != nil && h.resolver != nil
  }

Two operator misconfigs hit the silent-fallback path:

  1. MEMORY_V2_CUTOVER=true set, MEMORY_PLUGIN_URL unset
     → wiring.Build returns nil → handler stays on legacy SQL path
     → operator sees no error, assumes cutover is live, but every
        request still writes the legacy table.

  2. MEMORY_V2_CUTOVER=true set, MEMORY_PLUGIN_URL set, but plugin
     unreachable at boot
     → wiring.Build still returns the bundle (intentional — circuit
        breaker handles ongoing unavailability), but every cutover
        write quietly falls back via the breaker.
     → only signal: legacy table keeps growing.

Both are exactly the "structurally invisible until prod" failure
mode; the only real-world detection today is "notice the legacy
table is still being written to," which no operator will check.

Add loud, distinctive WARN log lines at Build() time for both
shapes. Boot logs are operator-visible, so a half-config is
immediately obvious without needing dashboards.

Tests:
  * 4 new (cutover+no-URL → warn, neither set → silent, cutover+probe-
    fail → loud warn, probe-fail-without-cutover → quiet generic)
  * 6 existing (still pass; pin no-warning-on-happy-path)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-04 17:24:11 -07:00
..
client Memory v2 PR-2: HTTP plugin client + breaker + capability negotiation 2026-05-04 06:57:24 -07:00
contract Memory v2 fixup C1: backfill idempotency via MemoryWrite.id 2026-05-04 08:54:13 -07:00
e2e Memory v2 PR-11: E2E test — flat-plugin swap proves contract works 2026-05-04 08:20:35 -07:00
namespace Memory v2 PR-4: namespace resolver + tests 2026-05-04 07:25:33 -07:00
pgplugin Memory v2 fixup C1: backfill idempotency via MemoryWrite.id 2026-05-04 08:54:13 -07:00
wiring fix(memory v2): warn at boot when cutover env half-configured 2026-05-04 17:24:11 -07:00