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 (agy): close the same vLLM hole in the HTTP runner's generation options (#4765)

[._.]/ Adam Eivy1110aa6c2769
diff --git a/server/lib/aiToolkit/internal/generationOptions.js b/server/lib/aiToolkit/internal/generationOptions.js
index c4fa1d9c5d..79040eff2d 100644
--- a/server/lib/aiToolkit/internal/generationOptions.js
+++ b/server/lib/aiToolkit/internal/generationOptions.js
@@ -23,12 +23,20 @@ const finiteNumber = (value, min, max) => {
};
/**
- * @param {{temperature?:unknown, topP?:unknown, thinking?:unknown, llamaBacked?:boolean, mtplxBacked?:boolean}|null|undefined} provider
+ * Every local backend marker belongs in the guard below. A missing one does not
+ * degrade to "no thinking toggle" — it returns `{}` and drops temperature and
+ * top_p with it, which is how the vLLM providers shipped with every generation
+ * control silently discarded on the OpenCode side (#4765).
+ *
+ * @param {{temperature?:unknown, topP?:unknown, thinking?:unknown, llamaBacked?:boolean, mtplxBacked?:boolean, vllmBacked?:boolean}|null|undefined} provider
* @returns {{temperature?:number, top_p?:number, think?:boolean, chat_template_kwargs?:{enable_thinking:boolean}}}
*/
export function apiGenerationOptions(provider) {
const ollama = isOllamaBackedProvider(provider);
- if (!ollama && provider?.llamaBacked !== true && provider?.mtplxBacked !== true) return {};
+ if (!ollama
+ && provider?.llamaBacked !== true
+ && provider?.mtplxBacked !== true
+ && provider?.vllmBacked !== true) return {};
// Ollama API runs have defaulted to 0.6 since this control shipped; the other
// local backends keep their own default until the user pins one.
const temperature = finiteNumber(provider.temperature, 0, 2) ?? (ollama ? 0.6 : undefined);
@@ -36,8 +44,8 @@ export function apiGenerationOptions(provider) {
return {
...(temperature === undefined ? {} : { temperature }),
...(topP === undefined ? {} : { top_p: topP }),
- // Ollama takes its own native `think` boolean; llama.cpp / MTPLX route the
- // toggle through the chat template instead.
+ // Ollama takes its own native `think` boolean; llama.cpp / MTPLX / vLLM
+ // route the toggle through the chat template instead.
...(typeof provider.thinking !== 'boolean'
? {}
: ollama
diff --git a/server/lib/aiToolkit/runner.test.js b/server/lib/aiToolkit/runner.test.js
index 16defe8354..86764add7b 100644
--- a/server/lib/aiToolkit/runner.test.js
+++ b/server/lib/aiToolkit/runner.test.js
@@ -149,6 +149,29 @@ describe('AI Toolkit runner service', () => {
expect(body.think).toBeUndefined();
});
+ it('sends a vLLM endpoint its temperature/top_p and routes thinking through the chat template', async () => {
+ // No vLLM `api` preset ships (the container is reached through the OpenCode
+ // wrappers), but the guard here mirrors `generationControlsFor` on the
+ // client — which now offers the controls — so a hand-built endpoint record
+ // must not be the one place they are silently dropped again (#4765).
+ const dataDir = await mkdtemp(join(tmpdir(), 'ai-toolkit-runner-'));
+ tempDirs.push(dataDir);
+ const fetch = stubStreamingFetch();
+ const runner = createRunnerService({ dataDir, hooks: { ensureProviderReady: async () => ({ success: true }) } });
+ let done;
+ const completed = new Promise((resolve) => { done = resolve; });
+ await runner.executeApiRun({
+ runId: 'run-vllm-options',
+ provider: runReady({ id: 'vllm', endpoint: 'http://127.0.0.1:18020/v1', vllmBacked: true, temperature: 0.7, topP: 0.9, thinking: false }),
+ model: null, prompt: 'hi', workspacePath: process.cwd(), screenshots: [], onData: undefined, onComplete: () => done(),
+ });
+ await completed;
+
+ const body = JSON.parse(fetch.mock.calls[0][1].body);
+ expect(body).toMatchObject({ temperature: 0.7, top_p: 0.9, chat_template_kwargs: { enable_thinking: false } });
+ expect(body.think).toBeUndefined();
+ });
+
it('sends a cloud provider no sampling fields at all', async () => {
// Widening the editor must not start re-shaping hosted models' output.
const dataDir = await mkdtemp(join(tmpdir(), 'ai-toolkit-runner-'));