Repository navigation
fix(settings): save provider/model ids in every model pin its picker offers - #18399
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing to check. [DESIGN-REVIEWED] b2cf1a7 Description read[DESCRIPTION-READ] b856ed2cbd9b799c9c23b821d850108bb189f79ddf5ff75a2067e24f604682f1 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS On OpenCode, the Decisions wake-judge picker still lists Not justified as shipped
What this change shipsInventory (6 items) — 5 justifiedIntent: let a model picked from a Settings dropdown be saved in every pin whose runtime can use it. This is a FIX (#18396).
[FIRST-PRINCIPLES-REVIEWED] b2cf1a7 Description read[DESCRIPTION-READ] 6454d3f8bb05f15195ab506efa05a52987f56e0640312a0e2346731f446a0ae7 That sha256 names the PR description this verdict read. Recompute it with |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
|
Confirmed the Opus advisory on head
The two remediation options described in the review are to retain the bare-id grammar for this pin (and align its spec/tests), or to accept the same bounded slash-segment grammar in the runtime model validator. Offering this reproduction as evidence for whichever contract you choose; I have not changed this branch. |
|
Self-review (crew-pr-reviewer, read-only): CHANGES NEEDED This PR moves every Settings model pin onto one |
|
Moved to draft by crew-pr-reviewer: the self-review above is CHANGES NEEDED. GitHub refuses a self-request-changes and the readiness check ignores human reviews, so draft keeps this PR from merging (it also turns auto-merge off). Once the points above are fixed, mark it ready with |
7c36e3c to
313a3f8
Compare
|
Addressed the CHANGES NEEDED self-review (and the Opus advisory it confirmed) on new head
Also corrected the PR body: it now names four pins, lists the wake-judge pin under "Not a goal", and fixes the Design Review note — the shared grammar refuses an id starting with Local: |
313a3f8 to
008a1b7
Compare
|
Self-review (crew-pr-reviewer, read-only): CHANGES NEEDED This PR moves the background, subagent, throttle-fallback and refusal-fallback pins onto the shared |
|
Converted to draft by crew-pr-reviewer: the self-review above is CHANGES NEEDED. Mark ready again (gh pr ready 18399) once the points are addressed. |
008a1b7 to
89c3ab6
Compare
|
Reply to the 2026-10-11 00:23Z self-review. Fixed on head 89c3ab6 (rebased onto current main, still one commit, cixuuz + Co-authored-by kept).
Local: 32/32 in |
…offers The role-model, throttle-fallback and refusal-fallback model pickers list the same advertised model names as the Decisions tier pickers, and OpenCode advertises those names as `provider/model`. #16417 widened only the tier pickers' grammar; the four sibling pins still used the narrow `^[A-Za-z0-9._\-\[\]]*$` and answered "Could not save this setting" for a model their own picker offered. Give those pins and the tiers one grammar, `_MODEL_PIN_PATTERN` in `dashboard/handlers/core.py`: a bare id OR the slash-joined `provider/model` form, still refusing empty segments and shell metacharacters. `decisions.nudge_wake.llm_model` keeps the bare-id grammar: the decision gate scrubs any model `decisions.types.is_model_id` refuses (no `/`), so a saved `provider/model` wake-judge pin would never reach the judge. Co-authored-by: Leon <276034861+leonlaiyc@users.noreply.github.com>
89c3ab6 to
b2cf1a7
Compare
|
Self-review (crew-pr-reviewer, read-only): RECOMMEND APPROVE This PR moves |
Problem / Motivation
Goal: A model you pick from a Settings dropdown your account advertises can be saved — in every model pin whose runtime can use it, not just the Decisions tiers.
#16417 widened the Decisions tier pickers' save grammar to accept the provider-qualified
provider/modelids OpenCode advertises. It left five sibling pins —agent.model(the Settings → Chat default),agent.role_models.background,agent.role_models.subagent,agent.fallback_modelandagent.refusal_fallback_model— on the narrow^[A-Za-z0-9._\-\[\]]*$. Those pins' pickers list the same advertised names, so on OpenCode selecting one and saving answers "Could not save this setting" for a model the picker itself offered.Why it matters
A user picks a model from the dropdown their own account advertises, hits save, and the PATCH rejects it. The picker and the save gate disagree about what a valid id is — a dead end with no workaround short of hand-editing config.
Not a goal
decisions.nudge_wake.llm_model: it keeps the bare-id grammar, because the decision gate scrubs any modeldecisions.types.is_model_idrefuses (no/), so a savedprovider/modelwake-judge pin would never reach the judge. Widening the gate'sMODEL_ID_REis out of scope._validate_role_modelstill rejects a well-formed id the active provider or the account cannot honor.What changed (motivation → approach → change)
Symptom: five Settings pins reject an id their own picker offered. Root cause: #16417 widened only the tier pickers' pattern; the siblings kept the pre-OpenCode narrow pattern, so the two drifted apart. Change: give those pins and the tiers one shared grammar constant (
agent.modeltakes the grammar only; it has no entitlementvalidate_fn),_MODEL_PIN_PATTERNindashboard/handlers/core.py— a bare id OR the slash-joinedprovider/modelform, still refusing empty segments (a//b,/a,a/) and shell metacharacters. The tier picker that #16417 added now references the same constant.Backwards compatibility
Mostly widening:
provider/modelids now pass on the five pins, and every bare id that starts with a letter or digit passes as before. One narrowing: the shared grammar (already the tiers' grammar since #16417) requires the first character to be a letter or digit, so an id starting with.,_,-or[— which the old narrow pattern allowed — is now refused on these five pins. No advertised model id has that shape; the tiers have refused it since #16417.Removes nothing: no path is hidden, no record pruned, no key or function removed.
Tests
New
test/test_qualified_model_pins.py, for each of the four validated pins:example-provider/example-model) is stored exactly as sent;provider//model,/model,model/) and a shell-metacharacter value are refused with HTTP 400 and nothing is stored;patternandvalidate_fn, so the two cannot silently drift apart again.For
agent.model: aprovider/modelid saves, the same malformed values get 400, and it shares the tierpattern(fails on base).And for
decisions.nudge_wake.llm_model: aprovider/modelid is refused with 400 (it would failis_model_id, so the judge would be scrubbed), and a bare id still saves.All 32 cases pass locally, plus
test_config_patch.py,test_config_live.py,test_config_overlay.py,test_model_scope.py, the config hot-reload suites andtest_decisions_config_api.py(471 total).Manual verification
N/A — the PATCH handler is exercised end-to-end by the new unit tests (real handler against a temp
config.json).Related Issues
Fixes #18396
Replaces #16768 by @leonlaiyc.
Pattern harvest
Not generalizable: a one-off grammar drift between a picker's save gate and its sibling pins, fixed by collapsing them onto one shared constant. No wider pattern worth a lint/semgrep rule — the shared-constant structure is itself the guard against recurrence (the test asserts the pins reference the tier's pattern).