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: honor provider effort defaults for unpinned agents (#7932)
[._.]/ Adam Eivya7a81539db57
diff --git a/server/lib/agentRegistrationRecord.js b/server/lib/agentRegistrationRecord.jsindex ef20a502c4..1be6a94760 100644--- a/server/lib/agentRegistrationRecord.js+++ b/server/lib/agentRegistrationRecord.js@@ -54,6 +54,7 @@ export function buildAgentRegistration({prOpenedBy,claimFlowTask,selectedModel,+ effort = null,modelSelection,runId,dispatchUseRunner,@@ -152,11 +153,10 @@ export function buildAgentRegistration({// straight through instead of correcting it.prOpenedBy,model: selectedModel,- // The reasoning-effort override this run was dispatched with (null when the- // task pinned none). Persisted next to the model because the Resume Agent- // modal seeds its own effort select from here — without it a resume of an- // effort-pinned run silently drops back to the provider default.- effort: task.metadata?.effort || null,+ // The resolved run effort, including an inherited provider default and any+ // capability suppression. Resume and the run card must describe the same+ // setting handed to the launch builders.+ effort,modelTier: modelSelection.tier,modelReason: modelSelection.reason,runId,diff --git a/server/lib/taskGenerationOverrides.js b/server/lib/taskGenerationOverrides.jsindex dff320d144..bb03a21a91 100644--- a/server/lib/taskGenerationOverrides.js+++ b/server/lib/taskGenerationOverrides.js@@ -25,7 +25,7 @@ const MAX_TEMPERATURE = 2;** An empty temperature field is treated as absent, not as 0 — `Number('')` is* 0, which would silently pin greedy decoding on a task whose author only- * cleared the box.+ * cleared the box. A blank effort also inherits the provider's saved default.*/export function applyTaskGenerationOverrides(provider, metadata) {const temperature = metadata?.temperature === '' ? NaN : Number(metadata?.temperature);@@ -36,6 +36,8 @@ export function applyTaskGenerationOverrides(provider, metadata) {? { temperature }: {}),...(THINKING_VALUES.includes(thinking) ? { thinking } : {}),- ...(typeof metadata?.effort === 'string' ? { effort: metadata.effort } : {}),+ ...(typeof metadata?.effort === 'string' && metadata.effort.trim()+ ? { effort: metadata.effort.trim() }+ : {}),};}diff --git a/server/services/agentLifecycle.js b/server/services/agentLifecycle.jsindex 8e3cf1f704..48c50fa42a 100644--- a/server/services/agentLifecycle.js+++ b/server/services/agentLifecycle.js@@ -700,6 +700,23 @@ async function runAgentSpawn(task) {: resolveRepoForgeTarget(workspacePath),sourceWorkspace ? capturePrimaryCheckoutState(sourceWorkspace) : null,]);+ // Task-level OpenCode/Ollama generation controls override provider defaults+ // for this one run. The child-environment composer turns these into the+ // dynamic `agent.build` config instead of mutating saved provider state.+ const requestedProvider = applyTaskGenerationOverrides(provider, task.metadata);+ // Ollama 400s the whole request when a model that never implements thinking+ // is asked to think, so a non-reasoning local model dispatched at any effort+ // level dies on its first turn with exit 1 and no output. Resolved here,+ // once, on the provider EVERY spawn path shares — so the two carriers of the+ // level (the `--effort` argv and OpenCode's `agent.*.reasoningEffort` config)+ // drop it together. Resolve task-over-provider defaults before recording the+ // run so the registered effort and every launch path use the same value.+ // The argv builders no-op it for providers without an effort control.+ const { provider: runProvider, effort: taskEffort } = await dropUnsupportedOllamaThinking(+ requestedProvider,+ selectedModel,+ requestedProvider.effort || null,+ );await registerAgent(agentId, task.id, buildAgentRegistration({task,provider,@@ -720,6 +737,7 @@ async function runAgentSpawn(task) {prOpenedBy,claimFlowTask,selectedModel,+ effort: taskEffort,modelSelection,runId,dispatchUseRunner,@@ -789,23 +807,6 @@ async function runAgentSpawn(task) {const cliSettingsEnv = !publicReview && isClaudeCliProvider(provider)? await getClaudeSettingsEnv(): {};- // Task-level OpenCode/Ollama generation controls override provider defaults- // for this one run. The child-environment composer turns these into the- // dynamic `agent.build` config instead of mutating saved provider state.- const requestedProvider = applyTaskGenerationOverrides(provider, task.metadata);- // Ollama 400s the whole request when a model that never implements thinking- // is asked to think, so a non-reasoning local model dispatched at any effort- // level dies on its first turn with exit 1 and no output. Resolved here,- // once, on the provider EVERY spawn path shares — so the two carriers of the- // level (the `--effort` argv and OpenCode's `agent.*.reasoningEffort` config)- // drop it together. `taskEffort` is the per-task reasoning-effort override- // (task form / schedule config); the builders no-op it for providers without- // an effort control.- const { provider: runProvider, effort: taskEffort } = await dropUnsupportedOllamaThinking(- requestedProvider,- selectedModel,- task.metadata?.effort || null,- );// Codex counts the root orchestrator against its per-session thread cap.// Lift that cap to root + configured workers for cloud swarms so a six-way// claim run can actually fan out six issue agents. Never lift it for adiff --git a/server/services/agentLifecycle.postureGate.test.js b/server/services/agentLifecycle.postureGate.test.jsindex ab98515ad1..ab0315b309 100644--- a/server/services/agentLifecycle.postureGate.test.js+++ b/server/services/agentLifecycle.postureGate.test.js@@ -596,3 +596,67 @@ describe('registerAgent branch posture for a claim run', () => {});});});++// Blank picker values inherit provider defaults before capability suppression.+describe('agent launch defaults (#7932)', () => {+ it.each([+ ['CLI default', false, undefined, 'low', 'low'],+ ['TUI default', true, undefined, 'low', 'low'],+ ['blank picker', true, '', 'low', 'low'],+ ['task override', false, 'high', 'low', 'high'],+ ['no configured effort', false, undefined, undefined, null],+ ])('%s reaches argv and recorded run metadata', async (_name, tui, taskEffort, providerEffort, expected) => {+ const { buildTuiSpawnConfig, spawnTuiAgent } = await import('./agentTuiSpawning.js');+ const cli = await vi.importActual('./agentCliSpawning.js');+ const terminal = await vi.importActual('./agentTuiSpawning.js');+ reachDispatch();+ vi.mocked(isTuiProvider).mockReturnValue(tui);+ const builder = tui ? buildTuiSpawnConfig : buildCliSpawnConfig;+ vi.mocked(builder).mockImplementationOnce(tui ? terminal.buildTuiSpawnConfig : cli.buildCliSpawnConfig);+ const provider = { id: 'example-codex', type: tui ? 'tui' : 'cli', command: 'codex', effort: providerEffort };+ vi.mocked(resolveAgentProviderAndModel).mockResolvedValue({+ ok: true, provider, selectedModel: 'gpt-6-astra', modelSelection: {},+ });++ await spawnAgentForTask({+ id: 'task-release-defaults', taskType: 'user',+ metadata: { slashdoCommand: 'release', effort: taskEffort },+ });++ const dispatch = vi.mocked(tui ? spawnTuiAgent : spawnDirectly).mock.calls.at(-1)?.[0];+ expect(dispatch).toBeDefined();+ const args = (tui ? dispatch.tuiConfig : dispatch.cliConfig).args;+ expect(args).toContain('--model');+ expect(args).toContain('gpt-6-astra');+ if (expected) expect(args).toContain(`model_reasoning_effort=${expected}`);+ else expect(args.join(' ')).not.toContain('model_reasoning_effort');+ expect(vi.mocked(registerAgent).mock.calls.at(-1)?.[2]).toMatchObject({ model: 'gpt-6-astra', effort: expected });+ expect(provider.effort).toBe(providerEffort);+ });+ it('suppresses inherited effort for an Ollama model without thinking', async () => {+ const ollama = await import('./ollamaManager.js');+ const capabilities = vi.spyOn(ollama, 'getModelCapabilities').mockResolvedValue(['completion']);+ const baseUrl = vi.spyOn(ollama, 'getBaseUrl').mockReturnValue('http://127.0.0.1:11434');+ try {+ reachDispatch();+ vi.mocked(isTuiProvider).mockReturnValue(false);+ const provider = { id: 'opencode-ollama', type: 'cli', command: 'opencode', ollamaBacked: true,+ endpoint: 'http://127.0.0.1:11434', effort: 'low' };+ vi.mocked(resolveAgentProviderAndModel).mockResolvedValue({+ ok: true, provider, selectedModel: 'gemma3:4b', modelSelection: {},+ });+ await spawnAgentForTask({ id: 'task-no-thinking', metadata: {} });+ expect(capabilities).toHaveBeenCalledWith('gemma3:4b');+ expect(spawnDirectly).toHaveBeenCalledTimes(1);+ const dispatch = vi.mocked(spawnDirectly).mock.calls[0][0];+ expect(dispatch.provider).toMatchObject({ thinking: false });+ expect(dispatch.provider.effort).toBeUndefined();+ expect(vi.mocked(buildCliSpawnConfig).mock.calls.at(-1)?.[3].effort).toBeNull();+ expect(vi.mocked(registerAgent).mock.calls.at(-1)?.[2].effort).toBeNull();+ expect(provider.effort).toBe('low');+ } finally {+ capabilities.mockRestore();+ baseUrl.mockRestore();+ }+ });+});