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: relaunch MTPLX with exactly the tuning asked for, not that plus the last one

[._.]/ Adam Eivy715e8e2f8136
diff --git a/server/services/localModelAssessments.js b/server/services/localModelAssessments.js
index 6e7a3eb49d..afd093e8e9 100644
--- a/server/services/localModelAssessments.js
+++ b/server/services/localModelAssessments.js
@@ -417,8 +417,8 @@ const LAUNCH_APPLIERS = {
mtplx: {
transport: 'cli',
// Takes the knob set as-is rather than rendered flags: `mtplxServerManager`
- // renders it with the same catalog on the way to the launch line, and needs
- // the ids to merge this tuning onto what the daemon is already running with.
+ // renders it with the same catalog on the way to the launch line, and keeps
+ // the ids so it can report back which tuning the daemon came up under.
apply: ({ launch }) => relaunchMtplxServerWithTuning(launch),
},
};
diff --git a/server/services/mtplxServerManager.js b/server/services/mtplxServerManager.js
index 28398e96c4..3c3b00ac6f 100644
--- a/server/services/mtplxServerManager.js
+++ b/server/services/mtplxServerManager.js
@@ -507,9 +507,15 @@ export async function relaunchMtplxServerWithTuning(tuning = {}) {
}
const previous = status.config;
- // Merged onto what is already on the launch line, not replacing it: a sweep
- // that varies one knob must not silently drop the ones already set.
- const next = { ...previous, tuning: { ...(previous.tuning || {}), ...Object.fromEntries(knobs) } };
+ // REPLACES the tuning on the launch line rather than merging onto it, so the
+ // flags `mtplx serve` runs with are exactly the knob set the caller named —
+ // and the assessment's `tuningKey`/`tuningLabel`, which describe only that
+ // set, describe the whole configuration. Merging would leave the second run
+ // of a sweep carrying the first run's flags while labelled with only its own,
+ // which makes `compareTunings` rank two readings that were not what they say.
+ // Replacing is exact here because an absent `mtplx serve` flag IS the daemon
+ // default — the same sentinel contract `lib/localModelTuning.js` documents.
+ const next = { ...previous, tuning: Object.fromEntries(knobs) };
const port = next.port ?? DEFAULT_PORT;
console.log(`🚄 MTPLX: relaunching to apply tuning (${knobs.map(([k, v]) => `${k}=${v}`).join(', ')})`);
diff --git a/server/services/mtplxServerManager.test.js b/server/services/mtplxServerManager.test.js
index bda137014c..36a8cb31f5 100644
--- a/server/services/mtplxServerManager.test.js
+++ b/server/services/mtplxServerManager.test.js
@@ -254,11 +254,19 @@ describe('mtplxServerManager', () => {
expect(launch[launch.indexOf('--context-window') + 1]).toBe('32768');
});
- it('merges onto the tuning already on the launch line rather than replacing it', async () => {
+ // The reading is labelled with the knob set the caller named, and nothing
+ // else. Merging the previous run's flags in would launch a configuration
+ // the record does not describe — and `compareTunings` would then rank two
+ // readings against each other on labels neither one actually ran under.
+ it('launches exactly the tuning it was given, not that plus the last one', async () => {
await startMtplxServer({ tuning: { depth: 4 } });
answerOnceRunning();
const result = await relaunchMtplxServerWithTuning({ kvQuant: 'q8' });
- expect(result.config.tuning).toEqual({ depth: 4, kvQuant: 'q8' });
+
+ expect(result.config.tuning).toEqual({ kvQuant: 'q8' });
+ const launch = execPm2Calls.filter((a) => a[0] === 'start').pop();
+ expect(launch).not.toContain('--depth');
+ expect(launch[launch.indexOf('--kv-quant') + 1]).toBe('q8');
});
// A sweep EXPECTS launch lines that do not work. Leaving the daemon down