hermes - ✅(Solved) Fix [Bug]: Gemini chat-completions route does not bridge reasoning_config into thinking_config, so Discord show_reasoning stays empty [2 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
NousResearch/hermes-agent#16941Fetched 2026-04-29 06:38:11
View on GitHub
Comments
0
Participants
1
Timeline
8
Reactions
0
Participants
Timeline (top)
labeled ×5cross-referenced ×2closed ×1

Error Message

In local verification after a fix that bridges Gemini thinking_config, the same Discord path shows 💭 Reasoning: again and no runtime error was observed.

Additional Logs / Traceback (optional)

Root Cause

Root Cause Analysis (optional)

Fix Action

Fix / Workaround

A local patch following that approach restored 💭 Reasoning: in Discord for provider: gemini + gemini-3-flash-preview.

PR fix notes

PR #16945: fix(gemini): bridge reasoning_config into thinking_config for chat-completions routes

Description (problem / solution / changelog)

Summary

Gemini-backed chat-completions routes were not translating Hermes reasoning_config into Gemini thinking_config, so Gemini requests could complete without returning thought parts even when reasoning display was enabled upstream.

In local Discord usage with the official Gemini provider (provider: gemini) and gemini-3-flash-preview, this showed up as:

  • before: no 💭 Reasoning: block in replies
  • after: 💭 Reasoning: is present again

Root Cause

This was not a Discord-only display problem.

The relevant path was:

  • gateway/run.py only prepends 💭 Reasoning: when agent_result["last_reasoning"] exists
  • run_agent.py populates last_reasoning from assistant reasoning fields
  • Gemini adapters normalize thinking_config / thinkingConfig and require includeThoughts to request thought parts
  • the shared chat-completions transport did not bridge Hermes reasoning_config into Gemini thinking_config

That meant reasoning could be enabled at the Hermes / gateway layer while the Gemini-backed request still failed to ask for visible thought parts.

Changes

FileChange
agent/transports/chat_completions.pyAdd a Gemini-specific bridge from Hermes reasoning_config to Gemini thinking_config; keep it conservative by not injecting anything when reasoning_config is absent, mapping enabled: false / effort: none to includeThoughts: false, using includeThoughts-only for gemini-2.5-*, and applying model-family-aware thinkingLevel mapping for gemini-3* / gemini-3.1*
run_agent.pyPass provider_name into the shared chat-completions transport so Gemini-specific request shaping can happen there
tests/agent/transports/test_chat_completions.pyAdd regression coverage for no explicit reasoning_config, gemini-3-flash-preview, gemini-2.5-flash, google/gemini-3.1-pro-preview, disabled reasoning, and xhigh clamping

Validation

CheckResult
./venv/bin/pytest -q tests/agent/transports/test_chat_completions.py47 passed
./venv/bin/pytest -q tests/agent/test_gemini_cloudcode.py -k thinking_config_normalization1 passed
./venv/bin/ruff check agent/transports/chat_completions.py tests/agent/transports/test_chat_completions.pypassed
./venv/bin/python -m py_compile agent/transports/chat_completions.py run_agent.pypassed

Local runtime verification:

SurfaceBeforeAfter
Discord gateway reply (provider: gemini, model: gemini-3-flash-preview)reasoning display enabled, but no 💭 Reasoning: block appeared💭 Reasoning: appears as expected

No error was observed during the Discord verification.

Scope

Validated directly for:

  • official Gemini provider (provider: gemini)
  • gemini-3-flash-preview
  • Discord gateway path

Not claimed as manually validated in this PR:

  • google-gemini-cli
  • Hermes CLI display path
  • other gateway channels

Related #16941

Changed files

  • agent/transports/chat_completions.py (modified, +52/-0)
  • run_agent.py (modified, +1/-0)
  • tests/agent/transports/test_chat_completions.py (modified, +70/-1)

PR #16999: fix(gemini): bridge reasoning_config into thinking_config for chat-completions routes

Description (problem / solution / changelog)

Summary

Bridges Hermes reasoning_config into Gemini thinking_config on the chat-completions transport so provider: gemini + gemini-3-flash-preview actually returns thought parts, restoring the Discord 💭 Reasoning: block when display.show_reasoning: true + agent.reasoning_effort: high are set.

Salvage of #16945 onto current main (57 commits ahead) by @Nanako0129, with one small follow-up clamp.

Root cause

provider: gemini resolves to api_mode=chat_completions, so the request is built by ChatCompletionsTransport.build_kwargs() and then handed to GeminiNativeClient.chat.completions.create() — which reads extra_body["thinking_config"]. Nothing upstream was populating that key, so the native client never asked Gemini to return thought parts, last_reasoning stayed empty, and the gateway had nothing to render.

Changes

  • agent/transports/chat_completions.py — new _build_gemini_thinking_config(model, reasoning_config) helper. Gated on provider_name in {"gemini", "google-gemini-cli"}. No-op when reasoning_config is absent. enabled: false / effort: noneincludeThoughts: false. gemini-2.5-*includeThoughts: true only (no thinkingLevel, since 2.5 uses thinkingBudget). gemini-3* / gemini-3.1*includeThoughts: true plus a family-aware thinkingLevel clamp.
  • run_agent.py — pass provider_name=self.provider through _build_api_kwargs so the transport can fork on provider.
  • Follow-up clamp (on top of the salvaged commit): Flash documents low/medium/high only, so minimallow on Flash (matches how Pro already clamps). Anything outside {low, medium, high} funnels to medium so we never forward an undocumented thinkingLevel verbatim.
  • tests/agent/transports/test_chat_completions.py — regression coverage for no-config, Flash+high, 2.5+high, Pro+medium (clamped to low), disabled reasoning, xhigh clamp, and the new minimal → low clamp on Flash.

Effort → thinkingLevel matrix

effortgemini-2.5-*gemini-3-flashgemini-3-pro
(none set)unchangedunchangedunchanged
enabled: falseincludeThoughts=falseincludeThoughts=falseincludeThoughts=false
minimalincludeThoughts=truelowlow
lowincludeThoughts=truelowlow
mediumincludeThoughts=truemediumlow
highincludeThoughts=truehighhigh
xhighincludeThoughts=truehighhigh

Validation

  • scripts/run_tests.sh tests/agent/transports/test_chat_completions.py tests/agent/test_gemini_cloudcode.py tests/agent/test_gemini_native_adapter.py144 passed
  • E2E: confirmed build_kwargs emits the expected extra_body["thinking_config"] for provider="gemini" / "google-gemini-cli" and leaves provider="openai" untouched; build_gemini_request(thinking_config=...) lands it in the Gemini request as generationConfig.thinkingConfig.

Closes #16941. Supersedes #16945 — original contributor @Nanako0129's authorship preserved via rebase-merge on the primary commit.

Changed files

  • agent/transports/chat_completions.py (modified, +58/-0)
  • run_agent.py (modified, +1/-0)
  • tests/agent/transports/test_chat_completions.py (modified, +85/-1)

Code Example

Report   https://paste.rs/8G80F
agent.log   https://paste.rs/u6RzW
gateway.log   https://paste.rs/2D9aO

---
RAW_BUFFERClick to expand / collapse

Bug Description

When using the official Gemini provider (provider: gemini) with gemini-3-flash-preview, Discord replies do not show any 💭 Reasoning: block even when reasoning is enabled and display.show_reasoning: true.

What happened:

  • reasoning display was enabled
  • Gemini replies completed normally
  • Discord showed no 💭 Reasoning: content before the visible reply

What I expected instead:

  • if reasoning is enabled and the model returns thought content, Discord replies should include the 💭 Reasoning: block

After applying a local fix that bridges Hermes reasoning_config into Gemini thinking_config, the same Discord path shows 💭 Reasoning: as expected.

Steps to Reproduce

  1. Use current main before the fix.
  2. Configure Hermes with:
    • provider: gemini
    • model: gemini-3-flash-preview
    • display.show_reasoning: true
    • reasoning enabled (for example agent.reasoning_effort: high)
  3. Start the Discord gateway / bot.
  4. Send a prompt in Discord that triggers multi-step reasoning.
  5. Observe that the reply completes, but no 💭 Reasoning: block is shown.

Expected Behavior

If Gemini reasoning is enabled and Discord reasoning display is enabled, replies should include a visible 💭 Reasoning: block when the model returns thought content.

Actual Behavior

Replies complete successfully, but Discord shows no 💭 Reasoning: block in this setup.

In local verification after a fix that bridges Gemini thinking_config, the same Discord path shows 💭 Reasoning: again and no runtime error was observed.

Affected Component

Gateway (Telegram/Discord/Slack/WhatsApp)

Messaging Platform (if gateway-related)

Discord

Debug Report

Report   https://paste.rs/8G80F
agent.log   https://paste.rs/u6RzW
gateway.log   https://paste.rs/2D9aO

Operating System

Ubuntu 24.04

Python Version

Python 3.11.15

Hermes Version

v0.11.0 (2026.4.23)

Additional Logs / Traceback (optional)

Root Cause Analysis (optional)

This does not appear to be a Discord-only rendering bug.

Relevant code path:

  • gateway/run.py only prepends 💭 Reasoning: when agent_result["last_reasoning"] exists
  • run_agent.py populates last_reasoning from assistant reasoning fields
  • Gemini adapters normalize thinking_config / thinkingConfig and require includeThoughts to request thought parts
  • the shared chat-completions transport does not bridge Hermes reasoning_config into Gemini thinking_config

That means reasoning can be enabled at the Hermes / gateway layer while the Gemini-backed request still fails to ask for visible thought parts.

In local validation, bridging Hermes reasoning_config into Gemini thinking_config restored visible 💭 Reasoning: output on the Discord path for:

  • provider: gemini
  • model: gemini-3-flash-preview

Scope note:

  • reproduced on the official Gemini provider
  • observed on Discord
  • google-gemini-cli, Hermes CLI, and other gateway platforms were not manually validated

Proposed Fix (optional)

Bridge Hermes reasoning config into Gemini thinking_config conservatively on Gemini-backed chat-completions routes:

  • do not change behavior when no explicit reasoning config is present
  • map Gemini-backed requests to includeThoughts
  • avoid sending unsupported Gemini thinking-level values
  • keep model-family-specific behavior conservative

A local patch following that approach restored 💭 Reasoning: in Discord for provider: gemini + gemini-3-flash-preview.

Are you willing to submit a PR for this?

  • I'd like to fix this myself and submit a PR

extent analysis

TL;DR

Bridge Hermes reasoning_config into Gemini thinking_config to enable visible 💭 Reasoning: output on Discord for Gemini-backed requests.

Guidance

  • Verify that display.show_reasoning is set to true and reasoning is enabled (e.g., agent.reasoning_effort: high) in the Hermes configuration.
  • Check the Gemini adapter code to ensure it correctly normalizes thinking_config and requires includeThoughts to request thought parts.
  • Implement a conservative bridging of Hermes reasoning_config into Gemini thinking_config for Gemini-backed chat-completions routes, avoiding changes to behavior when no explicit reasoning config is present.
  • Test the fix on the Discord platform with the gemini-3-flash-preview model to confirm the 💭 Reasoning: block is displayed as expected.

Example

No code snippet is provided as the issue description already outlines the necessary steps and configuration changes.

Notes

The proposed fix should be applied conservatively to avoid introducing unsupported Gemini thinking-level values or changing behavior when no explicit reasoning config is present. The fix has been locally validated on the official Gemini provider with the gemini-3-flash-preview model on Discord.

Recommendation

Apply the workaround by bridging Hermes reasoning_config into Gemini thinking_config to restore visible 💭 Reasoning: output on Discord for Gemini-backed requests, as this approach has been locally validated and does not introduce significant changes to the existing codebase.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - ✅(Solved) Fix [Bug]: Gemini chat-completions route does not bridge reasoning_config into thinking_config, so Discord show_reasoning stays empty [2 pull requests, 1 participants]