fix(gateway): remove _show_reasoning cache, always resolve per-platform config

Remove GatewayRunner._show_reasoning field that was initialized once at
startup using only global display.show_reasoning config. All consumers
now resolve show_reasoning per-platform via resolve_display_setting(),
ensuring display.platforms.<platform>.show_reasoning overrides work
correctly for all platforms (especially WeCom).

Changes:
- Delete self._show_reasoning initialization in __init__
- Update _handle_reasoning_command to resolve per-platform on each call
- Update reasoning_callback wiring to resolve per-platform
- Update response prepend logic to resolve per-platform
- Remove fallback to cached self._show_reasoning

Fixes: WeCom reasoning display respects per-platform config

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Leon 2026-04-20 01:45:11 +08:00
parent 26bd52c1ba
commit c6ec3e91f3
2 changed files with 13 additions and 10 deletions

View file

@ -33,7 +33,6 @@ def _make_runner():
runner._ephemeral_system_prompt = ""
runner._prefill_messages = []
runner._reasoning_config = None
runner._show_reasoning = False
runner._provider_routing = {}
runner._fallback_model = None
runner._running_agents = {}
@ -90,14 +89,12 @@ class TestReasoningCommand:
runner = _make_runner()
runner._reasoning_config = {"enabled": True, "effort": "xhigh"}
runner._show_reasoning = False
result = await runner._handle_reasoning_command(_make_event("/reasoning"))
assert "**Effort:** `none (disabled)`" in result
assert "**Display:** on ✓" in result
assert runner._reasoning_config == {"enabled": False}
assert runner._show_reasoning is True
@pytest.mark.asyncio
async def test_load_show_reasoning_resolves_per_platform(self, tmp_path, monkeypatch):