Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated

fix(console): the agentdb mod status file must be a regular file too (ADR-450 T2)

ruved0888b4f80d
diff --git a/plugins/ruflo-console/hooks/data/files.ts b/plugins/ruflo-console/hooks/data/files.ts
index 3e6cc6674f..f2cc42e1b2 100644
--- a/plugins/ruflo-console/hooks/data/files.ts
+++ b/plugins/ruflo-console/hooks/data/files.ts
@@ -128,7 +128,8 @@ export async function readDisk(fs: ReaderFs, cache: ReadCache, cwd: string, home
const homeKeys = Object.keys(HOME) as (keyof typeof HOME)[]
const missingHome: Read = { text: null, reason: 'missing' }
const [projectReads, homeReads, federationNodes, hasNostrKey] = await Promise.all([
- Promise.all(projectKeys.map(key => readBounded(fs, cache, under(cwd, PROJECT[key])))),
+ // ADR-450 T2: the one mod status file read here must be a regular file, like the per-plugin ones in readMods.
+ Promise.all(projectKeys.map(key => readBounded(fs, cache, under(cwd, PROJECT[key]), READ_MAX, key === 'agentdbMod'))),
Promise.all(homeKeys.map(key => (configDir === null ? Promise.resolve(missingHome) : readBounded(fs, cache, under(configDir, HOME[key]))))),
fs
.list(under(cwd, FEDERATION_DIR))
diff --git a/plugins/ruflo-console/tests/mods-section.spec.ts b/plugins/ruflo-console/tests/mods-section.spec.ts
index d20a9e440d..a74a8dbde7 100644
--- a/plugins/ruflo-console/tests/mods-section.spec.ts
+++ b/plugins/ruflo-console/tests/mods-section.spec.ts
@@ -4,7 +4,7 @@
*/
import { describe, expect, it } from 'vitest'
-import type { ReaderFs } from '../hooks/data/files'
+import { readDisk, type ReaderFs } from '../hooks/data/files'
import { newState } from '../hooks/state'
import { readSnapshot } from '../hooks/data/snapshot'
import type { Actions } from '../hooks/views/common'
@@ -105,6 +105,40 @@ describe('readMods, a status.json that is not a regular file (ADR-450 T2)', () =
})
})
+describe('readDisk, the agentdb mod status file (ADR-450 T2)', () => {
+ const FILE = '/p/.claude-flow/agentdb-mod/status.json'
+ const disk = (stat: { kind?: string; isLink?: boolean }) => {
+ const reads: string[] = []
+ const fs = {
+ stat: async (path: string) => (path === FILE ? { mtimeMs: 1, size: 20, ...stat } : undefined),
+ read: async (path: string) => { reads.push(path); return '{"version":1}' },
+ list: async () => [],
+ }
+
+ return { fs, reads }
+ }
+
+ it('never reads it when it is a link, a FIFO or a folder', async () => {
+ for (const stat of [{ kind: 'file', isLink: true }, { kind: 'other' }, { kind: 'dir' }]) {
+ const { fs, reads } = disk(stat)
+ const read = await readDisk(fs as never, new Map(), '/p', null)
+
+ expect(reads).not.toContain(FILE)
+ expect(read.project.agentdbMod).toMatchObject({ text: null })
+ }
+ })
+
+ it('reads a regular file, and a file whose kind the engine does not report', async () => {
+ for (const stat of [{ kind: 'file', isLink: false }, {}]) {
+ const { fs, reads } = disk(stat)
+
+ await readDisk(fs as never, new Map(), '/p', null)
+
+ expect(reads).toContain(FILE)
+ }
+ })
+})
+
describe('readMods', () => {
it('reads only *-mod folders and skips a folder with no status file', async () => {
const fs = fakeFs({ 'docs-mod': status({ blocked: 2 }), 'sparc-mod': status(), 'agentdb': status(), 'quiet-mod': null, 'Bad-Mod': status(), '..-mod': status() }, ['loose-mod'])