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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: refuse an MTPLX tuning relaunch when the launch line names no checkpoint
[._.]/ Adam Eivy1db1263f70fa
diff --git a/server/services/mtplxServerManager.js b/server/services/mtplxServerManager.jsindex 024e11b0fd..28398e96c4 100644--- a/server/services/mtplxServerManager.js+++ b/server/services/mtplxServerManager.js@@ -456,11 +456,16 @@ export async function stopMtplxServer() {* two refusals, same restore-on-failure — because the assessment runner treats* every runtime's applier identically.*- * It refuses rather than guesses in the two cases where it cannot know what to+ * It refuses rather than guesses in the three cases where it cannot know what to* relaunch:* - nothing is running, so there is no checkpoint to reuse;* - something IS listening but PortOS did not start it, so stopping it would- * kill a process the user owns.+ * kill a process the user owns;+ * - the launch line names no `--model`, so the running server is on MTPLX's+ * own hard-coded default. Restarting with `model: null` sends the request+ * back through `resolveStartModel`, which now picks from the cache — a+ * DIFFERENT checkpoint from the one being measured, filed under the model+ * id of the one that was.** Every one of those returns `{ applied: false, reason }` instead of throwing:* the caller can still measure whatever is actually serving and record that the@@ -493,8 +498,15 @@ export async function relaunchMtplxServerWithTuning(tuning = {}) {config: status.config || null,};}+ if (!status.config?.model) {+ return {+ applied: false,+ reason: 'MTPLX is serving its own default checkpoint, which PortOS cannot name — restart it on a chosen checkpoint from the LLMs page to let PortOS apply tuning',+ config: status.config || null,+ };+ }- const previous = status.config || { port: status.port, model: null, 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) } };diff --git a/server/services/mtplxServerManager.test.js b/server/services/mtplxServerManager.test.jsindex 32f0c50150..bda137014c 100644--- a/server/services/mtplxServerManager.test.js+++ b/server/services/mtplxServerManager.test.js@@ -309,6 +309,25 @@ describe('mtplxServerManager', () => {expect(execPm2Calls.some((a) => a[0] === 'start')).toBe(false);});+ // `model: null` means the running server is on MTPLX's OWN hard-coded+ // default. Restarting with null re-runs the cache resolution, which picks a+ // checkpoint — so the relaunch would serve a different model than the one+ // being measured, and file the reading under the wrong one.+ it('refuses when the launch line names no checkpoint it could reproduce', async () => {+ vi.spyOn(mtplxModels, 'listMtplxCachedModels').mockResolvedValue({ models: null, error: 'mtplx models timed out' });+ await startMtplxServer();+ answerOnceRunning();+ execPm2Calls.length = 0;++ const result = await relaunchMtplxServerWithTuning({ depth: 3 });+ expect(result.applied).toBe(false);+ expect(result.reason).toMatch(/own default checkpoint/);+ // Refused BEFORE stopping it — the server the user has is left alone.+ expect(execPm2Calls.map(([verb]) => verb)).not.toContain('delete');+ expect(execPm2Calls.map(([verb]) => verb)).not.toContain('start');+ expect(pm2State?.status).toBe('online');+ });+it('will not stop a server PortOS did not start', async () => {vi.spyOn(openAiModelsProbe, 'probeOpenAiModels').mockResolvedValue({ reachable: true });const result = await relaunchMtplxServerWithTuning({ depth: 3 });