fix(#492): manifest effort.agent_overrides and effort.default now fall back correctly

Steps 2 and 4 of resolveEffortInternal now include an else branch that
consults CANONICAL_CONFIG_DEFAULTS.effort when effortCfg is null, mirroring
the existing Step 3 manifest-fallback pattern for routing_tier_defaults.

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Tom Boucher
2026-06-01 09:52:39 -04:00
committed by GitHub
parent 78871a7371
commit ef436aae62
3 changed files with 64 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
---
type: Fixed
pr: 577
---
effort.agent_overrides and effort.default in config-defaults.manifest.json now fall back correctly when no project-level effort config exists

View File

@@ -1855,6 +1855,12 @@ function resolveEffortInternal(cwd, agentType, opts) {
const v = ao[agentType];
if (typeof v === 'string' && EFFORT_SET.has(v)) return v;
}
} else {
const mao = CANONICAL_CONFIG_DEFAULTS.effort && CANONICAL_CONFIG_DEFAULTS.effort.agent_overrides;
if (mao && typeof mao === 'object' && !Array.isArray(mao)) {
const v = mao[agentType];
if (typeof v === 'string' && EFFORT_SET.has(v)) return v;
}
}
// Step 3: routing_tier_defaults by agent's default tier.
@@ -1886,6 +1892,9 @@ function resolveEffortInternal(cwd, agentType, opts) {
if (effortCfg) {
const d = effortCfg.default;
if (typeof d === 'string' && EFFORT_SET.has(d)) return d;
} else {
const d = CANONICAL_CONFIG_DEFAULTS.effort && CANONICAL_CONFIG_DEFAULTS.effort.default;
if (typeof d === 'string' && EFFORT_SET.has(d)) return d;
}
// Step 5: hardcoded default

View File

@@ -0,0 +1,50 @@
'use strict';
process.env.GSD_TEST_MODE = "1";
const { describe, test, beforeEach, afterEach } = require("node:test");
const assert = require("node:assert/strict");
const path = require("path");
const { createTempProject, cleanup } = require("./helpers.cjs");
const { resolveEffortInternal, CONFIG_DEFAULTS } = require("../get-shit-done/bin/lib/core.cjs");
const { CONFIG_DEFAULTS: CANONICAL_CONFIG_DEFAULTS } = require("../get-shit-done/bin/lib/configuration.cjs");
describe("#492 manifest effort fallback", () => {
let tmpDir;
beforeEach(() => { tmpDir = createTempProject(); });
afterEach(() => { cleanup(tmpDir); });
test("routing_tier_defaults manifest fallback still works", () => {
assert.strictEqual(resolveEffortInternal(tmpDir, "gsd-planner"), "xhigh");
});
test("manifest effort.agent_overrides wins over routing_tier_defaults when no project config", () => {
const original = CANONICAL_CONFIG_DEFAULTS.effort.agent_overrides;
try {
CANONICAL_CONFIG_DEFAULTS.effort.agent_overrides = { "gsd-planner": "max" };
assert.strictEqual(resolveEffortInternal(tmpDir, "gsd-planner"), "max");
} finally {
CANONICAL_CONFIG_DEFAULTS.effort.agent_overrides = original;
}
});
test("manifest effort.default consulted for unknown agent with no project config", () => {
const original = CANONICAL_CONFIG_DEFAULTS.effort.default;
try {
CANONICAL_CONFIG_DEFAULTS.effort.default = "max";
assert.strictEqual(resolveEffortInternal(tmpDir, "fictional-agent-xyz-492"), "max");
} finally {
CANONICAL_CONFIG_DEFAULTS.effort.default = original;
}
});
test("manifest agent_overrides takes precedence over manifest routing_tier_defaults", () => {
const originalAgentOverrides = CANONICAL_CONFIG_DEFAULTS.effort.agent_overrides;
try {
CANONICAL_CONFIG_DEFAULTS.effort.agent_overrides = { "gsd-planner": "minimal" };
assert.strictEqual(resolveEffortInternal(tmpDir, "gsd-planner"), "minimal");
} finally {
CANONICAL_CONFIG_DEFAULTS.effort.agent_overrides = originalAgentOverrides;
}
});
});