Repository navigation
fix: support real thinking capability catalog shapes - #278
Merged
Merged
Conversation
resolveCapabilities only recognized array-form variants and V1
capabilities.reasoning + options. The live OpenCode catalog publishes
top-level reasoning:true plus reasoning_options[{type:"effort",
values:[...]}] with no variants field, so extraction returned EMPTY and a
genuinely-supported level (e.g. "high") triggered the preserve-default
warning.
Teach extraction the real id-only shapes while leaving existing paths
intact:
- reasoning_options: prefer entries with type==="effort"; fall back to
string values across all entries only when no effort entry exists.
Numeric fields (e.g. budget_tokens) are ignored.
- object-map variants (e.g. {high:{...}}): collect keys as supported ids,
including headerless entries. No request headers/bodies are fabricated.
- id-only results carry raw={source:"v2", variants:[]} so source
discrimination is preserved without inventing request encodings.
- array-variants and V1 paths, EMPTY fallback, and try/catch degradation
are unchanged.
Tests authored red first; the focused run bailed after 3 failures
(supported=[] for the reasoning_options shape) before this change and
passes 18/18 after.
resolveThinkingValue returned preserve-default whenever a V2 capability
source had no full ThinkingVariant object for the requested id, even
when extraction (from reasoning_options or object-map variants) had
already confirmed the id is genuinely supported. On the live openai
catalog a level like "high" therefore triggered the preserve-default
warning and never reached the provider.
Smallest coherent fix: for a V2-source supported candidate with no
matching full variant, return {apply: candidate, source: "v2"} (the
honest string id). The full-variant object path returns the exact
stored variant unchanged; the V1 path, preserve-default warning,
never-downgrade semantics, none-as-a-real-value handling, and
THINKING_LABEL_CANDIDATES identity are all untouched. No variants are
synthesized and no request headers/bodies are fabricated.
Tests authored red first; the focused run bailed with 2 failures
(id-only "high" and id-only "none" returned preserve-default) before
this change and passes 33/33 after.
…ordering - applyThinkingLevelsToAgents now sets agent.model.variant for honest string resolutions (id-only V2 matches) instead of silently discarding them. No headers/body are fabricated for a string apply. - captureCatalogCapabilities builds a fresh Map per refresh and the shared reference is swapped only after full population, replacing the previous clear-then-repopulate-in-place pattern. A reentrant agent transform racing a catalog refresh now always observes a complete snapshot. - registerThinkingLevelAgentTransform deduplicates the initial-registration and reload code paths through a shared refresh() closure; behavior is unchanged (catalog transform before agent transform, in both paths). Tests: 3 new cases covering the string-apply path, the unsupported-level warning path, and reentrancy/capture-ordering safety. All prior hooks-v2 coverage (full-variant merge, live reload rerun) passes unchanged.
Add a redacted real-shape parity fixture to dual-contract.test.ts asserting that equivalent V1 (capabilities.reasoning + options) and real-shape V2 (reasoning + reasoning_options effort) host payloads produce the same supported thinking-level set through the shared resolveCapabilities extractor, and that every canonical label resolves on both contracts. Add a defensive V1 chat.params test to agent-registration.test.ts documenting the precise posture when the catalog exposes only the real-shape effort options: resolveCapabilities classifies it as a V2 id-only match, getVerifiedV1RequestOption returns undefined, and the hook emits the documented 'no unambiguous V1 request option' diagnostic while preserving the provider default. The V2 adapter handles the same shape via the string apply path. agent-registration.ts is deliberately untouched: the new V1 test passes green on first run, proving the Wave 1 shared extraction change does not break V1. No speculative source edit (ADL Rule 4). Verification: - dual-contract.test.ts: 15 pass, 0 fail, 66 expect() calls - agent-registration.test.ts: 13 pass, 0 fail, 23 expect() calls - features/setup/: 93 pass, 0 fail, 259 expect() calls (non-regression) - typecheck: clean; lint: 0 warnings in edited files
…real-shape catalog Add the Pattern 4 wiring proof for the live host capability shape that caused the original defect: a catalog publishing reasoning:true + reasoning_options (no variants). A configured agentThinkingLevels value for a goop-* role reaches the V2 consumer, sets agent.model.variant without a preserve-default warning and without fabricated headers/body, and changing the configured level changes the applied variant on reload. Document the reasoning_options-vs-variants catalog gotcha in AGENTS.md.
fix: apply configured thinking levels through V2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
reasoning_optionsand object-map variantsVerification