Repository navigation
Community-controlled reasoning effort across Anthropic, Bedrock and OpenRouter - #546
Merged
Merged
Conversation
Refs #545. One neutral scale (none, low, medium, high, xhigh, max), each model's accepted levels in one table (Luna none to max, gpt-oss low to high, Claude Sonnet none to high and never above, Haiku and Qwen none), a clamp that sends a model only a level it accepts, and CommunityConfig.reasoning_effort with a load-time warning when the default model cannot honor it. Not wired to a provider yet. 80 tests read the real tables; letting Sonnet through at max fails 3 of them.
…to Bedrock OpenRouter cannot turn reasoning off for the models it makes mandatory, so none is not a level there. A model's own default now applies on every provider. Bedrock models name their request field (nested for Luna, flat for gpt-oss, none for Qwen) instead of carrying a fixed effort. Tested: unit tests for levels, clamp (including a gap), defaults; Bedrock wire tests follow in a later commit.
Claude Platform: output_config.effort beside adaptive thinking; none turns thinking off. OpenRouter: the unified reasoning.effort body field through model_kwargs, since LiteLLM's own reasoning_effort has no max and raises for models its map does not list. Tested: request-shape tests follow in a later commit.
Tested: routing tests follow in a later commit.
Bedrock: the Converse body botocore would send. Claude Platform: the payload ChatAnthropic builds. OpenRouter: the body LiteLLM posts to a local fake. Router: the community's level reaches the model each path builds. Tested: 121 new tests; each rule mutation-checked.
Both default to Luna, where max took 15 to 50 s to a first word and xhigh often skipped the documentation search. Tested: configs load; level is high.
Tested: not applicable (docs).
…ffort low on Sonnet Review findings on #546: - An unmapped OpenRouter slug was read as normalize_model(None), the default model; effective_reasoning_effort now refuses a missing model. - The reverse map no longer follows normalize_model aliases: an older anthropic/claude-* slug runs as the older model on OpenRouter, so the offered Sonnet's levels say nothing about it. A debug line says when a level is dropped. - Sonnet none is no up-front thinking at effort low (no level is lower), not thinking off with the API's default effort. - REASONING_SCALE is derived from the ReasoningEffort Literal. - Stale comments corrected; measurement wording narrowed. Tested: slug, alias, patched-default, log, caching-off and parity tests; 11 mutations killed.
…arnings in osa validate The warning skipped every default_model containing a slash, including aliases that resolve to Sonnet on the Claude path and clamp there; it now resolves through normalize_model first and skips only an unknown model, which removes a second, misleading warning for a typo. osa validate now collects the schema's UserWarnings into its Warnings block instead of leaving them on stderr. Tested: alias, typo and pinned per-level tests; validate lists the warning.
…nity runs Tested: routing tests load the real YAML; a dynamic test covers every community that sets a level.
…in the docs OpenRouter's own default for Luna and gpt-oss is medium; OSA sends high. Also notes prompt-cache invalidation on a level change and that Haiku ignores the key. Tested: not applicable (docs).
Building the NEMAR assistant discovers its MCP tools from mcp.nemar.org, so the shipped-YAML and dynamic routing tests made the offline suite depend on a live service (up to 25 s per discovery). They now build the assistants without MCP servers; which tools a community has is not what they test. Tested: routing tests pass in 1.8 s with all HTTPS sent to a dead proxy and no MCP log lines; the previous version logged MCP discovery failures there.
This was referenced Sep 29, 2026
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.
Closes #545.
What
A community can set
reasoning_effortin itsconfig.yaml: one key, one scale (none,low,medium,high,xhigh,max), and every provider path turns it into that platform's own request field.GPT-6 Luna at
maxmade a tool-using turn take 15 to 50 s before its first word (#544 lowered it tohighas a constant); this makes the level the community's to choose, on every provider and every model that has one.additionalModelRequestFields: {"reasoning": {"effort": level}}{"reasoning_effort": level}(low, medium, high)highhangs it)output_config.effort(low, medium, high) beside adaptive thinking;noneis no up-front thinking (between_tools) at effortlowOPENROUTER_MODEL_IDS)reasoning: {"effort": level}viamodel_kwargs; any other slug, including the olderanthropic/claude-*alias slugs, is sent nothingRules the maintainer set, enforced in one table (
REASONING_LEVELS) so they hold on every platform:lowor abovehigh).high, whatever a community asks.highfor Luna and gpt-oss; nothing for Sonnet, so the Claude Platform's own default applies as before.default_modelcannot honor is a warning at load, not an error (the key applies to every model a request can run).highexplicitly.OpenRouter does not let a request turn off the reasoning of the models it marks mandatory (Sonnet, gpt-oss), so
noneis raised to their lowest level there.Behavior change to look at: OpenRouter's own default effort for Luna and gpt-oss-120b is
medium; with no community key OSA now sendshighon OpenRouter as on every provider, so a caller with their own OpenRouter key gets more reasoning, and a longer wait, on those two models than before (disclosed in the CHANGELOG under Changed and in ADR 0015).Measured
Through the real NWB graph on a documentation question, Luna's median time to first text (3 runs per level): none 2.5 s, low 2.8 s, medium 5.2 s, high 5.2 s, xhigh 10.6 s, max 48 s.
At
xhighandmaxit also skipped the documentation search in the median run, so the answer had no citations; the config comment says so.Bedrock's accepted levels and the wrong-shape traps (nested field is a 200 no-op for gpt-oss, flat is a 400 for Luna) were measured against the live service.
Not verified by a request
There is no Anthropic or OpenRouter key on the development machine.
For those two paths the tests read the request the real client builds (the
ChatAnthropicpayload; the body LiteLLM posts to a local fake of OpenRouter's endpoint).The independent review checked the field names, levels and constraints (
output_config.effort,between_toolsat effort high or below, OpenRouter'sreasoning.effortand its mandatory-reasoning models) against Anthropic's and OpenRouter's current documentation and OpenRouter's public models listing on 2026-09-29; no request was sent.The first request through a real key is still the check that is left:
pytest tests/test_integration/test_anthropic_platform.py -m llm.Tests
tests/test_core/test_reasoning_effort.py: scale, per-model levels (a pinned result for every level of every model, written out), clamp (including a gap in a model's levels), provider-aware levels, defaults, the config field and its warnings (including adefault_modelnamed by an alias, and a typo).tests/test_core/test_reasoning_effort_providers.py: the request each provider puts on the wire, per model and level, with the wrong-shape guards; OpenRouter slug handling (offered slugs, older alias slugs, an unmapped slug not read as the default model, the debug line); caching on and off; every model with levels has a path that sends them.tests/test_api/test_reasoning_effort_routing.py: through the realcreate_community_assistant, the community's level reaches the model each path builds, for the shipped NWB and NEMAR YAML and dynamically for every community that sets a level.tests/test_cli/test_validate.py:osa validatelists the load-time warning in its Warnings block.osa validate); all are killed.Review
An independent Sonnet review found no critical issue and two important ones, both on the OpenRouter path (an unmapped slug read as the default model; alias slugs read as the offered Sonnet), plus suggestions.
All are addressed except one intentional choice: Claude Haiku 4.5, the default of most communities, ignores the key (its thinking is a token budget, not a level); the ADR says so and the config load warns.
osa validatenow lists the schema's load warnings, and Sonnet'snoneis no up-front thinking at effortlowrather than the API's default effort.Docs
ADR 0015, an ADR 0014 pointer,
.context/yaml_registry.md, CHANGELOG.The schema reference on docs.osc.earth lives in
osc-docsand is not changed here.