🌊 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
TypeScript agentic-aiagentic-frameworkagentic-workflowagentsai-agentsai-assistantai-skillsautonomous-agentsclaudecodexdsh-pluginharnessmcp-servermulti-agentmulti-agent-systemsnpmskillsswarmswarm-intelligencetypescript
fix(config): commit cached updates after successful writes
Rudy Celekli676b6b9eb060
diff --git a/tests/config-write-rollback.test.mjs b/tests/config-write-rollback.test.mjsnew file mode 100644index 0000000000..976e5a9ae7--- /dev/null+++ b/tests/config-write-rollback.test.mjs@@ -0,0 +1,16 @@+import test from 'node:test';+import assert from 'node:assert/strict';+import { mkdtempSync, writeFileSync, rmSync, mkdirSync, readFileSync } from 'node:fs';+import { join } from 'node:path';+import { tmpdir } from 'node:os';+import { ConfigFileManager } from '../v3/@claude-flow/cli/src/services/config-file-manager.ts';+test('failed atomic replacement leaves cached configuration unchanged', () => {+ const root = mkdtempSync(join(tmpdir(), 'config-rollback-')); const file = join(root, 'claude-flow.config.json');+ try {+ writeFileSync(file, JSON.stringify({ agents: { maxConcurrent: 2 } })); const m = new ConfigFileManager(); m.load(root);+ rmSync(file); mkdirSync(file);+ assert.throws(() => m.set(root, 'agents.maxConcurrent', 9));+ assert.equal(m.get(root, 'agents.maxConcurrent'), 2);+ rmSync(file, { recursive: true }); m.set(root, 'agents.maxConcurrent', 3); assert.equal(JSON.parse(readFileSync(file, 'utf8')).agents.maxConcurrent, 3);+ } finally { rmSync(root, { recursive: true, force: true }); }+});diff --git a/v3/@claude-flow/cli/src/services/config-file-manager.ts b/v3/@claude-flow/cli/src/services/config-file-manager.tsindex 4e5f4d84e9..9360e64306 100644--- a/v3/@claude-flow/cli/src/services/config-file-manager.ts+++ b/v3/@claude-flow/cli/src/services/config-file-manager.ts@@ -131,15 +131,15 @@ export class ConfigFileManager {this.selectProject(cwd);// A targeted update must not persist unrelated defaults (notably the// default memory path, which would relocate an existing memory store).- const config = this.config ?? this.load(cwd) ?? {};+ const config = structuredClone(this.config ?? this.load(cwd) ?? {});if (Object.hasOwn(config, key)) {config[key] = value;} else {setNestedValue(config, key, value);}- this.config = config;const targetPath = this.configPath ?? path.resolve(cwd, CONFIG_FILENAMES[0]);this.writeAtomic(targetPath, config);+ this.config = config;this.configPath = targetPath;}