Skip to content

an open-source alternative to the dots, bots and muses of the world, run an office of claude code/codex like agents on your laptop, sandboxes or anywhere, uses your existing subscriptions

fix(hive): point Crush config env at agent dir

liumingyao.marvin9fb1395254b7
diff --git a/src/main/hive.ts b/src/main/hive.ts
index ce5cd937..88b3c476 100644
--- a/src/main/hive.ts
+++ b/src/main/hive.ts
@@ -740,7 +740,7 @@ export class HiveManager {
// proxy's real target. Per-agent CRUSH_GLOBAL_DATA isolates session
// state from the user's global ~/.config/crush.
const crush = this.installCrushConfig(dir, loopback, desc.api);
- env.CRUSH_GLOBAL_CONFIG = crush.config;
+ env.CRUSH_GLOBAL_CONFIG = dir;
env.CRUSH_GLOBAL_DATA = crush.data;
} else {
env[desc.baseUrlEnv] = loopback;
diff --git a/test/crush-provider-config.test.cjs b/test/crush-provider-config.test.cjs
new file mode 100644
index 00000000..fb318a36
--- /dev/null
+++ b/test/crush-provider-config.test.cjs
@@ -0,0 +1,35 @@
+'use strict';
+
+const test = require('node:test');
+const assert = require('node:assert/strict');
+const fs = require('node:fs');
+const os = require('node:os');
+const path = require('node:path');
+const loadTs = require('./load-ts.cjs');
+
+const { HiveManager } = loadTs('src/main/hive.ts');
+
+function tmpHome() {
+ return fs.mkdtempSync(path.join(os.tmpdir(), 'md-crush-config-'));
+}
+
+test('crush provider points CRUSH_GLOBAL_CONFIG at the agent directory', async (t) => {
+ const home = tmpHome();
+ t.after(() => fs.rmSync(home, { recursive: true, force: true }));
+
+ const hive = new HiveManager(() => home);
+ const injection = await hive.ensureAgent({
+ id: 'crush-1',
+ name: 'Crush Worker',
+ provider: 'crush',
+ cwd: home
+ });
+
+ const agentDir = path.join(home, 'hive', 'agents', 'crush-1');
+ assert.equal(injection.env.CRUSH_GLOBAL_CONFIG, agentDir);
+ assert.equal(injection.env.CRUSH_GLOBAL_DATA, path.join(agentDir, '.crush-data'));
+
+ const configPath = path.join(agentDir, 'crush.json');
+ const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
+ assert.equal(config.providers.openai.base_url.startsWith('http://127.0.0.1:'), true);
+});