Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
address review (ollama): don't tie the residue directory rule to path.sep
[._.]/ Adam Eivyda000d41e7bd
diff --git a/server/services/imageGen/fabricationGuard.js b/server/services/imageGen/fabricationGuard.jsindex 4b40cda7e0..258b92c9c6 100644--- a/server/services/imageGen/fabricationGuard.js+++ b/server/services/imageGen/fabricationGuard.js@@ -27,7 +27,7 @@*/import { readdir } from 'fs/promises';-import { extname, sep } from 'path';+import { extname } from 'path';// Source/markup extensions an agent would write to draw an image itself// (matplotlib/PIL scripts, canvas or SVG/HTML renderers). Deliberately narrow:@@ -86,8 +86,12 @@ export async function checkFabrication(scratchDir, toolName) {}return [];});+ // Split on BOTH separators rather than `path.sep`: the guard must not depend+ // on which one Node's recursive readdir emits on a given platform. Getting it+ // wrong silently degrades the directory rule to a no-op — a nested+ // `__pycache__/` with no code-extension file in it would go undetected.const residue = paths.filter((rel) =>- rel.split(sep).some((segment) => CODE_DIRS.has(segment))+ rel.split(/[\\/]/).some((segment) => CODE_DIRS.has(segment))|| CODE_EXTENSIONS.has(extname(rel).toLowerCase()));if (!residue.length) return null;// This sentence is PortOS's inference, not the provider's words, and it getsdiff --git a/server/services/imageGen/fabricationGuard.test.js b/server/services/imageGen/fabricationGuard.test.jsindex c90e7cab8d..efdeba9dde 100644--- a/server/services/imageGen/fabricationGuard.test.js+++ b/server/services/imageGen/fabricationGuard.test.js@@ -81,6 +81,16 @@ describe('checkFabrication', () => {expect(await checkFabrication(dir, 'image_gen')).toContain('__pycache__');});+ it('matches a code directory under either path separator', async () => {+ // The directory rule splits the relative path into segments. Depending on+ // `path.sep` would silently make it a no-op on the platform whose recursive+ // readdir emits the other separator — a nested venv/__pycache__ containing+ // no code-extension file would then go undetected entirely.+ await mkdir(join(dir, 'venv', 'lib'), { recursive: true });+ await writeFile(join(dir, 'venv', 'lib', 'placeholder'), '');+ expect(await checkFabrication(dir, 'image_gen')).toContain('venv');+ });+it('ignores a CLI writing its own session state into its cwd', async () => {// A false positive here fails an otherwise-good render, so non-source// leftovers must not trip the guard.