mirror of
https://github.com/Pasta-Devs/Marinara-Agents.git
synced 2026-12-03 18:55:07 +07:00
[GH-ISSUE #1416] [Issue]: Long-Term Memory server: six core modules import each other in a loop because of one 3-line helper #720
Labels
No labels
agent: chess
agent: conversation-calls
agent: eightball
agent: haptic
agent: hierarchical-maps
agent: hierarchical-maps
agent: illustrator
agent: poker
agent: rock-paper-scissors
agent: tic-tac-toe
agent: uno
artifacts
bug
bugfix
build
catalog
ci
client
dependencies
docs
documentation
enhancement
feature
fixed-in-staging
in-pr
normal-scope
packages
pull-request
qol
regression
roadmap
scope-risk
server
soup
upstream
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Agents#720
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Promansis on GitHub (Oct 15, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/1416
Originally assigned to: @Promansis on GitHub.
Summary
Six core server modules of Long-Term Memory form a runtime import cycle. Storage, drafts, rejected suggestions, subject identity, the draft projector and scoped targets all reach each other. Nothing breaks today, but a cycle makes module start-up order fragile: any module-level use of an imported value can fail with "Cannot access … before initialization", depending on which module loads first. It also stops any one of these modules being loaded or tested on its own.
The whole cycle hangs on one pure 3-line helper,
subjectsEqual. Moving it to its own module removes the cycle.Affected package
long-term-memory1.4.38 (upstream/staging97c0486f8), underpackages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/. The runtime imports that form the cycle (type-only imports excluded):storage.tsisAdditiveLtmSectionfromdraft-projector.tsdraft-projector.tscanUpdateLtmScopedTargetfromscoped-targets.ts;subjectsEqualfromsubject-identity.ts(:26)scoped-targets.tssubjectsEqualfromsubject-identity.ts(:20)subject-identity.tsLongTermMemoryStoragefromstorage.ts;readSavedLtmSubjectIdentityChoicesfromrejected-suggestions.tsrejected-suggestions.tsdraftPathForIdfromdraft-store.tsdraft-store.tsLongTermMemoryStoragefromstorage.tssubjectsEqual(subject-identity.ts:2139-2142) compares two subject lists by key. It is the only thingdraft-projector.tsandscoped-targets.tstake from the 2,740-linesubject-identity.ts.Expected behavior
The LTM server folder has no runtime import cycles.
Actual behavior
A strongly-connected-component scan of every runtime import in the server folder finds exactly one cycle, with all six modules above in it. Moving
subjectsEqualto a new leaf module and pointing the two importers at it leaves zero cycles. This was checked on a throwaway copy, outside the repository.Steps to reproduce
Environment
staging)upstream/staging97c0486f8)Logs, screenshots, or video
Not applicable.
Minimal fix
subjectsEqualfromsubject-identity.tsto a newsubject-equality.tsin the same folder. It depends only on theLtmSubjecttype.draft-projector.ts,scoped-targets.ts,evidence-unit-compiler.ts,source-extraction.tsandsubject-identity.ts.Validation:
npm run checknode scripts/typecheck-packages.mjs long-term-memoryserver.mjschanges; patch bump)node scripts/validate-catalog.mjsAdditional context
Out of scope: the other layering notes from the 1.4.8 architecture audit:
subject-identity.ts.Each needs its own design decision.
Optional follow-up: nothing stops a new cycle from forming. A repo-wide cycle check would belong in
scripts/and is a separate decision.Timing:
subject-identity.tschanges often. Land this between batches to avoid merge conflicts.Template check
Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked: