fix(prompt): restore the upstream no-chitchat constraint for Google models #136507
<!-- hermes-autotriage -->
<!-- action=reviewed pr=136507 head=d429b6c at=2026-10-11T08:42Z -->
The change is safe. It only applies to Gemini/Gemma, and the OpenCode no-chitchat bullet it restores is reasonable. Tests pass locally (test_google_model_operational_guidance.py + test_system_prompt.py, 76 passed). I'm not sure it fixes the symptom in #136497, though, and it's worth confirming before this closes the issue:
1. The samples in #136497 read like Gemini thought summaries, not preambles. Gemini emits its thought summaries as a bold title followed by first-person narration, which is exactly the shape of Confirming Understanding\n\nI am currently... and Assessing Model Tier\n\nMy focus is.... Normal conversational preambles ("Okay, I will now...") don't look like that. If those are thought parts reaching content, no system-prompt wording will suppress them. The fix would then be in the transport: the native adapter already separates part.thought is True (agent/gemini_native_adapter.py:616), and the OpenAI-compat path sends include_thoughts: True (agent/transports/chat_completions.py:189). The issue is labeled needs-repro, so knowing which transport the reporter is on (native gemini, Vertex, the OpenAI-compat endpoint, or OpenRouter) and whether reasoning.effort: none makes the headers go away would tell us which fix is right.
2. If it really is preamble text, Fixes #136497 is fine. Even then, a prompt nudge is probabilistic, so "Refs" may be more accurate until the reporter confirms.
3. Test shape: test_guidance_carries_upstream_no_chitchat_bullet asserts literal prompt wording ("- No chitchat:", "postambles"). That's close to the change-detector pattern AGENTS.md asks us to avoid, because any rewording breaks it without a behavior change. The two injection tests (Gemini gets it, grok doesn't) are the real contract, and they could check for the Google model operational directives header instead of the bullet text.
Since these strings go into the stable system prompt, they only change on a new session, so prompt caching is fine.
Thanks for looking into this @PRATHAMESH75! Here are the environment and reproduction details from our setup:
1. Transport & Provider:
- We are running on provider: vertex (Google Cloud Vertex AI using Application Default Credentials / OAuth2 token).
- Under the hood, this uses Hermes's standard chat_completions transport pointing to Vertex's OpenAI-compatible endpoint (https://{region}-aiplatform.googleapis.com/v1beta1/projects/{project}/locations/{region}/endpoints/openapi).
- Model: google/gemini-3.8-flash.
2. Preamble vs. Thought Summary:
- In agent/transports/chat_completions.py (line 547), thinking_config (and include_thoughts) is currently only attached when provider_name == "gemini", but not for provider: vertex.
- The emitted text (Confirming Understanding, Assessing Model Tier, etc.) is received as standard streaming content deltas. It directly reflects Gemini's behavioral tendency when instructed to "Keep explanatory text brief — a few sentences, not paragraphs. Focus on actions and results over narration" without the upstream negative constraints (No chitchat / preambles).
3. Regarding PR #136507:
- Restoring the upstream OpenCode No chitchat negative constraint directly bounds the Conciseness bullet and is definitely necessary for Google models regardless of transport.
- If Vertex also exposes thoughts in content, extending chat_completions.py to forward thinking_config to provider: vertex as well would be a great complementary fix!
Thanks for the detailed environment info — very helpful.
One clarification on point 2: for provider: vertex, requests don't go through the legacy provider_name == "gemini" branch in chat_completions.py. Vertex has its own provider profile (plugins/model-providers/vertex/__init__.py, in place since July) whose build_extra_body() already forwards exactly what you're suggesting: extra_body.google.thinking_config in the snake_case form the Vertex OpenAI-compatible endpoint documents (and its google-vertex / vertex-ai / gcp-vertex / vertexai aliases resolve to the same profile). So a Vertex route does emit thinking_config — e.g. {"include_thoughts": true, "thinking_level": "medium"} for gemini-3.8-flash at medium effort, or thinking_budget: 0 when reasoning is set to none. No second chat_completions.py change is needed for this.
That leaves the two symptoms usefully separated, matching @PRATHAMESH75's question:
1. If the bold-title blocks disappear when reasoning is set to none (thinkingBudget 0), they were thought summaries — a transport/thinking-level concern, not something a prompt change can address.
2. If they persist with thinking off, they're genuine preambles the model narrates as regular content — which is what the restored no-chitchat constraint in this PR bounds (and as you note, that fix applies to Google models regardless of transport).
Either way the prompt-side fix here stays valid on its own.
PRATHAMESH75
liuhao1024
What does this PR do?
GOOGLE_MODEL_OPERATIONAL_GUIDANCEwas adapted from OpenCode'sgemini.txt, but the adaptation dropped the upstream negative constraint against conversational filler and preambles. With only theConcisenessbullet surviving, Gemini models read it as a mandate to open every action with an unsolicited English preamble or step header (e.g.Confirming UnderstandingI am currently...) emitted directly in message
content— even in non-English conversations and on turns with no tool calls. Because these preambles are content (notreasoning_content/thought fields), gateways cannot suppress them viadisplay.show_reasoning: falseortool_progress: off.This restores the upstream OpenCode
No Chitchatbullet verbatim, placed directly after theConcisenessbullet it bounds, so the negative constraint travels with the instruction that triggers the behavior. TheConcisenessbullet itself is kept: it is a useful upstream instruction, and the missing piece was the negative constraint, not an excess one.Related Issue
Fixes #136497
Type of Change
Changes Made
agent/prompt_builder.py— added the upstream- No chitchat: Avoid conversational filler, preambles (...), or postambles (...). Get straight to the action or answer.bullet toGOOGLE_MODEL_OPERATIONAL_GUIDANCE, next to theConcisenessbullet, with a comment noting why the negative constraint must stay.tests/agent/test_google_model_operational_guidance.py— new regression tests pinning the restored bullet and its Gemini/Gemma-only injection (agrokmodel passes the enforcement gate but must not receive the Google guidance).How to Test
1.
.venv/bin/python -m pytest tests/agent/test_google_model_operational_guidance.py -q— 3 passed.2.
.venv/bin/python -m pytest tests/agent/test_system_prompt.py -q— 72 passed; 4 pre-existing failures reproduce identically on a clean upstream/main checkout (home_io_guard environment, unrelated to this diff).3.
python scripts/check --staged— the only FAILED lane ishealthwith 40 blocking findings, the same count as the main baseline; none reference the changed files.Observed result: the guidance injected for
google/gemini-3.8-flashnow contains the upstream no-chitchat/preamble/postamble negative constraint; non-Google models that pass the enforcement gate (e.g.x-ai/grok-4) still do not receive the Google block.Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passpython scripts/checkpasses (the blocking lint and code-health checks CI runs)Documentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/A