The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
fix(core): wake the Swarm service from its host journal at a start (#1587)
0xken15d89c1c400a6a
diff --git a/cli/src/core/experiments.spec.ts b/cli/src/core/experiments.spec.tsindex 450e5a1a0..10c87a8b1 100644--- a/cli/src/core/experiments.spec.ts+++ b/cli/src/core/experiments.spec.ts@@ -26,6 +26,17 @@ describe('the experiments on as the core starts', () => {expect(stateIsThere(dataDir, [])).toBe(false)})+ it('finds a file by a prefix and a suffix, as the Swarm host journal is named', () => {+ const journal = ['super-tabs/host-*.json']+ expect(stateIsThere(dataDir, journal)).toBe(false)+ mkdirSync(join(dataDir, 'super-tabs'))+ // Its other files in the folder are not a host.+ for (const name of ['native-m1.json', 'host-m1.txt', 'retained.json']) writeFileSync(join(dataDir, 'super-tabs', name), '{}')+ expect(stateIsThere(dataDir, journal)).toBe(false)+ writeFileSync(join(dataDir, 'super-tabs', `host-${'a'.repeat(32)}.json`), '{}')+ expect(stateIsThere(dataDir, journal)).toBe(true)+ })+it('asks for each experiment in its own process that has saved state, and for no other', () => {mkdirSync(join(dataDir, 'orchestrator'))writeFileSync(join(dataDir, 'orchestrator', 'p.json'), '{}')diff --git a/cli/src/core/experiments.ts b/cli/src/core/experiments.tsindex 35cd66797..dbd0a1158 100644--- a/cli/src/core/experiments.ts+++ b/cli/src/core/experiments.ts@@ -16,14 +16,19 @@ import type { BackendNotice } from './api.js'type Experiments = Readonly<Record<string, { state: readonly string[] }>>-/** Whether any of `state` is in `dataDir`: a path under it, or `dir/*.ext` for a file of that kind in that folder. */+/** Whether any of `state` is in `dataDir`: a path under it, or `dir/prefix*suffix` for a file of that kind in that folder.+ * The star was only read after a slash, so `super-tabs/host-*.json` was looked up as that literal file name and never+ * found: a machine contributed to a Swarm never woke the Swarm service at a start, and after the master re-executed+ * (every update) it stayed off until some request started it (remote-deepseek, 3 hours offline, 2026-10-22). */export function stateIsThere(dataDir: string, state: readonly string[]): boolean {return state.some((entry) => {- const star = entry.lastIndexOf('/*')+ const slash = entry.lastIndexOf('/')+ const star = entry.indexOf('*', slash + 1)if (star < 0) return existsSync(join(dataDir, entry))- const suffix = entry.slice(star + 2)+ const prefix = entry.slice(slash + 1, star)+ const suffix = entry.slice(star + 1)try {- return readdirSync(join(dataDir, entry.slice(0, star))).some((name) => name.endsWith(suffix))+ return readdirSync(join(dataDir, entry.slice(0, slash))).some((name) => name.startsWith(prefix) && name.endsWith(suffix))} catch {return false}