[GH-ISSUE #1688] [Issue]: Long-Term Memory activation fails on Engine staging: lenient settings reader assumes zod v3 issue codes #1665

Closed
opened 2026-10-26 04:02:28 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @Promansis on GitHub (Oct 25, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/1688

Originally assigned to: @Promansis on GitHub.

Summary

Long-Term Memory no longer activates against Marinara Engine staging when its settings file holds values from a newer package version. The lenient settings reader assumes zod v3 issue codes, and Engine staging moved to zod v4. The non-required "LTM package browser" CI workflow has failed on every LTM PR since at least #1670.

Affected package

long-term-memory

Expected behavior

readLtmSettingsFile splits off settings it doesn't recognise, logs each one by path, and activation succeeds. Examples are an unknown enum option, an out-of-range number, or an unknown key. This is what tests/long-term-memory-storage.regression.ts checks: activation loads a newer file and logs sourcesAvailabilityModes.3, reasoningEffort, maxOutputTokens, promptTemplates.0.description, activePromptTemplateIdsByMode.adventure, importSource and receiptRetentionDays.

Actual behavior

On Engine staging, the newer values stay in place. safeParse still fails, and schema.parse(value) throws a ZodError, so activateLongTermMemoryStorage throws:

at readLtmSettingsFile        (services/long-term-memory/settings.ts:132)
at getLtmExtractionConfig     (extraction/extraction-config.ts:48)
at selfCheck                  (runtime.ts:17)
at activateLongTermMemoryStorage (runtime.ts:32)
at tests/long-term-memory-storage.regression.ts:366

The issues in the thrown error are zod v4-shaped:

Path Code Message
reasoningEffort ("xhigh") invalid_value Invalid option: expected one of "none"|"low"|"medium"|"high"
maxOutputTokens (100000) too_big, origin: "number" Too big: expected number to be <=32768
promptTemplates.0 unrecognized_keys description
activePromptTemplateIdsByMode unrecognized_keys adventure

Cause

splitUnknownLtmSettings in packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/settings.ts matches zod v3 issue codes:

if (issue.code === "unrecognized_keys") { … }
else if (issue.code === "invalid_enum_value" && issue.path.length > 0) remove(issue.path);
else if ((issue.code === "too_big" || issue.code === "too_small") && issue.path.length > 0)
  outOfRange.push(issue.path);

zod v4 reports an enum miss as invalid_value, not invalid_enum_value, so the enum branch never runs. The out-of-range branch runs only when nothing else changed (if (!changed) outOfRange.forEach(remove)), so the mix in the fixture still leaves values behind. The z.ZodType<T, z.ZodTypeDef, unknown> typing in the same file is also v3-only.

Engine staging switched in Pasta-Devs/Marinara-Engine 0dddb04dc ("chore(deps): bump the npm_and_yarn group across 4 directories with 2 updates", 2026-10-23):

  • packages/server: "zod": "^4.6.7", with "zod-v3": "npm:zod@3.25.76" kept as an alias
  • packages/shared: "zod": "^4.6.7"

CI builds against Engine staging. A local Engine checkout still on zod 3.25.76 passes this test, which is why it passes locally.

This is not only a test problem. Anyone who downgrades the package, or restores a settings file from a newer version, on an Engine with zod v4 will hit a failed activation instead of a logged warning.

Steps to reproduce

  1. Use a Marinara Engine checkout at staging (zod ^4.6.7), installed and built.
  2. From the Marinara-Agents root, run the same command as the "Run Engine-backed Long-Term Memory regressions" step in .github/workflows/ltm-browser.yml: MARINARA_ENGINE_ROOT=<engine> pnpm --dir <engine> --filter @marinara-engine/server exec tsx "$PWD/tests/long-term-memory-storage.regression.ts".
  3. long-term-memory-storage.regression.ts throws at line 366.

Environment

  • Marinara Engine version: staging at b62d89fe9 (zod ^4.6.7); passes on 81f0896d3 (zod 3.25.76)
  • Package version: long-term-memory 1.4.92 and 1.4.93
  • Install type: source (GitHub Actions)
  • OS + version: ubuntu-latest runner
  • Browser or app shell: n/a (server-side activation)

Logs, screenshots, or video

Failing runs of "Long-Term Memory package browser", step "Run Engine-backed Long-Term Memory regressions":

  • PR #1687, run 40200205523: throws at line 366 with the ZodError above.
  • PR #1670, run 40162694925 (cf2dd5413): AssertionError: activation must load a newer file and log sourcesAvailabilityModes.3 at line 383. This is the same enum-code mismatch. #1670 merged with the workflow failing.
  • PR #1672, runs 40164832076 and 40165248486: failed in the same step.

Additional context

Possible fixes, for whoever picks this up:

  • Match both code sets. Treat invalid_value like invalid_enum_value, and check whether the v4 too_big/too_small and unrecognized_keys shapes (keys, path) still line up.
  • Or build the settings schema with the Engine's zod-v3 alias. That needs a fallback for Engines in the supported range (engine.min 2.4.1) that don't have the alias.

Either way, the regression has to pass against both an Engine on zod v3 and one on zod v4. The workflow isn't required, so nothing blocks merges on this today.

Template check

Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @Promansis on GitHub (Oct 25, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/1688 Originally assigned to: @Promansis on GitHub. ## Summary Long-Term Memory no longer activates against Marinara Engine `staging` when its settings file holds values from a newer package version. The lenient settings reader assumes zod v3 issue codes, and Engine `staging` moved to zod v4. The non-required "LTM package browser" CI workflow has failed on every LTM PR since at least #1670. ## Affected package long-term-memory ## Expected behavior `readLtmSettingsFile` splits off settings it doesn't recognise, logs each one by path, and activation succeeds. Examples are an unknown enum option, an out-of-range number, or an unknown key. This is what `tests/long-term-memory-storage.regression.ts` checks: activation loads a newer file and logs `sourcesAvailabilityModes.3`, `reasoningEffort`, `maxOutputTokens`, `promptTemplates.0.description`, `activePromptTemplateIdsByMode.adventure`, `importSource` and `receiptRetentionDays`. ## Actual behavior On Engine `staging`, the newer values stay in place. `safeParse` still fails, and `schema.parse(value)` throws a `ZodError`, so `activateLongTermMemoryStorage` throws: ```text at readLtmSettingsFile (services/long-term-memory/settings.ts:132) at getLtmExtractionConfig (extraction/extraction-config.ts:48) at selfCheck (runtime.ts:17) at activateLongTermMemoryStorage (runtime.ts:32) at tests/long-term-memory-storage.regression.ts:366 ``` The issues in the thrown error are zod v4-shaped: | Path | Code | Message | | --- | --- | --- | | `reasoningEffort` ("xhigh") | `invalid_value` | Invalid option: expected one of "none"\|"low"\|"medium"\|"high" | | `maxOutputTokens` (100000) | `too_big`, `origin: "number"` | Too big: expected number to be <=32768 | | `promptTemplates.0` | `unrecognized_keys` | `description` | | `activePromptTemplateIdsByMode` | `unrecognized_keys` | `adventure` | ## Cause `splitUnknownLtmSettings` in `packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/settings.ts` matches zod v3 issue codes: ```ts if (issue.code === "unrecognized_keys") { … } else if (issue.code === "invalid_enum_value" && issue.path.length > 0) remove(issue.path); else if ((issue.code === "too_big" || issue.code === "too_small") && issue.path.length > 0) outOfRange.push(issue.path); ``` zod v4 reports an enum miss as `invalid_value`, not `invalid_enum_value`, so the enum branch never runs. The out-of-range branch runs only when nothing else changed (`if (!changed) outOfRange.forEach(remove)`), so the mix in the fixture still leaves values behind. The `z.ZodType<T, z.ZodTypeDef, unknown>` typing in the same file is also v3-only. Engine `staging` switched in Pasta-Devs/Marinara-Engine `0dddb04dc` ("chore(deps): bump the npm_and_yarn group across 4 directories with 2 updates", 2026-10-23): - `packages/server`: `"zod": "^4.6.7"`, with `"zod-v3": "npm:zod@3.25.76"` kept as an alias - `packages/shared`: `"zod": "^4.6.7"` CI builds against Engine `staging`. A local Engine checkout still on zod 3.25.76 passes this test, which is why it passes locally. This is not only a test problem. Anyone who downgrades the package, or restores a settings file from a newer version, on an Engine with zod v4 will hit a failed activation instead of a logged warning. ## Steps to reproduce 1. Use a Marinara Engine checkout at `staging` (zod ^4.6.7), installed and built. 2. From the Marinara-Agents root, run the same command as the "Run Engine-backed Long-Term Memory regressions" step in `.github/workflows/ltm-browser.yml`: `MARINARA_ENGINE_ROOT=<engine> pnpm --dir <engine> --filter @marinara-engine/server exec tsx "$PWD/tests/long-term-memory-storage.regression.ts"`. 3. `long-term-memory-storage.regression.ts` throws at line 366. ## Environment - Marinara Engine version: `staging` at `b62d89fe9` (zod ^4.6.7); passes on `81f0896d3` (zod 3.25.76) - Package version: long-term-memory 1.4.92 and 1.4.93 - Install type: source (GitHub Actions) - OS + version: ubuntu-latest runner - Browser or app shell: n/a (server-side activation) ## Logs, screenshots, or video Failing runs of "Long-Term Memory package browser", step "Run Engine-backed Long-Term Memory regressions": - PR #1687, run 40200205523: throws at line 366 with the `ZodError` above. - PR #1670, run 40162694925 (`cf2dd5413`): `AssertionError: activation must load a newer file and log sourcesAvailabilityModes.3` at line 383. This is the same enum-code mismatch. #1670 merged with the workflow failing. - PR #1672, runs 40164832076 and 40165248486: failed in the same step. ## Additional context Possible fixes, for whoever picks this up: - Match both code sets. Treat `invalid_value` like `invalid_enum_value`, and check whether the v4 `too_big`/`too_small` and `unrecognized_keys` shapes (`keys`, `path`) still line up. - Or build the settings schema with the Engine's `zod-v3` alias. That needs a fallback for Engines in the supported range (`engine.min` 2.4.1) that don't have the alias. Either way, the regression has to pass against both an Engine on zod v3 and one on zod v4. The workflow isn't required, so nothing blocks merges on this today. ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-27 06:05:37 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Agents#1665
No description provided.