From d5b6e6f12c8c3c4551050f8fc7d19fb78d6b581b Mon Sep 17 00:00:00 2001 From: Agando Date: Fri, 23 Oct 2026 21:35:02 +0200 Subject: fix(newos4): the virtual /sys entry leaked into listings, trees and counts (v4.6.88-90) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit One phantom entry, three symptoms: - ls() injected 'sys' whenever it was called without a path, so 'cd _agents; ls' advertised a sys directory that does not exist, and list_files('_agents/sys') answered 'Directory not found' — the reported false negative. Injection is now gated on dir === root. - tree() pushed the same virtual name into the walk and dereferenced it, throwing mid-output on every root listing. Guarded. - _gatherFileInfo() walked into /sys and counted a synthetic subtree: 146 files / 114 dirs for a 44-file / 15-dir store. Virtual entries are skipped. Verified: root still lists sys; _agents and skills do not; tree('') completes; world model total (44) equals an independent walk of fs.root (44), agree: true. --- modules/core/module-world-model.js | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'modules/core/module-world-model.js') diff --git a/modules/core/module-world-model.js b/modules/core/module-world-model.js index 54a17e4..6e8f3c3 100644 --- a/modules/core/module-world-model.js +++ b/modules/core/module-world-model.js @@ -203,6 +203,11 @@ class WorldModelModule { const entries = fs.ls(path); if (!entries) return; for (const e of entries) { + // /sys is synthesized by ls() on demand and has no node behind it. Walking into it + // counted a synthetic subtree (114 dirs / 146 files in a store that holds 43 files), + // which is the "the counts disagree" report: two different populations were both + // printed as "files". + if (e._virtual) continue; if (e.type === 'file') fileCount++; else { dirCount++; walk(path === '/' ? '/' + e.name : path + '/' + e.name); } } -- cgit v1.2.3