Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: honor the saved Reactor Python runtime override

[._.]/ Adam Eivyc2dd03866fdc
diff --git a/server/services/videoGen/reactorRuntime.js b/server/services/videoGen/reactorRuntime.js
index 9a2f6846d6..56ea92b884 100644
--- a/server/services/videoGen/reactorRuntime.js
+++ b/server/services/videoGen/reactorRuntime.js
@@ -4,6 +4,7 @@ import { readFile } from 'node:fs/promises';
import { join } from 'node:path';
import { execFile } from '../../lib/childProcess.js';
import { PATHS } from '../../lib/fileUtils.js';
+import { readPortosEnvValue } from '../../lib/portosEnv.js';
import { REACTOR_SETUP_ERRORS } from '../../../scripts/lib/reactorSetupErrors.js';
const execute = promisify(execFile);
@@ -14,7 +15,7 @@ export async function ensureReactorRuntime() {
const requirements = await readFile(join(PATHS.root, 'scripts', 'requirements-reactor.txt'), 'utf8');
const expected = requirements.match(/^reactor-sdk==([0-9.]+)\r?$/m)?.[1];
if (!expected) throw new Error('Reactor SDK version pin is missing');
- const override = process.env.REACTOR_PYTHON_PATH;
+ const override = process.env.REACTOR_PYTHON_PATH || readPortosEnvValue('REACTOR_PYTHON_PATH');
const python = override || join(PATHS.data, 'venvs', 'reactor', process.platform === 'win32' ? 'Scripts/python.exe' : 'bin/python');
if (override) {
// Preserve custom environments; never install into an operator-owned path.
diff --git a/server/services/videoGen/reactorRuntime.test.js b/server/services/videoGen/reactorRuntime.test.js
index fcb82ac48e..7eede88c96 100644
--- a/server/services/videoGen/reactorRuntime.test.js
+++ b/server/services/videoGen/reactorRuntime.test.js
@@ -1,13 +1,15 @@
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import { join } from 'node:path';
-const mocks = vi.hoisted(() => ({ execFile: vi.fn() }));
+const mocks = vi.hoisted(() => ({ execFile: vi.fn(), readPortosEnvValue: vi.fn(() => null) }));
vi.mock('node:fs/promises', () => ({ readFile: vi.fn(async () => 'reactor-sdk==1.0.1\r\n') }));
+vi.mock('../../lib/portosEnv.js', () => ({ readPortosEnvValue: mocks.readPortosEnvValue }));
vi.mock('../../lib/childProcess.js', () => ({ execFile: mocks.execFile }));
vi.mock('../../lib/fileUtils.js', () => ({ PATHS: { root: '/example/app', data: '/example/data' } }));
let ensureReactorRuntime;
beforeEach(async () => {
vi.resetModules();
vi.clearAllMocks();
+ mocks.readPortosEnvValue.mockReturnValue(null);
vi.stubEnv('REACTOR_PYTHON_PATH', '');
({ ensureReactorRuntime } = await import('./reactorRuntime.js'));
});
@@ -45,6 +47,15 @@ describe('automatic Reactor runtime preparation', () => {
await expect(ensureReactorRuntime()).resolves.toBeTruthy();
});
+ it('uses a durable runtime override with exported environment taking precedence', async () => {
+ mocks.readPortosEnvValue.mockReturnValue('/example/saved/python');
+ mocks.execFile.mockImplementation(reply());
+ expect(await ensureReactorRuntime()).toBe('/example/saved/python');
+ vi.stubEnv('REACTOR_PYTHON_PATH', '/example/current/python');
+ expect(await ensureReactorRuntime()).toBe('/example/current/python');
+ expect(mocks.execFile.mock.calls.map(([file]) => file)).toEqual(['/example/saved/python', '/example/current/python']);
+ });
+
it('refuses an incompatible custom environment without modifying it', async () => {
vi.stubEnv('REACTOR_PYTHON_PATH', '/example/custom/python');
mocks.execFile.mockImplementation(reply(new Error('incompatible')));