Skip to content

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.

Models: an unreadable grid status never blocks a Start

bitcoinbuilderaa556185936a
diff --git a/cli/src/lib/localModels.integration.spec.ts b/cli/src/lib/localModels.integration.spec.ts
index f6b7bb60e..fe050a41b 100644
--- a/cli/src/lib/localModels.integration.spec.ts
+++ b/cli/src/lib/localModels.integration.spec.ts
@@ -54,6 +54,7 @@ else if (args[0] === 'pull') { mkdirSync(join(home, 'models'), { recursive: true
else if (args[0] === 'engine') { mkdirSync(join(home, 'bin'), { recursive: true }); writeFileSync(join(home, 'bin', 'llama-server'), '#!/bin/sh\\nexit 0\\n', { mode: 0o700 }); }
else if (args.includes('join')) { if (!existsSync(registered)) process.exit(1); mkdirSync(recordDir, { recursive: true }); writeFileSync(record, JSON.stringify({ node_id: 'fixture-node', engines: [{ models: ['tiny.gguf'] }] })); writeFileSync(join(recordDir, 'remote.heartbeat'), ''); }
else if (args.includes('leave')) { rmSync(record); rmSync(registered); }
+else if (args.includes('info') && args.includes('--json')) result({ grid: 'home', status: 'running' });
else if (args.includes('info')) console.log("export OPENAI_BASE_URL='${base}/v1'\\nexport OPENAI_API_KEY='inference-fixture'");
else process.exitCode = 2;
`, { mode: 0o700 })
diff --git a/cli/src/lib/localModels.spec.ts b/cli/src/lib/localModels.spec.ts
index 4d25a1968..111fcda90 100644
--- a/cli/src/lib/localModels.spec.ts
+++ b/cli/src/lib/localModels.spec.ts
@@ -437,6 +437,15 @@ describe('local model discovery and lifecycle', () => {
expect((await service.list('home', true)).models[0].state).toBe('running')
})
+ it('an unreadable grid status blocks nothing: the start goes on to the join', async () => {
+ // A Grid too old to answer `info --json` joined fine before this read existed.
+ const original = run.getMockImplementation()!
+ run.mockImplementation(async (args, output) => args.includes('info') && args.includes('--json') ? refused('usage') : original(args, output))
+ await service.act('home', 'org/Small-GGUF', 'start'); await service.settled()
+ expect(calls.some(args => args[1] === 'start')).toBe(false)
+ expect((await service.list('home', true)).models[0]).toMatchObject({ state: 'running', operation: { phase: 'done' } })
+ })
+
it('a grid that will not come up fails the Start in words, before any join', async () => {
gridState = 'stopped'
const original = run.getMockImplementation()!
diff --git a/cli/src/lib/localModels.ts b/cli/src/lib/localModels.ts
index 34a105bb6..8291f4694 100644
--- a/cli/src/lib/localModels.ts
+++ b/cli/src/lib/localModels.ts
@@ -443,9 +443,10 @@ export class LocalModels {
await change('starting')
// A grid that is down refuses a join outright ("The model could not start"), and `sync`
// above restores its registration, not its process. Bring it up the way its own refusal
- // says to. A grid already running is left alone: `start` is only for one that is not.
- const status = await this.gridStatus(grid).catch(() => { throw new ModelError('Your grid could not be checked. Try again.') })
- if (DOWN.has(status)) await must(['--remote', 'start', grid], 'Your grid could not start. Try again.')
+ // says to. A grid already running is left alone: `start` is only for one that is not. An
+ // unreadable status blocks nothing — it is the join's refusal, not this read, that says a
+ // grid cannot take the model, and a Grid too old to answer `info --json` joined fine before.
+ if (DOWN.has(await this.gridStatus(grid).catch(() => ''))) await must(['--remote', 'start', grid], 'Your grid could not start. Try again.')
const override = this.processEnv.LLAMA_SERVER
const installed = override ? binaryOnPath(override, this.processEnv)
: binaryOnPath(join(this.home, 'bin', 'llama-server'), this.processEnv) || binaryOnPath('llama-server', this.processEnv)