Skip to content

fix: keep Gemini NO_REPLY replies silent when the signature arrives on its own part - #203174

Merged
obviyus merged 1 commit into
mainfrom
fix/gemini-no-reply-signature-part
Nov 21, 2026
Merged

obviyus merged 1 commit into
mainfrom
fix/gemini-no-reply-signature-part

Conversation

@obviyus

@obviyus obviyus commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

Root cause: src/shared/assistant-answer-text.ts:24 picks only text blocks that carry a signature as the answer, which is meant for OpenAI Responses item ids. Since #170534 (first shipped in 2026.11.5) it also picks empty signed blocks. Gemini 3 sends its thought signature on a separate empty part after the answer, so the selected answer is "", the turn is marked empty rather than silent, and the NO_REPLY text is delivered.

Fixes #203131

Thanks @Avi711 for the clear report and trace.

What Problem This Solves

With Gemini 3 on a google-generative-ai provider, a reply of exactly NO_REPLY reaches the chat as the text "NO_REPLY" instead of ending the turn silently. It happens in direct chats and in automations that announce their result. 2026.8.2 stayed silent.

User Impact

Gemini 3 replies of exactly NO_REPLY end the turn silently again, in direct chats and in announced automations. Normal Gemini answers are delivered as before.

Why This Change Was Made

Signed-block selection now applies only to OpenAI Responses messages, where a text signature is an output item id. A Gemini thought signature is not an item id, so Gemini answers use all of their text blocks.

The Google stream reader still keeps the signature-only part as its own block. That keeps the next request byte-identical: the signature is replayed as its own empty part, as Gemini sent it. Attaching the signature to the previous text block would change those replayed bytes. Responses answer selection is unchanged.

Evidence

Real Gateway (ocx src, isolated profile state) with the QA channel recording deliveries and a local google-generative-ai fixture that streams {"text":"NO_REPLY"} and then {"text":"","thoughtSignature":"..."}. Base is the merge base 423ae09.

Check Base This PR
Direct chat, exact NO_REPLY "NO_REPLY" delivered nothing delivered
Announced automation, exact NO_REPLY "NO_REPLY" delivered (deliveryStatus: delivered) nothing delivered (not-delivered)
Normal answer with trailing signature part, 2 turns delivered once per turn delivered once per turn
Next request replays the signature [{"text":"Here is…"},{"text":"","thoughtSignature":"Q2lN…Sw=="}] identical bytes

The new regression test fails on base (disposition: 'empty', expected 'silent') and passes here; its OpenAI Responses row (signed empty item still wins) passes on both.

Observed proof lines: #203174 (comment)

Merge danger: two-way door. No stored state, config or published contract changes; a revert fully restores the old behavior. Blast radius: answer text selection for non-Responses messages that carry text signatures (Google Gemini), which now use all of their text blocks.

…rate part

- Select signed unphased answer text only for OpenAI Responses messages; a Gemini thought signature is not a Responses item id.

Fixes #203131
@clawsweeper

clawsweeper Bot commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@obviyus

obviyus commented Nov 21, 2026

Copy link
Copy Markdown
Collaborator Author

Observed proof (real Gateway via ocx src, isolated profile state, QA channel recording deliveries, local google-generative-ai fixture streaming {"text":"NO_REPLY"} then {"text":"","thoughtSignature":"..."}). Base = merge base 423ae09, candidate = 1ce04ad.

== base 423ae0907203
dm_noreply alice deliveries=["NO_REPLY"]
dm_normal bob deliveries=["Here is the normal Gemini answer."]
dm_normal bob deliveries_after_turn2=["Here is the normal Gemini answer.","Here is the normal Gemini answer."]
replayed_model_parts_turn2=[[{"text":"Here is the normal Gemini answer."},{"text":"","thoughtSignature":"Q2lNQkFZNjJkR0VOT1JNQUxfQU5TV0VSX1NJRw=="}]]
cron job=0f2b9713-b8a8-4c68-a671-0d32f42ea584
cron_announce carol deliveries=["NO_REPLY"]
cron_runs=[{"status":"ok","completionStatus":"succeeded","delivered":true,"deliveryStatus":"delivered","summary":"NO_REPLY"}]

== candidate 1ce04ad1c0bd
dm_noreply alice deliveries=[]
dm_normal bob deliveries=["Here is the normal Gemini answer."]
dm_normal bob deliveries_after_turn2=["Here is the normal Gemini answer.","Here is the normal Gemini answer."]
replayed_model_parts_turn2=[[{"text":"Here is the normal Gemini answer."},{"text":"","thoughtSignature":"Q2lNQkFZNjJkR0VOT1JNQUxfQU5TV0VSX1NJRw=="}]]
cron job=391ab8b2-ee5f-4803-9b6e-cf203763b528
cron_announce carol deliveries=[]
cron_runs=[{"status":"ok","completionStatus":"succeeded","delivered":false,"deliveryStatus":"not-delivered","summary":null}]

Regression test on base 423ae0907203:
  FAIL selects google-generative-ai answer text around a signed empty part
  expected { disposition: 'empty' } to match object { disposition: 'silent' }
  (openai-responses row passes on base and candidate)

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: XS labels Nov 21, 2026
@obviyus

obviyus commented Nov 21, 2026

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 21, 2026
@clawsweeper

clawsweeper Bot commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR restricts signed-block answer selection to OpenAI Responses so Gemini signature-only parts do not hide the actual answer.

Example: Gemini streams "NO_REPLY" followed by an empty text part carrying thoughtSignature "Q2lNAQ==".

  • Before: The empty signed part becomes the selected answer, and "NO_REPLY" reaches the chat.
  • After: The complete answer is classified as silent, and nothing is delivered.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused shared-owner repair with meaningful regression coverage, Gateway before/after evidence, and no actionable defects.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): Pinned base/head output exercises the real Gateway and Google transport against a local streaming fixture, showing silent direct and announced replies, unchanged normal delivery, and identical next-turn signature replay; this is deterministic provider-fixture proof rather than a live Google run.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Gemini sends the reserved NO_REPLY token into chats instead of ending the turn silently.
Reason: Restores documented behavior for a reported released-version regression, with direction already established by the maintainer-authored PR.

Regression provenance

Possible regression — probable (reviewed change; failure trace). No predecessor PR is attributed.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR repairs a current Gemini reply-classification regression with a focused change and no actionable findings.

Priority: P2
Reviewed head: 1ce04ad1c0bd9d6021c6dfed67e353188089cf28

Before merge

None.

Findings

None.

Agent review details

How this fits together

Provider adapters produce assistant content blocks; the shared answer selector supplies raw answer text to terminal reply preparation, whose recorded disposition controls delivery.

flowchart LR
  A[Provider stream] --> B[Assistant content blocks]
  B --> C[Shared answer selector]
  C --> D[Terminal reply preparation]
  D --> E[Recorded reply disposition]
  E --> F[Chat and automation delivery]
Loading

Technical review

Best possible solution:

Keep the provider-specific selection rule in the existing shared answer owner while preserving Google's original signature-part boundaries.

Do we have a high-confidence way to reproduce the issue?

Current-main source deterministically selects the empty signed block for the reported two-part Gemini response; the supplied Gateway comparison demonstrates the same failure on the merge base.

Is this the best way to solve the issue?

The patch fixes the existing selector's provider distinction, reuses the canonical Responses API set, and avoids altering transport replay or adding a competing silence policy.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against c23cd7f6ec5f.

Provenance checked

  • Shared raw-answer selection keeps the original intent (bd5f760: Preserve raw final-answer bytes and distinguish deliberate silence from missing output while retaining signed Responses item semantics.)
  • Delivery regression suite keeps the original intent (4d5bafa: Consolidate fixtures while retaining distinct delivery behavior checks.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

PR surface

Source +4, Tests +13. Total +17 across 2 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 10 6 +4
Tests 1 13 0 +13
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 23 6 +17

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add P2: Repairs unwanted control-token messages in Gemini chats and announced automations without a broader runtime outage.
  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: Repairs unwanted control-token messages in Gemini chats and announced automations without a broader runtime outage.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 21, 2026, 11:24 AM ET / 16:24 UTC.

@obviyus
obviyus merged commit fcfb114 into main Nov 21, 2026
142 checks passed
@obviyus
obviyus deleted the fix/gemini-no-reply-signature-part branch November 21, 2026 16:34
@obviyus

obviyus commented Nov 21, 2026

Copy link
Copy Markdown
Collaborator Author

Merged in fcfb114. Thanks @Avi711 for the precise trace in #203131. With Gemini 3 on a google-generative-ai provider, an exact NO_REPLY now ends the turn silently again in chats and announced automations, instead of being delivered as text. Signed-block answer selection now applies only to OpenAI Responses item ids, so Gemini's empty signature-only part no longer becomes the whole answer. The signature is still sent back to Gemini unchanged.

scribe-dandelion-cult added a commit to karmaterminal/openclaw that referenced this pull request Nov 22, 2026
…9388 stage 4)

Absorbs openclaw/openclaw main 5a3e6b1
(473 commits past the absorbed 1129d4c, which is the merge-base) into
16541aa, so openclaw#129388's presentation can fast-forward. rerere was off for
the merge; nothing arrived pre-staged.

24 content conflicts:
- Generated, regenerated rather than hand-merged: config-baseline counts
  and sha256 (config:docs:gen; core 2667 + fork 17 = 2684), gateway
  predicates.js (gateway:validators:gen), and the four PostgreSQL state
  catalogs (db:postgres:gen).
- package.json schemaVersions: state 41 (upstream openclaw#201615) with the
  fork's agent 44 (continuation's recipient-authority step; upstream's
  agent ladder is still at 43).
- plugin-sdk-surface-report budgets: upstream's +2 (openclaw#203044) plus the
  fork's unchanged +11 / +4.
- subagent-registry-queries: upstream openclaw#203102 folded
  excludeSuspendedDelivery into excludeSettledDelivery; T1's
  unconditional suspended-unbound skip stays.
- subagent-registry-suspended-delivery: upstream openclaw#202732 restructured the
  discard into discardExpiredSubagentDelivery with the expiry notice in a
  finally block; T1's suspended-unbound outcome still notifies no session.
- agent-runner-result-accounting, update-command-service-command,
  session-reset-service, assistant-answer-text,
  state-port.postgres.test, vitest.database-worker-core-paths: both
  sides kept (imports, openclaw#201615 permission checks beside the reset
  retention, openclaw#203174's Responses-only signed selection with the fork's
  per-item answers, both port fixtures, both worker-path lists).
- update-cli tests (openclaw#200578 deleted the in-place Git runner): upstream's
  deletions win; the fork's compiler-flag argv matchers are carried onto
  upstream's rewritten checks.

Refs openclaw#129388

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 22, 2026
…n its own part (openclaw#203174)

Root cause: src/shared/assistant-answer-text.ts:24 picks only text blocks that carry a signature as the answer, which is meant for OpenAI Responses item ids. Since openclaw#170534 (first shipped in 2026.11.5) it also picks empty signed blocks. Gemini 3 sends its thought signature on a separate empty part after the answer, so the selected answer is `""`, the turn is marked empty rather than silent, and the `NO_REPLY` text is delivered.

Fixes openclaw#203131

Thanks @Avi711 for the clear report and trace.

## What Problem This Solves

With Gemini 3 on a `google-generative-ai` provider, a reply of exactly `NO_REPLY` reaches the chat as the text "NO_REPLY" instead of ending the turn silently. It happens in direct chats and in automations that announce their result. 2026.8.2 stayed silent.

## User Impact

Gemini 3 replies of exactly `NO_REPLY` end the turn silently again, in direct chats and in announced automations. Normal Gemini answers are delivered as before.

## Why This Change Was Made

Signed-block selection now applies only to OpenAI Responses messages, where a text signature is an output item id. A Gemini thought signature is not an item id, so Gemini answers use all of their text blocks.

The Google stream reader still keeps the signature-only part as its own block. That keeps the next request byte-identical: the signature is replayed as its own empty part, as Gemini sent it. Attaching the signature to the previous text block would change those replayed bytes. Responses answer selection is unchanged.

## Evidence

Real Gateway (`ocx src`, isolated profile state) with the QA channel recording deliveries and a local `google-generative-ai` fixture that streams `{"text":"NO_REPLY"}` and then `{"text":"","thoughtSignature":"..."}`. Base is the merge base 86d4751.

| Check | Base | This PR |
|---|---|---|
| Direct chat, exact `NO_REPLY` | "NO_REPLY" delivered | nothing delivered |
| Announced automation, exact `NO_REPLY` | "NO_REPLY" delivered (`deliveryStatus: delivered`) | nothing delivered (`not-delivered`) |
| Normal answer with trailing signature part, 2 turns | delivered once per turn | delivered once per turn |
| Next request replays the signature | `[{"text":"Here is…"},{"text":"","thoughtSignature":"Q2lN…Sw=="}]` | identical bytes |

The new regression test fails on base (`disposition: 'empty'`, expected `'silent'`) and passes here; its OpenAI Responses row (signed empty item still wins) passes on both.

Observed proof lines: openclaw#203174 (comment)

Merge danger: two-way door. No stored state, config or published contract changes; a revert fully restores the old behavior. Blast radius: answer text selection for non-Responses messages that carry text signatures (Google Gemini), which now use all of their text blocks.

Co-authored-by: Ayaan Zaidi <[email protected]>
tideclaw-bot pushed a commit that referenced this pull request Nov 30, 2026
…n its own part (#203174)

Root cause: src/shared/assistant-answer-text.ts:24 picks only text blocks that carry a signature as the answer, which is meant for OpenAI Responses item ids. Since #170534 (first shipped in 2026.11.5) it also picks empty signed blocks. Gemini 3 sends its thought signature on a separate empty part after the answer, so the selected answer is `""`, the turn is marked empty rather than silent, and the `NO_REPLY` text is delivered.

Fixes #203131

Thanks @Avi711 for the clear report and trace.

## What Problem This Solves

With Gemini 3 on a `google-generative-ai` provider, a reply of exactly `NO_REPLY` reaches the chat as the text "NO_REPLY" instead of ending the turn silently. It happens in direct chats and in automations that announce their result. 2026.8.2 stayed silent.

## User Impact

Gemini 3 replies of exactly `NO_REPLY` end the turn silently again, in direct chats and in announced automations. Normal Gemini answers are delivered as before.

## Why This Change Was Made

Signed-block selection now applies only to OpenAI Responses messages, where a text signature is an output item id. A Gemini thought signature is not an item id, so Gemini answers use all of their text blocks.

The Google stream reader still keeps the signature-only part as its own block. That keeps the next request byte-identical: the signature is replayed as its own empty part, as Gemini sent it. Attaching the signature to the previous text block would change those replayed bytes. Responses answer selection is unchanged.

## Evidence

Real Gateway (`ocx src`, isolated profile state) with the QA channel recording deliveries and a local `google-generative-ai` fixture that streams `{"text":"NO_REPLY"}` and then `{"text":"","thoughtSignature":"..."}`. Base is the merge base 423ae09.

| Check | Base | This PR |
|---|---|---|
| Direct chat, exact `NO_REPLY` | "NO_REPLY" delivered | nothing delivered |
| Announced automation, exact `NO_REPLY` | "NO_REPLY" delivered (`deliveryStatus: delivered`) | nothing delivered (`not-delivered`) |
| Normal answer with trailing signature part, 2 turns | delivered once per turn | delivered once per turn |
| Next request replays the signature | `[{"text":"Here is…"},{"text":"","thoughtSignature":"Q2lN…Sw=="}]` | identical bytes |

The new regression test fails on base (`disposition: 'empty'`, expected `'silent'`) and passes here; its OpenAI Responses row (signed empty item still wins) passes on both.

Observed proof lines: #203174 (comment)

Merge danger: two-way door. No stored state, config or published contract changes; a revert fully restores the old behavior. Blast radius: answer text selection for non-Responses messages that carry text signatures (Google Gemini), which now use all of their text blocks.

Co-authored-by: Ayaan Zaidi <[email protected]>
(cherry picked from commit fcfb114)

Follow-ups: e58ca10 fix: preserve runtime custody, inference history, and recovery (#203901) [not selected for this narrow backport]; 44f7c52 fix: keep automations silent when the model closes its reasoning before NO_REPLY (#203432) [not selected for this narrow backport]; 6c2ff33 fix(cron): optional-silent cron run fails after the agent collects its collector child's result (#164949) [not selected for this narrow backport]; a9c1dd8 fix(agents): answer Control UI users once after a child finishes (#204098) [separately ordered lane row]

Co-authored-by: RomneyDa <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Gemini 3 NO_REPLY is delivered as text: a signature-only stream part is read as the whole answer (2026.11.5+)

1 participant