fix(3784): expose adaptive in model_profile settings flow (#91)
* fix(3784): expose adaptive in model_profile settings flow Split the single 4-option model-profile AskUserQuestion into a two-question flow: Q1 (Adaptive / Standard tier / Inherit) routes top-level intent; Q2 (Quality / Balanced / Budget) appears only when Standard tier is chosen. Updates the confirm table and success_criteria to include adaptive. Adds regression test asserting all five valid profiles are reachable interactively via the settings UI. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * changeset: add Fixed entry for #3784 / PR #3795 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(3784): correct Q2-skip comment and remove duplicate brace in settings.md Codex review followup: - Replaced vague "preserve existing config" comment with accurate description: Q1 still writes model_profile on Adaptive/Inherit branches; only Q2 is skipped. - Removed stray duplicate `{` line before the Spawn Plan Researcher question block (pseudocode had two consecutive `{` openers, one spurious). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(3784): address review — gate Q2 structurally, define cancel rule, harden tests Addresses gsd-code-reviewer (M1/M2/m1/m2/m3/m4) and codex adversarial (Q2 gating, save-mapping, Claude-only wording, step-of-2 wording). - F1: Replace //comment-only Q2 gating with Conditional visibility block (mirrors code_review_depth / graphify.auto_update structural pattern) - F2: Define model_profile cancel rule in update_config step (leave existing value unchanged when Q1="Standard tier…" but Q2 cancelled) - F3: Fix Adaptive description — remove "Claude only" tail; describe heavy/light role tiers across all supported runtimes - F4: Remove "step 1 of 2 for standard profiles" from Q1 question text (2-step nature now structurally documented by Conditional visibility) - F5: Fix vacuously-true test disjunct (|| content.includes('Adaptive') always true — 6+ occurrences); assertion now requires role-based cost optimization + heavy roles wording - F6: Add 4-option cap enforcement test (ASK_USER_QUESTION_OPTION_CAP=4 named constant, counts per question object not per AskUserQuestion call) and brace-balance regression test (guards against bd53925f recurrence) * docs(3784): list adaptive in model_profile reference docs --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -104,18 +104,50 @@ Context Warnings, Research Qs
|
||||
**Conditional visibility — graphify.auto_update:** This question is shown only when the user's chosen `graphify.enabled` value is on. If `graphify.enabled` is off, omit the `graphify.auto_update` question and preserve the existing `graphify.auto_update` value in config (do not overwrite). Implementation: ask Graphify first; only ask Graph auto-update when Graphify is enabled.
|
||||
|
||||
```
|
||||
// Model profile is selected via a two-question split because AskUserQuestion enforces a
|
||||
// hard 4-option cap and there are 5 valid profiles (quality, balanced, budget, adaptive,
|
||||
// inherit). Q1 routes between adaptive/standard-tier/inherit; Q2 (shown only when the
|
||||
// user chose "Standard tier" in Q1) picks among the three standard profiles. (#3784)
|
||||
AskUserQuestion([
|
||||
{
|
||||
question: "Which model profile for agents?",
|
||||
header: "Model",
|
||||
multiSelect: false,
|
||||
options: [
|
||||
{ label: "Quality", description: "Opus everywhere except verification (highest cost) — Claude only" },
|
||||
{ label: "Balanced (Recommended)", description: "Opus for planning, Sonnet for research/execution/verification — Claude only" },
|
||||
{ label: "Budget", description: "Sonnet for writing, Haiku for research/verification (lowest cost) — Claude only" },
|
||||
{ label: "Adaptive (Recommended)", description: "Role-based cost optimization: heavy roles use the highest-tier model available on the active runtime, light roles use the cheapest. Best balance of quality and cost across all supported runtimes (Claude, Codex, Gemini, OpenRouter, local)." },
|
||||
{ label: "Standard tier…", description: "Choose Quality, Balanced, or Budget — flat tier applied to all agents" },
|
||||
{ label: "Inherit", description: "Use current session model for all agents (required for non-Claude runtimes: Codex, Gemini CLI, OpenRouter, local models)" }
|
||||
]
|
||||
},
|
||||
}
|
||||
])
|
||||
|
||||
**Conditional visibility — model_profile (Q2):**
|
||||
Only ask this question when Q1's answer is "Standard tier…".
|
||||
If Q1 = "Adaptive (Recommended)" → write model_profile=adaptive and SKIP Q2.
|
||||
If Q1 = "Inherit" → write model_profile=inherit and SKIP Q2.
|
||||
If user cancels Q2 after picking "Standard tier…" → leave existing model_profile value unchanged (mirror code_review_depth's cancellation rule).
|
||||
|
||||
AskUserQuestion([
|
||||
{
|
||||
question: "Which standard profile? (Quality / Balanced / Budget)",
|
||||
header: "Model Tier",
|
||||
multiSelect: false,
|
||||
options: [
|
||||
{ label: "Quality", description: "Opus everywhere except verification (highest cost) — Claude only" },
|
||||
{ label: "Balanced", description: "Opus for planning, Sonnet for research/execution/verification — Claude only" },
|
||||
{ label: "Budget", description: "Sonnet for writing, Haiku for research/verification (lowest cost) — Claude only" }
|
||||
]
|
||||
}
|
||||
])
|
||||
|
||||
// Map UI choices → config values:
|
||||
// Q1 "Adaptive (Recommended)" → model_profile = "adaptive"
|
||||
// Q1 "Inherit" → model_profile = "inherit"
|
||||
// Q1 "Standard tier…" + Q2 "Quality" → model_profile = "quality"
|
||||
// Q1 "Standard tier…" + Q2 "Balanced" → model_profile = "balanced"
|
||||
// Q1 "Standard tier…" + Q2 "Budget" → model_profile = "budget"
|
||||
|
||||
AskUserQuestion([
|
||||
{
|
||||
question: "Spawn Plan Researcher? (researches domain before planning)",
|
||||
header: "Research",
|
||||
@@ -381,7 +413,7 @@ Merge new settings into existing config.json:
|
||||
}
|
||||
```
|
||||
|
||||
**Safe merge:** Apply each chosen value via `gsd-sdk query config-set <key.path> <value>` so unrelated keys are never clobbered. `code_review_depth` is written only if the code_review question was answered `on`; otherwise leave the existing value in place.
|
||||
**Safe merge:** Apply each chosen value via `gsd-sdk query config-set <key.path> <value>` so unrelated keys are never clobbered. `code_review_depth` is written only if the code_review question was answered `on`; otherwise leave the existing value in place. `model_profile` is written on Q1 "Adaptive (Recommended)" (→ adaptive) or Q1 "Inherit" (→ inherit) immediately; for Q1 "Standard tier…", `model_profile` is written from Q2's answer. If Q1 = "Standard tier…" but Q2 is cancelled, leave the existing `model_profile` value unchanged — do not write any new value.
|
||||
|
||||
Write updated config to `$GSD_CONFIG_PATH` (the workstream-aware path resolved in `ensure_and_load_config`). Never hardcode `.planning/config.json` — workstream installs route to `.planning/workstreams/<slug>/config.json`.
|
||||
</step>
|
||||
@@ -456,7 +488,7 @@ Display:
|
||||
|
||||
| Setting | Value |
|
||||
|----------------------|-------|
|
||||
| Model Profile | {quality/balanced/budget/inherit} |
|
||||
| Model Profile | {quality/balanced/budget/adaptive/inherit} |
|
||||
| Plan Researcher | {On/Off} |
|
||||
| Plan Checker | {On/Off} |
|
||||
| Pattern Mapper | {On/Off} |
|
||||
@@ -495,7 +527,7 @@ Quick commands:
|
||||
|
||||
<success_criteria>
|
||||
- [ ] Current config read
|
||||
- [ ] User presented with 23 settings (profile + workflow toggles + features + git branching + git tagging + ctx warnings), grouped into six sections: Planning, Execution, Docs & Output, Features, Model & Pipeline, Misc. `code_review_depth` is conditional on `code_review=on`.
|
||||
- [ ] User presented with 23 settings (profile + workflow toggles + features + git branching + git tagging + ctx warnings), grouped into six sections: Planning, Execution, Docs & Output, Features, Model & Pipeline, Misc. `code_review_depth` is conditional on `code_review=on`. Model profile uses a two-question split (Q1: Adaptive / Standard tier / Inherit; Q2: Quality / Balanced / Budget — only when Standard tier chosen) to stay within the 4-option AskUserQuestion cap while exposing all 5 valid profiles (#3784).
|
||||
- [ ] Config updated with model_profile, workflow, and git sections
|
||||
- [ ] User offered to save as global defaults (~/.gsd/defaults.json)
|
||||
- [ ] Changes confirmed to user
|
||||
|
||||
Reference in New Issue
Block a user