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

address review (lmstudio): explain the SGLang stop command's missing --profile, and fail loudly on a portless recipe

[._.]/ Adam Eivy01eb6381e043
diff --git a/server/lib/localMemory.js b/server/lib/localMemory.js
index e2ddabcbc2..2a48cb7aae 100644
--- a/server/lib/localMemory.js
+++ b/server/lib/localMemory.js
@@ -58,7 +58,13 @@ export const GPU_BLOCKER_PROBE_TIMEOUT_MS = 1_500;
const vllmBlockerReason = ({ endpoint, projectDir }) =>
`${LOCAL_RUNTIMES.vllm.label} is serving at ${endpoint} and holds nearly all of this GPU's VRAM, so this job would run out of memory partway through its model load. Stop the container with \`docker compose --profile single stop\` in ${projectDir}, then start this job again. PortOS will not stop it for you: nothing would restart it, an agent session attached to it dies with it, and a cold start takes roughly 5–7 minutes.`;
-/** The same refusal for the SGLang container, with its own stop command. */
+/**
+ * The same refusal for the SGLang container. The stop command deliberately has
+ * no `--profile`: the vLLM stack is upstream's compose project, whose services
+ * sit behind a `single` profile, while the SGLang compose file is generated by
+ * `lib/sglangQwenRecipe.js` and declares one unprofiled service. Copying vLLM's
+ * `--profile single` here would print a command that stops nothing.
+ */
const sglangBlockerReason = ({ endpoint, projectDir }) =>
`${LOCAL_RUNTIMES.sglang.label} is serving at ${endpoint} and holds nearly all of this GPU's VRAM, so this job would run out of memory partway through its model load. Stop the container with \`docker compose stop\` in ${projectDir}, then start this job again. PortOS will not stop it for you: nothing would restart it, an agent session attached to it dies with it, and a cold start is measured in minutes.`;
diff --git a/server/lib/sglangQwenRecipe.js b/server/lib/sglangQwenRecipe.js
index 9e9636d389..2fcf5370e9 100644
--- a/server/lib/sglangQwenRecipe.js
+++ b/server/lib/sglangQwenRecipe.js
@@ -329,7 +329,12 @@ const yamlList = (items, indent) => items.map((item) => `${indent}- ${item}`).jo
* @returns {string}
*/
export function sglangComposeYaml(recipe) {
- const port = recipe.flags[recipe.flags.indexOf('--port') + 1];
+ const portIndex = recipe.flags?.indexOf('--port') ?? -1;
+ const port = portIndex === -1 ? null : recipe.flags[portIndex + 1];
+ // Loud rather than silent: without this a hand-built recipe missing `--port`
+ // would render `127.0.0.1:undefined:undefined` into a compose file that fails
+ // much later, with nothing pointing back at the recipe that produced it.
+ if (!port) throw new Error('Recipe has no --port flag, so its published port cannot be derived');
const flags = recipe.flags.map((flag) => JSON.stringify(flag));
return [
'services:',
diff --git a/server/lib/sglangQwenRecipe.test.js b/server/lib/sglangQwenRecipe.test.js
index 5297911def..8c2f5dea77 100644
--- a/server/lib/sglangQwenRecipe.test.js
+++ b/server/lib/sglangQwenRecipe.test.js
@@ -203,6 +203,11 @@ describe('sglangComposeYaml', () => {
expect(yaml).toContain('restart: "no"');
});
+ it('refuses to render a recipe with no --port rather than emitting "undefined"', () => {
+ expect(() => sglangComposeYaml({ ...buildSglangQwenRecipe(), flags: ['--trust-remote-code'] }))
+ .toThrow(/no --port flag/);
+ });
+
it('matches the cookbook docker stanza for shm and IPC', () => {
expect(yaml).toContain('ipc: host');
expect(yaml).toContain('shm_size: "32g"');