From 19ceca25b2f0abb3884731fffb94283d97bf5375 Mon Sep 17 00:00:00 2001 From: Wolfgang Schoenberger <221313372+wolfiesch@users.noreply.github.com> Date: Thu, 18 Jun 2026 13:28:45 -0700 Subject: [PATCH] fix(mnemopi): keep env override out of proactive defaults --- packages/coding-agent/CHANGELOG.md | 6 ++--- packages/mnemopi/CHANGELOG.md | 7 +++--- packages/mnemopi/src/core/beam/index.ts | 11 +--------- .../mnemopi/test/proactive-linking.test.ts | 22 +++++++++++++++++++ 4 files changed, 30 insertions(+), 16 deletions(-) diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.md index cf06331e6..d955732a0 100644 --- a/packages/coding-agent/CHANGELOG.md +++ b/packages/coding-agent/CHANGELOG.md @@ -39,6 +39,9 @@ - Fixed `/model` in the TUI to open the model setup picker again, leaving `/switch` as the temporary session model switcher ([#2933](https://github.com/can1357/oh-my-pi/issues/2933)). - Fixed OpenCode Go sessions recording per-request cost history so `/usage` can show local cap utilization. ([#2942](https://github.com/can1357/oh-my-pi/issues/2942)) +### Fixed + +- Fixed mnemopi proactive linking being configurable only through the `MNEMOPI_PROACTIVE_LINKING` environment variable, unlike the sibling `mnemopi.polyphonicRecall` / `mnemopi.enhancedRecall` settings: added a `mnemopi.proactiveLinking` config.yml setting (off by default, `/settings` → Memory → Mnemopi) that ingests new memories into the episodic graph as they are stored, linking them to related entities and memories; `MNEMOPI_PROACTIVE_LINKING` still overrides the configured value when set ([#2440](https://github.com/can1357/oh-my-pi/issues/2440)). ## [16.0.6] - 2026-06-18 @@ -92,9 +95,6 @@ ### Security - Secured PDF image reads by validating requested image members against the extracted member list before opening files and refusing traversal-style names -### Fixed - -- Fixed mnemopi proactive linking being configurable only through the `MNEMOPI_PROACTIVE_LINKING` environment variable, unlike the sibling `mnemopi.polyphonicRecall` / `mnemopi.enhancedRecall` settings: added a `mnemopi.proactiveLinking` config.yml setting (off by default, `/settings` → Memory → Mnemopi) that ingests new memories into the episodic graph as they are stored, linking them to related entities and memories; `MNEMOPI_PROACTIVE_LINKING` still overrides the configured value when set ([#2440](https://github.com/can1357/oh-my-pi/issues/2440)). ## [16.0.5] - 2026-06-17 diff --git a/packages/mnemopi/CHANGELOG.md b/packages/mnemopi/CHANGELOG.md index f680cb5c3..ae5114e84 100644 --- a/packages/mnemopi/CHANGELOG.md +++ b/packages/mnemopi/CHANGELOG.md @@ -2,6 +2,10 @@ ## [Unreleased] +### Fixed + +- Fixed the proactive-linking write path ignoring host configuration: `proactiveLinkIfEnabled` read `MNEMOPI_PROACTIVE_LINKING` directly, so a host that enabled proactive linking through `configureRecallFeatures()` had no effect unless the environment variable was also set. `proactiveLinking` is now a `RecallFeatureFlags` option resolved through a `proactiveLinkingEnabled()` fallback, matching the existing polyphonic and enhanced recall flags, with the `MNEMOPI_PROACTIVE_LINKING` environment variable still taking precedence whenever it is set. ([#2440](https://github.com/can1357/oh-my-pi/issues/2440)) + ## [16.0.6] - 2026-06-18 ### Fixed @@ -11,9 +15,6 @@ ### Changed - Updated OpenRouter request headers to use standard shared headers from the pi-ai package -### Fixed - -- Fixed the proactive-linking write path ignoring host configuration: `proactiveLinkIfEnabled` read `MNEMOPI_PROACTIVE_LINKING` directly, so a host that enabled proactive linking through `configureRecallFeatures()` had no effect unless the environment variable was also set. `proactiveLinking` is now a `RecallFeatureFlags` option resolved through a `proactiveLinkingEnabled()` fallback, matching the existing polyphonic and enhanced recall flags, with the `MNEMOPI_PROACTIVE_LINKING` environment variable still taking precedence whenever it is set. ([#2440](https://github.com/can1357/oh-my-pi/issues/2440)) ## [16.0.5] - 2026-06-17 diff --git a/packages/mnemopi/src/core/beam/index.ts b/packages/mnemopi/src/core/beam/index.ts index fb56c0d11..a279aa7b1 100644 --- a/packages/mnemopi/src/core/beam/index.ts +++ b/packages/mnemopi/src/core/beam/index.ts @@ -72,19 +72,10 @@ const DEFAULT_CONFIG: BeamConfig = { proactiveLinking: false, }; -function envProactiveLinkingOverride(): boolean | undefined { - const value = process.env.MNEMOPI_PROACTIVE_LINKING; - return value === undefined ? undefined : value === "1"; -} - function normalizeConfig(options: BeamMemoryOptions): BeamConfig { const configured = options.config ?? {}; const useCloud = options.useCloud ?? configured.useCloud ?? DEFAULT_CONFIG.useCloud; - const proactiveLinking = - envProactiveLinkingOverride() ?? - options.proactiveLinking ?? - configured.proactiveLinking ?? - proactiveLinkingEnabled(); + const proactiveLinking = options.proactiveLinking ?? configured.proactiveLinking ?? proactiveLinkingEnabled({}); return { workingMemoryLimit: configured.workingMemoryLimit ?? DEFAULT_CONFIG.workingMemoryLimit, workingMemoryTtlHours: configured.workingMemoryTtlHours ?? DEFAULT_CONFIG.workingMemoryTtlHours, diff --git a/packages/mnemopi/test/proactive-linking.test.ts b/packages/mnemopi/test/proactive-linking.test.ts index b705df908..0e7b799de 100644 --- a/packages/mnemopi/test/proactive-linking.test.ts +++ b/packages/mnemopi/test/proactive-linking.test.ts @@ -184,6 +184,28 @@ describe("proactive memory linking", () => { } }); + it("does not snapshot a construction-time environment override into instance defaults", () => { + process.env.MNEMOPI_PROACTIVE_LINKING = "1"; + const beam = new BeamMemory({ + sessionId: "proactive-env-snapshot", + dbPath: ":memory:", + proactiveLinking: false, + }); + delete process.env.MNEMOPI_PROACTIVE_LINKING; + try { + const first = beam.remember("Alice set up the CI/CD pipeline for backend deployment", { + importance: 0.8, + }); + const second = beam.remember("Alice configured the deployment pipeline for continuous integration", { + importance: 0.8, + }); + + expect(linkedIds(graphOf(beam).findRelatedMemories(second, 1)).has(first)).toBe(false); + } finally { + beam.close(); + } + }); + it("does not create recall-similarity edges for unrelated content", () => { process.env.MNEMOPI_PROACTIVE_LINKING = "1"; const beam = new BeamMemory({ sessionId: "proactive-unrelated", dbPath: ":memory:" });