Repository navigation
feat: make model profiles runtime-aware for Codex/non-Claude runtimes (closes #2517) - #2609
Conversation
…closes #2517) Adds an optional top-level `runtime` config key plus a `model_profile_overrides[runtime][tier]` map. When `runtime` is set, profile tiers (opus/sonnet/haiku) resolve to runtime-native model IDs (and reasoning_effort where supported) instead of bare Claude aliases. Codex defaults from the spec: opus -> gpt-5.4 reasoning_effort: xhigh sonnet -> gpt-5.3-codex reasoning_effort: medium haiku -> gpt-5.4-mini reasoning_effort: medium Claude defaults mirror MODEL_ALIAS_MAP. Unknown runtimes fall back to the Claude-alias safe default rather than emit IDs the runtime cannot accept. reasoning_effort is only emitted into Codex install paths; never returned from resolveModelInternal and never written to Claude agent frontmatter. Backwards compatible: any user without `runtime` set sees identical behavior — the new branch is gated on `config.runtime != null`. Precedence (highest to lowest): 1. per-agent model_overrides 2. runtime-aware tier resolution (when `runtime` is set) 3. resolve_model_ids: "omit" 4. Claude-native default 5. inherit (literal passthrough) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
📝 WalkthroughWalkthroughImplements runtime-aware model-profile resolution enabling automatic mapping of profile tiers (opus/sonnet/haiku) to runtime-native model IDs and reasoning-effort values. Adds configuration support for runtime selection, per-runtime tier overrides, schema validation, Codex installer integration, and comprehensive documentation. Changes
Sequence DiagramsequenceDiagram
participant User
participant ConfigLoader as Config Loader
participant TierResolver as Tier Resolver
participant ProfileMap as Runtime Profile Map
participant CodexInstaller as Codex Installer
User->>ConfigLoader: Load .planning/config.json + ~/.gsd/defaults.json
ConfigLoader->>ConfigLoader: Merge configs (project precedence)
ConfigLoader->>ConfigLoader: Validate runtime & model_profile_overrides
ConfigLoader->>TierResolver: Get resolved model for agent tier
alt runtime = "codex"
TierResolver->>ProfileMap: Look up tier → Codex model mapping
ProfileMap-->>TierResolver: Return Codex model ID
TierResolver->>TierResolver: Apply model_profile_overrides[codex][tier]
TierResolver-->>CodexInstaller: model ID + reasoning_effort
else runtime = "claude" or absent
TierResolver->>ProfileMap: Use Claude alias (existing behavior)
ProfileMap-->>TierResolver: Claude model alias
TierResolver-->>CodexInstaller: null reasoning_effort
end
CodexInstaller->>CodexInstaller: Generate agent TOML with model & reasoning_effort
CodexInstaller-->>User: Codex config embedded with resolved runtime models
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related issues
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Addresses all 16 findings from the adversarial review of PR #2609. Each finding is enumerated below with its resolution. CRITICAL - F1: readGsdRuntimeProfileResolver(targetDir) now probes per-project .planning/config.json AND ~/.gsd/defaults.json with per-project winning, so the PR's headline claim ("set runtime in project config and Codex TOML emit picks it up") actually holds end-to-end. - F2: resolveTierEntry field-merges user overrides with built-in defaults. The CONFIGURATION.md string-shorthand example `{ codex: { opus: "gpt-5-pro" } }` now keeps reasoning_effort from the built-in entry. Partial-object overrides like `{ opus: { reasoning_effort: 'low' } }` keep the built-in model. Both paths regression-tested. MAJOR - F3: resolveReasoningEffortInternal gates strictly on the RUNTIMES_WITH_REASONING_EFFORT allowlist regardless of override presence. Override + unknown-runtime no longer leaks reasoning_effort. - F4: runtime:"claude" is now a no-op for resolution (it is the implicit default). It no longer hijacks resolve_model_ids:"omit". Existing tests for `runtime:"claude"` returning Claude IDs were rewritten to reflect the no-op semantics; new test asserts the omit case returns "". - F5: _readGsdConfigFile in install.js writes a stderr warning on JSON parse failure instead of silently returning null. Read failure and parse failure are warned separately. Library require is hoisted to top of install.js so it is not co-mingled with config-read failure modes. - F6: install.js requires for core.cjs / model-profiles.cjs are hoisted to the top of the file with __dirname-based absolute paths so global npm install works regardless of cwd. Test asserts both lib paths exist relative to install.js __dirname. - F7: docs/CONFIGURATION.md `runtime` row no longer lists `opencode` as a valid runtime — install-path emission for non-Codex runtimes is explicitly out of scope per #2517 / #2612, and the doc now points at #2612 for the follow-on work. resolveModelInternal still accepts any runtime string (back-compat) and falls back safely for unknown values. - F8: Tests now isolate HOME (and GSD_HOME) to a per-test tmpdir so the developer's real ~/.gsd/defaults.json cannot bleed into assertions. Same pattern CodeRabbit caught on PRs #2603 / #2604. - F9: `runtime` and `model_profile_overrides` documented as flat-only in core.cjs comments — not routed through `get()` because they are top-level keys per docs/CONFIGURATION.md and introducing nested resolution for two new keys was not worth the edge-case surface. - F10/F13: loadConfig now invokes _warnUnknownProfileOverrides on the raw parsed config so direct .planning/config.json edits surface unknown runtime values (e.g. typo `runtime: "codx"`) and unknown tier values (e.g. `model_profile_overrides.codex.banana`) at read time. Warnings only — preserves back-compat for runtimes added later. Per-process warning cache prevents log spam across repeated loadConfig calls. MINOR / NIT - F11: Removed dead `tier || 'sonnet'` defensive shortcut. The local is now `const alias = tier;` with a comment explaining why `tier` is guaranteed truthy at that point (every MODEL_PROFILES entry defines `balanced`, the fallback profile). - F12: Extracted resolveTierEntry() in core.cjs as the single source of truth for runtime-aware tier resolution. core.cjs and bin/install.js both consume it — no duplicated lookup logic between the two files. - F14: Added regression tests for findings #1, #2, #3, #4, #6, #10, #13 in tests/issue-2517-runtime-aware-profiles.test.cjs. Each must-fix path has a corresponding test that fails against the pre-fix code and passes against the post-fix code. - F15: docs/CONFIGURATION.md `model_profile` row cross-references #1713 / #1806 next to the `adaptive` enum value. - F16: RUNTIME_PROFILE_MAP remains in core.cjs as the single source of truth; install.js imports it through the exported resolveTierEntry helper rather than carrying its own copy. Doc files (CONFIGURATION.md, USER-GUIDE.md, settings.md) intentionally still embed the IDs as text — code comment in core.cjs flags that those doc files must be updated whenever the constant changes. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adversarial review — resolution summaryAll 16 findings addressed in 408bfc8. Full suite 5244/5244 passing; PR mergeable.
Notable behavior changes from the review
PR body updateThe PR body's "GSD ships zero provider-specific IDs" framing was inaccurate — softened to "GSD ships built-in defaults that users can override per-runtime, per-tier" with a note that unknown-runtime fallback is the safe Claude alias. Adversarial-review fixes section appended. |
There was a problem hiding this comment.
Actionable comments posted: 4
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
get-shit-done/bin/lib/core.cjs (1)
324-347:⚠️ Potential issue | 🟠 MajorWhitelist
model_profile_overridesin the top-level key check.
loadConfig()now readsparsed.model_profile_overrideson Line 411, butKNOWN_TOP_LEVELnever includes themodel_profile_overridescontainer. That means a valid config like{ "model_profile_overrides": { "codex": { "opus": "gpt-5-pro" }}}still emits the generic “unknown config key(s) … ignored” warning here, which is misleading for the new feature.Suggested fix
const KNOWN_TOP_LEVEL = new Set([ // Extract top-level key names from dot-notation paths (e.g., 'workflow.research' → 'workflow') ...[...VALID_CONFIG_KEYS].map(k => k.split('.')[0]), // Section containers that hold nested sub-keys 'git', 'workflow', 'planning', 'hooks', 'features', // Internal keys loadConfig reads but config-set doesn't expose - 'model_overrides', 'agent_skills', 'context_window', 'resolve_model_ids', 'claude_md_path', + 'model_overrides', 'model_profile_overrides', 'agent_skills', 'context_window', 'resolve_model_ids', 'claude_md_path', // Deprecated keys (still accepted for migration, not in config-set) 'depth', 'multiRepo', ]);🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@get-shit-done/bin/lib/core.cjs` around lines 324 - 347, KNOWN_TOP_LEVEL currently omits the new top-level container model_profile_overrides, causing valid configs to be flagged as unknown; update the KNOWN_TOP_LEVEL set (the Set created where VALID_CONFIG_KEYS is mapped and the additional container names are listed) to include the string 'model_profile_overrides' so that the unknownKeys filter no longer treats that container as unexpected, and keep the existing call to _warnUnknownProfileOverrides(parsed, '.planning/config.json') for finer validation.
🧹 Nitpick comments (2)
tests/core.test.cjs (1)
165-183: Add a regression formodel_profile_overridesspecifically.This loop only exercises exact keys from
VALID_CONFIG_KEYS, so it still won't catch a false “unknown config key(s)” warning on the top-levelmodel_profile_overridesobject. A focused case with a valid payload undermodel_profile_overrides.codex.opuswould keep the new warning path covered.Suggested test shape
+ test('does not warn for valid model_profile_overrides container', (t) => { + writeConfig({ + model_profile_overrides: { + codex: { opus: 'gpt-5-pro' }, + }, + }); + const origWrite = process.stderr.write; + let stderrOutput = ''; + process.stderr.write = (chunk) => { stderrOutput += chunk; }; + t.after(() => { process.stderr.write = origWrite; }); + + loadConfig(tmpDir); + + assert.ok( + !stderrOutput.includes('unknown config key(s)'), + 'valid model_profile_overrides should not trigger unknown-key warning' + ); + });🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/core.test.cjs` around lines 165 - 183, Add a focused regression that writes a config containing a valid model_profile_overrides payload (e.g., { model_profile_overrides: { codex: { opus: { /* valid entries */ } } } }), then call loadConfig(tmpDir) and assert that stderr does not include the "unknown config key(s)" warning for model_profile_overrides; reuse the same stderr capture pattern (overriding process.stderr.write) and the helper writeConfig used in the existing loop to ensure the specific top-level key model_profile_overrides is exercised and doesn't spuriously trigger the unknown-key warning.tests/issue-2517-runtime-aware-profiles.test.cjs (1)
507-562: Add a project-levelmodel_overridesinstaller case.The integration block proves that project
runtime/model_profilereach Codex TOML generation, but it never exercises projectmodel_overrides. That leaves the current precedence regression ininstallCodexConfig()green. A case that pinsgsd-plannerin.planning/config.jsonand asserts the TOML uses that model would close the gap.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/issue-2517-runtime-aware-profiles.test.cjs` around lines 507 - 562, Add a new test in tests/issue-2517-runtime-aware-profiles.test.cjs that exercises project-level model overrides: call writeConfig(tmpDir, { runtime: 'codex', model_profile: 'quality', model_profile_overrides: { codex: { opus: { 'gsd-planner': { model: 'pinned-model' } } } } }); then obtain the resolver via readGsdRuntimeProfileResolver(tmpDir), generate the TOML with generateCodexAgentToml('gsd-planner', '---\nname: gsd-planner\n---\nBody.\n', null, resolver) and assert the generated TOML includes model = "pinned-model" (and optionally that no other precedence sources override it). This verifies installCodexConfig()/generateCodexAgentToml honor per-project model overrides for gsd-planner.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@bin/install.js`:
- Around line 3190-3196: The current code only uses
readGsdGlobalModelOverrides() for modelOverrides, so project-scoped
model_overrides (e.g. model_overrides.gsd-planner) are ignored; update the flow
to first load project-level overrides for the given targetDir (e.g. via a
readGsdProjectModelOverrides(targetDir) or similar helper), merge them with the
global overrides so project values take precedence, and then pass the merged
modelOverrides into generateCodexAgentToml(name, content, modelOverrides,
runtimeResolver); ensure you reference the existing symbols
readGsdGlobalModelOverrides, readGsdRuntimeProfileResolver,
generateCodexAgentToml, modelOverrides and targetDir when locating where to add
the project override read-and-merge logic.
- Around line 1938-1947: The branch in generateCodexAgentToml using
runtimeResolver.resolve(resolvedName) / resolve(agentName) must be gated to only
accept mappings intended for Codex: after retrieving entry (from
runtimeResolver), verify it is a Codex mapping before writing entry.model (e.g.,
check a runtime/type flag on entry such as entry.runtime === 'codex' or validate
entry.model against the known Codex model IDs via a helper like isCodexModelId),
and skip adding model/model_reasoning_effort when the predicate fails; update
generateCodexAgentToml and add a small helper (isCodexModelId or isCodexRuntime)
and reference runtimeResolver, resolvedName, agentName, and entry.model when
implementing the guard.
In `@docs/CONFIGURATION.md`:
- Around line 615-623: The docs example is incorrect: resolveModelInternal()
intentionally skips the runtime-aware branch when runtime === "claude" and will
still return aliases unless resolve_model_ids is enabled; update the
documentation example to either set resolve_model_ids: true or show alias
results (e.g., "opus"/"sonnet"/"haiku") instead of implying full IDs like
"claude-opus-4-6". Locate the example around the Claude section and change the
JSON to include "resolve_model_ids": true if you want full Claude IDs, or adjust
the explanatory text to state that runtime: "claude" alone yields aliases per
resolveModelInternal().
In `@get-shit-done/workflows/settings.md`:
- Around line 66-76: Update the option copy for the model-profile choices
(Quality, Balanced, Budget, Adaptive, Inherit) so it matches the new note:
remove any "Claude only" language and state that tiered profiles map to
runtime-native model IDs when `runtime` is set (e.g., Codex -> gpt-5.4 /
gpt-5.3-codex / gpt-5.4-mini), otherwise profiles do not change the runtime's
default model and users should choose "Inherit" or use `model_overrides` in
.planning/config.json; ensure the model-profile descriptions reference `runtime`
and `model_overrides` consistently with the new "Runtime-Aware Profiles" note.
---
Outside diff comments:
In `@get-shit-done/bin/lib/core.cjs`:
- Around line 324-347: KNOWN_TOP_LEVEL currently omits the new top-level
container model_profile_overrides, causing valid configs to be flagged as
unknown; update the KNOWN_TOP_LEVEL set (the Set created where VALID_CONFIG_KEYS
is mapped and the additional container names are listed) to include the string
'model_profile_overrides' so that the unknownKeys filter no longer treats that
container as unexpected, and keep the existing call to
_warnUnknownProfileOverrides(parsed, '.planning/config.json') for finer
validation.
---
Nitpick comments:
In `@tests/core.test.cjs`:
- Around line 165-183: Add a focused regression that writes a config containing
a valid model_profile_overrides payload (e.g., { model_profile_overrides: {
codex: { opus: { /* valid entries */ } } } }), then call loadConfig(tmpDir) and
assert that stderr does not include the "unknown config key(s)" warning for
model_profile_overrides; reuse the same stderr capture pattern (overriding
process.stderr.write) and the helper writeConfig used in the existing loop to
ensure the specific top-level key model_profile_overrides is exercised and
doesn't spuriously trigger the unknown-key warning.
In `@tests/issue-2517-runtime-aware-profiles.test.cjs`:
- Around line 507-562: Add a new test in
tests/issue-2517-runtime-aware-profiles.test.cjs that exercises project-level
model overrides: call writeConfig(tmpDir, { runtime: 'codex', model_profile:
'quality', model_profile_overrides: { codex: { opus: { 'gsd-planner': { model:
'pinned-model' } } } } }); then obtain the resolver via
readGsdRuntimeProfileResolver(tmpDir), generate the TOML with
generateCodexAgentToml('gsd-planner', '---\nname: gsd-planner\n---\nBody.\n',
null, resolver) and assert the generated TOML includes model = "pinned-model"
(and optionally that no other precedence sources override it). This verifies
installCodexConfig()/generateCodexAgentToml honor per-project model overrides
for gsd-planner.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 948a6d48-9050-4300-850d-7089e9d7f111
📒 Files selected for processing (8)
bin/install.jsdocs/CONFIGURATION.mddocs/USER-GUIDE.mdget-shit-done/bin/lib/config-schema.cjsget-shit-done/bin/lib/core.cjsget-shit-done/workflows/settings.mdtests/core.test.cjstests/issue-2517-runtime-aware-profiles.test.cjs
| } else if (runtimeResolver) { | ||
| // #2517 — runtime-aware tier resolution. Embeds Codex-native model + reasoning_effort | ||
| // from RUNTIME_PROFILE_MAP / model_profile_overrides for the configured tier. | ||
| const entry = runtimeResolver.resolve(resolvedName) || runtimeResolver.resolve(agentName); | ||
| if (entry?.model) { | ||
| lines.push(`model = ${JSON.stringify(entry.model)}`); | ||
| if (entry.reasoning_effort) { | ||
| lines.push(`model_reasoning_effort = ${JSON.stringify(entry.reasoning_effort)}`); | ||
| } | ||
| } |
There was a problem hiding this comment.
Gate this branch to Codex-only runtime mappings.
generateCodexAgentToml() will currently emit whatever runtimeResolver returns. If a user has runtime: "claude" configured and runs gsd install codex, this writes Claude IDs like claude-opus-4-6 into Codex TOML, which Codex cannot use.
Suggested guard
- } else if (runtimeResolver) {
+ } else if (runtimeResolver?.runtime === 'codex') {
// `#2517` — runtime-aware tier resolution. Embeds Codex-native model + reasoning_effort
// from RUNTIME_PROFILE_MAP / model_profile_overrides for the configured tier.
const entry = runtimeResolver.resolve(resolvedName) || runtimeResolver.resolve(agentName);🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@bin/install.js` around lines 1938 - 1947, The branch in
generateCodexAgentToml using runtimeResolver.resolve(resolvedName) /
resolve(agentName) must be gated to only accept mappings intended for Codex:
after retrieving entry (from runtimeResolver), verify it is a Codex mapping
before writing entry.model (e.g., check a runtime/type flag on entry such as
entry.runtime === 'codex' or validate entry.model against the known Codex model
IDs via a helper like isCodexModelId), and skip adding
model/model_reasoning_effort when the predicate fails; update
generateCodexAgentToml and add a small helper (isCodexModelId or isCodexRuntime)
and reference runtimeResolver, resolvedName, agentName, and entry.model when
implementing the guard.
| const modelOverrides = readGsdGlobalModelOverrides(); | ||
| const tomlContent = generateCodexAgentToml(name, content, modelOverrides); | ||
| // Pass `targetDir` so per-project .planning/config.json wins over global | ||
| // ~/.gsd/defaults.json — without this, the PR's headline claim that | ||
| // setting runtime in the project config reaches the Codex emit path is | ||
| // false (review finding #1). | ||
| const runtimeResolver = readGsdRuntimeProfileResolver(targetDir); | ||
| const tomlContent = generateCodexAgentToml(name, content, modelOverrides, runtimeResolver); |
There was a problem hiding this comment.
Project-scoped model_overrides are still skipped here.
This path now honors .planning/config.json for runtime / model_profile, but modelOverrides still comes only from ~/.gsd/defaults.json. A project-level model_overrides.gsd-planner will be ignored, and the tier-resolved fallback gets embedded instead, which breaks the documented precedence chain.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@bin/install.js` around lines 3190 - 3196, The current code only uses
readGsdGlobalModelOverrides() for modelOverrides, so project-scoped
model_overrides (e.g. model_overrides.gsd-planner) are ignored; update the flow
to first load project-level overrides for the given targetDir (e.g. via a
readGsdProjectModelOverrides(targetDir) or similar helper), merge them with the
global overrides so project values take precedence, and then pass the merged
modelOverrides into generateCodexAgentToml(name, content, modelOverrides,
runtimeResolver); ensure you reference the existing symbols
readGsdGlobalModelOverrides, readGsdRuntimeProfileResolver,
generateCodexAgentToml, modelOverrides and targetDir when locating where to add
the project override read-and-merge logic.
| **Claude example** — explicit opt-in resolves to full Claude IDs (no `resolve_model_ids: true` needed): | ||
|
|
||
| ```json | ||
| { | ||
| "runtime": "claude", | ||
| "model_profile": "quality" | ||
| } | ||
| ``` | ||
|
|
There was a problem hiding this comment.
The runtime: "claude" example doesn't match the current resolver.
resolveModelInternal() intentionally skips the runtime-aware branch when runtime === "claude" and still returns aliases unless resolve_model_ids is enabled. As written, this example implies runtime: "claude" alone yields full IDs like claude-opus-4-6, but the current code path still returns opus/sonnet/haiku.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@docs/CONFIGURATION.md` around lines 615 - 623, The docs example is incorrect:
resolveModelInternal() intentionally skips the runtime-aware branch when runtime
=== "claude" and will still return aliases unless resolve_model_ids is enabled;
update the documentation example to either set resolve_model_ids: true or show
alias results (e.g., "opus"/"sonnet"/"haiku") instead of implying full IDs like
"claude-opus-4-6". Locate the example around the Claude section and change the
JSON to include "resolve_model_ids": true if you want full Claude IDs, or adjust
the explanatory text to state that runtime: "claude" alone yields aliases per
resolveModelInternal().
| Note: Quality, Balanced, Budget, and Adaptive profiles assign semantic tiers | ||
| (Opus/Sonnet/Haiku) to each agent. When `runtime` is set in .planning/config.json, | ||
| tiers resolve to runtime-native model IDs — on Codex that's gpt-5.4 / gpt-5.3-codex / | ||
| gpt-5.4-mini with appropriate reasoning effort. See "Runtime-Aware Profiles" in | ||
| docs/CONFIGURATION.md. | ||
|
|
||
| If `runtime` is unset on a non-Claude runtime, the profile tiers have no effect on | ||
| actual model selection — agents use the runtime's default model. Choose "Inherit" to | ||
| force session-model behavior, set `runtime` + a profile to get tiered models, or | ||
| configure `model_overrides` manually in .planning/config.json to target specific | ||
| models per agent. |
There was a problem hiding this comment.
Update the option copy to match this new note.
The note now says tiered profiles work on Codex when runtime is set, but the model-profile choices on Lines 110-113 still describe Quality/Balanced/Budget as “Claude only” and Inherit as required for non-Claude runtimes. Text-mode users will get contradictory guidance in the same prompt.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@get-shit-done/workflows/settings.md` around lines 66 - 76, Update the option
copy for the model-profile choices (Quality, Balanced, Budget, Adaptive,
Inherit) so it matches the new note: remove any "Claude only" language and state
that tiered profiles map to runtime-native model IDs when `runtime` is set
(e.g., Codex -> gpt-5.4 / gpt-5.3-codex / gpt-5.4-mini), otherwise profiles do
not change the runtime's default model and users should choose "Inherit" or use
`model_overrides` in .planning/config.json; ensure the model-profile
descriptions reference `runtime` and `model_overrides` consistently with the new
"Runtime-Aware Profiles" note.
…ans and verified (closes #2492) (#2611) * feat(#2492): add gates ensuring discuss-phase decisions are translated and verified Two gates close the loop between CONTEXT.md `<decisions>` and downstream work, fixing #2492: - Plan-phase **translation gate** (BLOCKING). After requirements coverage, refuses to mark a phase planned when a trackable decision is not cited (by id `D-NN` or by 6+-word phrase) in any plan's `must_haves`, `truths`, or body. Failure message names each missed decision with id, category, text, and remediation paths. - Verify-phase **validation gate** (NON-BLOCKING). Searches plans, SUMMARY.md, files modified, and recent commit subjects for each trackable decision. Misses are written to VERIFICATION.md as a warning section but do not change verification status. Asymmetry is deliberate — fuzzy-match miss should not fail an otherwise green phase. Shared helper `parseDecisions()` lives in `sdk/src/query/decisions.ts` so #2493 can consume the same parser. Decisions opt out of both gates via `### Claude's Discretion` heading or `[informational]` / `[folded]` / `[deferred]` tags. Both gates skip silently when `workflow.context_coverage_gate=false` (default `true`). Closes #2492 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(#2492): make plan-phase decision gate actually block (review F1, F8, F9, F10, F15) - F1: replace `${context_path}` with `${CONTEXT_PATH}` in the plan-phase gate snippet so the BLOCKING gate receives a non-empty path. The variable was defined in Step 4 (`CONTEXT_PATH=$(_gsd_field "$INIT" ...)`) and the gate snippet referenced the lowercase form, leaving the gate to run with an empty path argument and silently skip. - F15: wrap the SDK call with `jq -e '.data.passed == true' || exit 1` so failure halts the workflow instead of being printed and ignored. The verify-phase counterpart deliberately keeps no exit-1 (non-blocking by design) and now carries an inline note documenting the asymmetry. - F10: tag the JSON example fence as `json` and the options-list fence as `text` (MD040). - F8/F9: anchor the heading-presence test regexes to `^## 13[a-z]?\\.` so prose substrings like "Requirements Coverage Gate" mentioned in body text cannot satisfy the assertion. Added two new regression tests (variable-name match, exit-1 guard) so a future revert is caught. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(#2492): tighten decision-coverage gates against false positives and config drift (review F3,F4,F5,F6,F7,F16,F18,F19) - F3: forward `workstream` arg through both gate handlers so workstream-scoped `workflow.context_coverage_gate=false` actually skips. Added negative test that creates a workstream config disabling the gate while the root config has it enabled and asserts the workstream call is skipped. - F4: restrict the plan-phase haystack to designated sections — front-matter `must_haves` / `truths` / `objective` plus body sections under headings matching `must_haves|truths|tasks|objective`. HTML comments and fenced code blocks are stripped before extraction so a commented-out citation or a literal example never counts as coverage. Verify-phase keeps the broader artifact-wide haystack by design (non-blocking). - F5: reject decisions with fewer than 6 normalized words from soft-matching (previously only rejected when the resulting phrase was under 12 chars AFTER slicing — too lenient). Short decisions now require an explicit `D-NN` citation, with regression tests for the boundary. - F6: walk every `*-SUMMARY.md` independently and use `matchAll` with the `/g` flag so multiple `files_modified:` blocks across multiple summaries are all aggregated. Previously only the first block in the concatenated string was parsed, silently dropping later plans' files. - F7: validate every `files_modified` path stays inside `projectDir` after resolution (rejects absolute paths, `../` traversal). Cap each file read at 256 KB. Skipped paths emit a stderr warning naming the entry. - F16: validate `workflow.context_coverage_gate` is boolean in `loadGateConfig`; warn loudly on numeric or other-shaped values and default to ON. Mirrors the schema-vs-loadConfig validation gap from #2609. - F18: bump verify-phase `git log -n` cap from 50 to 200 so longer-running phases are not undercounted. Documented as a precision-vs-recall tradeoff appropriate for a non-blocking gate. - F19: tighten `QueryResult` / `QueryHandler` to be parameterized (`<T = unknown>`). Drops the `as unknown as Record<string, unknown>` casts in the gate handlers and surfaces shape mismatches at compile time for callers that pass a typed `data` value. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(#2492): harden decisions parser and verify-phase glob (review F11,F12,F13,F14,F17,F20) - F11: strip fenced code blocks from CONTEXT.md before searching for `<decisions>` so an example block inside ``` ``` is not mis-parsed. - F12: accept tab-indented continuation lines (previously required a leading space) so decisions split with `\t` continue cleanly. - F13: parse EVERY `<decisions>` block in the file via `matchAll`, not just the first. CONTEXT.md may legitimately carry more than one block. - F14: `decisions.parse` handler now resolves a relative path against `projectDir` — symmetric with the gate handlers — and still accepts absolute paths. - F17: replace `ls "${PHASE_DIR}"/*-CONTEXT.md | head -1` in verify-phase.md with a glob loop (ShellCheck SC2012 fix). Also avoids spawning an extra subprocess and survives filenames with whitespace. - F20: extend the unicode quote-stripping in the discretion-heading match to cover U+2018/2019/201A/201B and the U+201C-F double-quote variants plus backtick, so any rendering of "Claude's Discretion" collapses to the same key. Each fix has a regression test in `decisions.test.ts`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Closes #2517
Summary
Makes GSD's
model_profilesystem runtime-aware. A new optionalruntimeconfig key, combined with an optionalmodel_profile_overrides[runtime][tier]map, lets profile tiers (opus/sonnet/haiku) resolve to runtime-native model IDs and (where supported)reasoning_effortsettings. On Codex this meansquality/balanced/budget/adaptiveproduce real Codex-native model selections instead of empty strings, eliminating the need for large per-agentmodel_overridesblocks documented in #2256 / #2511.GSD ships built-in defaults that users can override per-runtime, per-tier (no provider-specific IDs are emitted for runtimes the resolver does not know about; those fall back to the safe Claude alias). Built-in tier maps (from #2517 spec):
claudeclaude-opus-4-6claude-sonnet-4-6claude-haiku-4-5codexgpt-5.4gpt-5.3-codexgpt-5.4-miniOther runtimes (
opencode,gemini,qwen,copilot, …) consume the resolver at spawn time today; install-path emission for them is tracked in #2612.Resolution chain
Pre-#2609
resolveModelInternal(get-shit-done/bin/lib/core.cjs):model_overrides[agent]returns first.resolve_model_ids === "omit"→"".model_profiletier lookup → alias (opusetc) or full ID ifresolve_model_ids: true.New chain:
model_overrides[agent](unchanged — most specific knob).runtimeis set to a non-Claude value AND tier resolves undermodel_profile_overrides[runtime][tier]→RUNTIME_PROFILE_MAP[runtime][tier].resolve_model_ids === "omit"(preserved fallback so existing Codex installs keep working when the user has not opted in).inheritliteral passthrough.runtime: "claude"is the implicit default and behaves as a no-op for resolution — it does not overrideresolve_model_ids: "omit"or any other Claude-native semantics. Step 2 is gated onconfig.runtime != null && config.runtime !== "claude". Withruntimeunset every config behaves byte-identically to today.Changes
get-shit-done/bin/lib/core.cjs:loadConfigreadsruntime+model_profile_overrides(defaultnull) and warns at read time on unknown runtime values or unknown tier keys (no rejection — preserves back-compat for runtimes added later). AddsRUNTIME_PROFILE_MAP,resolveTierEntry(single shared resolver consumed by both core and install), andresolveReasoningEffortInternalgated strictly onRUNTIMES_WITH_REASONING_EFFORT.resolveModelInternaladds the runtime-aware branch only whenconfig.runtimeis set to a non-Claude value, preserves all prior fallbacks, and never returnsreasoning_effort(keeps the string contract intact).get-shit-done/bin/lib/config-schema.cjs: addsruntimetoVALID_CONFIG_KEYSand a dynamic patternmodel_profile_overrides.<runtime>.<opus|sonnet|haiku>(tier enum-restricted, runtime free-string).bin/install.js:readGsdRuntimeProfileResolver(targetDir)probes<targetDir>/.planning/config.jsonAND~/.gsd/defaults.json(per-project wins) and returns a resolver that delegates to the sharedresolveTierEntry. Failed JSON parses warn to stderr instead of swallowing.generateCodexAgentTomlaccepts the resolver and emitsmodel = "..."plusmodel_reasoning_effort = "..."whenruntime: "codex"is configured. Per-agentmodel_overrideskeeps highest precedence.Documentation
docs/CONFIGURATION.md: newruntimeandmodel_profile_overrides.<runtime>.<tier>rows in Core Settings; new "Runtime-Aware Profiles (Make model profiles runtime-aware for Codex/non-Claude runtimes #2517)" section with built-in maps, Codex example, Claude example, per-runtime override example, full precedence chain, backwards-compat statement, and unknown-runtime fallback rules.adaptiverow cross-references Add adaptive model profile preset and per-agent model overrides #1713 / feat(model-profiles): add adaptive preset with role-based model assignment #1806.docs/USER-GUIDE.md: new "Switching from Claude to Codex with one config change" subsection under non-Claude runtimes.get-shit-done/workflows/settings.md: updated the/gsd-settingstext-mode warning so it explains tier resolution underruntimeinstead of telling Codex users to useinherit.Tests
tests/issue-2517-runtime-aware-profiles.test.cjs— 52 tests covering:runtimeset):balanced,inherit,resolve_model_ids: true,resolve_model_ids: "omit",adaptiveall unchanged;reasoning_effortreturnsnull.runtime: "claude"is a no-op: balanced returns the alias;runtime:"claude" + resolve_model_ids:"omit"returns"";runtime:"claude" + resolve_model_ids:truemaps the alias to the full Claude ID;reasoning_effortnever leaks.runtime: "codex": opus →gpt-5.4xhigh, sonnet →gpt-5.3-codexmedium, haiku →gpt-5.4-minimedium;adaptivestill works (no Add adaptive model profile preset and per-agent model overrides #1713 / feat(model-profiles): add adaptive preset with role-based model assignment #1806 regression);inheritprofile passes through unchanged;runtimeopt-in beatsresolve_model_ids: "omit".model_overridesbeats profile override beats default.{ opus: "gpt-5-pro" }keepsreasoning_effortfrom the built-in entry; partial-object{ opus: { reasoning_effort: "low" } }keeps the built-in model.reasoning_effortallowlist gates regardless of overrides — typoruntime: "codx"plus an override does not leakxhigh.loadConfigwarning paths for unknown runtime values and unknown tier keys..planning/config.jsonreaches the Codex TOML emit (model = ...,model_reasoning_effort = ...); per-project wins over~/.gsd/defaults.json; install.js library require paths exist relative to__dirname.runtimeis valid; tier enum is enforced (opus/sonnet/haikuaccepted,bananarejected); runtime is free-string; baremodel_profile_overridesrejected.Tests isolate
HOMEandGSD_HOMEto a per-test tmpdir so the developer's real~/.gsd/defaults.jsoncannot bleed into assertions.Full suite: 5244 / 5244 passing (
npm test).Design decisions
runtime: "codex"overridesresolve_model_ids: "omit". Explicit non-Claude opt-in beats safety-valve; otherwise the new feature would be dead-on-arrival for the Codex installs that auto-setomit. Existing users keep their behavior because they have not setruntime.runtime: "claude"is a no-op for resolution. It is the implicit default; treating it as anything else would silently flipresolve_model_idssemantics on for everyone settingruntime: "claude"to "be explicit."model_profile_overridesfield-merges per(runtime, tier)so users can override just the model and keep the built-inreasoning_effort, or vice versa.reasoning_effortonly flows through Codex install paths.resolveModelInternalkeeps its string-return contract; a parallelresolveReasoningEffortInternalexposes effort, gated on a strict allowlist (currently: codex). The Codex TOML generator is the only emitter today.model_profile_overrides[<runtime>]to populate it; install-path emission for additional runtimes is tracked in feat: extend runtime-aware profiles to all supported runtimes + interactive override UI #2612.Adversarial review fixes
The review of the original commit surfaced 16 findings (2 critical, 8 major, 5 minor, 1 nit). All were addressed in the follow-on commit on this branch — see the commit message for the per-finding mapping.
Summary by CodeRabbit
New Features
runtimeconfiguration option to specify runtime (Claude, Codex)model_profile_overridesconfiguration for custom tier-to-model mappingsDocumentation
Tests