Skip to content

Bug: DeepSeek V4 Flash incomplete turn (payloads=0, tools=2, replaySafe=no, stopReason=stop) in 2026.5.27/28 #88657

Closed

Description

@mikefaierberg-byte

Summary

DeepSeek V4 Flash via OpenRouter produces incomplete turns (payloads=0, tools=2, replaySafe=no, stopReason=stop) in OpenClaw 2026.5.27 and 2026.5.28. The model worked without issues in 2026.5.26.

Steps to reproduce

  1. Configure openrouter/deepseek/deepseek-v4-flash as primary model
  2. Send any message that triggers tool calls (e.g. "search for X" or "read file Y")
  3. After a few turns, especially when the conversation context grows, the model starts generating partial tool calls — it begins {"tool_calls": [{"function": {"name": "... but stops mid-JSON with stopReason=stop
  4. Since replaySafe=no, OpenClaw does not retry the turn — surfaces "Agent couldn't generate a response"

Expected behavior

Incomplete turns from the model should be retried (at least once) even when replaySafe=no, or the underlying cause of partial tool call generation from DeepSeek Flash on OpenRouter should be fixed.

Actual behavior

incomplete turn detected: provider=openrouter/deepseek/deepseek-v4-flash stopReason=stop payloads=0 tools=2 replaySafe=no planningRetries=0/1 reasoningRetries=0/2 emptyRetries=0/1 missingAssistantRetries=0/1 — surfacing error to user

The model receives stopReason=stop (not length, not content_filter), meaning the model itself decided to stop — but it stopped before completing the tool call JSON. OpenClaw then checks replaySafe=no and refuses to retry.

Context

  • OpenClaw: 2026.5.28 (also broken on 5.27; worked on 5.26)
  • Model: openrouter/deepseek/deepseek-v4-flash
  • Provider: OpenRouter (https://openrouter.ai/api/v1)
  • OS: Ubuntu 24.04, npm global install
  • Install method: npm global

What was tried (did not help)

  • queue.mode=interrupt + debounceMs=1000
  • session-memory.enabled=false
  • thinkingDefault=off
  • timeoutSeconds=120
  • Compaction adjustments (reserveTokens=20000, keepRecentTokens=40000)

Workaround

Switching to openrouter/deepseek/deepseek-v4-pro eliminates the issue — Pro completes tool calls reliably. This is expensive compared to Flash.

Notes

  • deepseek-v4-flash via native DeepSeek API (api.deepseek.com) reportedly works fine — the issue appears to be specific to the OpenRouter bridge for Flash
  • The replaySafe=no + emptyRetries=0/1 logic means no retry occurs at all, which makes the agent fully unusable when this happens

Activity

  1. clawsweeper commented on May 31, 2026

    @clawsweeper
    Contributor

    Thanks for the context here. I did a careful shell check against current main, and this is already implemented.

    Current main implements a safer recovery for the reported settled post-tool empty-stop boundary: it runs one isolated, tools-disabled finalizer rather than replaying side-effectful tools. The latest release supplied in context predates the fixing commit, so this is fixed on current main only.

    So I’m closing this as already implemented rather than keeping a duplicate issue open.

    Review details

    Best possible solution:

    Keep the current settled-tool finalizer, which preserves completed side effects and requests only the missing user-visible response.

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

    Yes, source-reproducible: current-main logic explicitly recognizes the required-reply, settled-tool, empty-stop boundary described by the newest live report and dispatches an isolated finalizer. This read-only review did not run a live provider.

    Is this the best way to solve the issue?

    Yes: a tools-disabled finalizer is safer than blindly retrying the original replay-unsafe turn because it retains the settled transcript without re-executing tools.

    Security review:

    Security review: No proposed patch is under review.

    AGENTS.md: found and applied where relevant.

    What I checked:

    Likely related people:

    • Peter Steinberger: Authored the merged empty-final-response recovery commit and is the recorded author of the current recovery lines. (role: recent recovery-path contributor; confidence: high; commits: 9a0ea5d69b6e; files: src/agents/embedded-agent-runner/run/incomplete-turn-recovery.ts, src/agents/embedded-agent-runner/run/terminal-resolution.ts)
    • joshavant: Authored the commit that introduced the settled-tool finalization surface used by the current recovery path. (role: introduced settled-turn finalization; confidence: high; commits: 6eea20ce181e; files: src/agents/embedded-agent-runner/run/settled-turn-finalization.ts, src/agents/harness/builtin-openclaw.ts)

    Codex review notes: model internal, reasoning high; reviewed against 1c80cf86cfd0; fix evidence: commit 9a0ea5d69b6e, main fix timestamp 2026-08-10T13:24:11-07:00.

  2. added
    P2Normal backlog priority with limited blast radius.
    impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.
    impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.
    issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.
    clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.
    clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.
    clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.
    clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.
    on May 31, 2026
  3. mondychan commented on Jun 1, 2026

    @mondychan

    quick and dirty fix is changing the config key

    from
    "api": "openai-completions",
    to
    "api": "anthropic-messages",

  4. DaleXiao commented on Jun 8, 2026

    @DaleXiao

    Additional live repro: github-copilot + claude-opus-4.8, stopReason=toolUse variant (OpenClaw 2026.6.1)

    Confirming this class of incomplete-turn failure on a different provider/model, with the replaySafe=no + tools>0 combination — providing the live repro this issue is tagged as needing (needs-live-repro).

    Environment:

    • OpenClaw 2026.6.1 (2e08f0f)
    • Provider/model: github-copilot/claude-opus-4.8 (api: anthropic-messages, contextWindow 1M)
    • Interactive Discord DM session (not cron)

    Log signature (reproduced dozens of times in a single session):

    [agent/embedded] incomplete turn detected: provider=github-copilot/claude-opus-4.8
    stopReason=toolUse hasLastAssistant=yes hasCurrentAttemptAssistant=yes
    payloads=1 tools=3 replaySafe=no — surfacing error to user
    

    User receives: ⚠️ Agent couldn't generate a response. Note: some tool actions may have already been executed… — the real assistant reply is discarded and replaced with this fallback.

    Trigger conditions:

    • Multi-tool turns, especially with side-effectful tools (exec / edit), hence replaySafe=no.
    • Context was only ~198k / 1M (20%) when it fired, so this is not context-overflow.
    • Intermittent but frequent. Gateway restart and brand-new sessions do not resolve it.
    • Fallback chain includes claude-opus-4.7; failover events still surfaced the same error.
    • A tools=0 replaySafe=yes variant also occurs in the same session.

    How this differs from existing open work: this is the stopReason=toolUse variant — distinct from the stopReason=stop after update_plan case in #80918, and from the stopReason=length/missing truncation in #89160 (whose tests explicitly assert toolUse is not flagged as truncated). None of the current open PRs appear to address this exact toolUse + tools>0 + replaySafe=no combination.

    Happy to provide a full session transcript or run targeted diagnostics on this live environment if a maintainer wants more signal.

  5. lileilei-camera commented on Jun 8, 2026

    @lileilei-camera

    同样遇到了类似问题,使用 deepseek-v4-pro (deepseek-art/deepseek-v4-pro) 时,模型经常在最后一轮 stop 后只输出 thinking 块没有实际回复内容,且 emptyRetries=0/1 意味着完全不会重试。

    这个问题非常影响使用 —— agent 对话经常无响应就停了,用户那边看到的是空消息。希望能提高优先级解决,至少在思考模型产出空内容时能自动触发一次重试(比如把 thinking 降级为 visible text 再回传)。

    谢谢!

  6. dante4567 commented on Jun 14, 2026

    @dante4567

    Still reproduces on 2026.6.6 (filed here against 2026.5.27/28). Adding a live repro + an isolation result that should narrow this to the embedded agent runner rather than the provider/backend.

    Environment

    • OpenClaw 2026.6.6 (8c802aa), gateway as a systemd user service, embedded runtime.
    • Model: openrouter/deepseek/deepseek-v3.2 (primary), reasoning model, tools.profile: "coding".
    • Frequency: ~8 / 24h. Hits multi-tool agentic turns specifically — cron jobs, the memory-core dreaming "rem" narrative, and interactive sessions alike. tools=N ranges 1–13.

    Log signature (representative)

    [agent/embedded] incomplete turn detected: runId=… sessionId=… provider=openrouter/deepseek/deepseek-v3.2 stopReason=stop hasLastAssistant=yes hasCurrentAttemptAssistant=yes payloads=0 tools=3 replaySafe=no compactions=0 planningRetries=0/1 reasoningRetries=0/2 emptyRetries=0/1 missingAssistantRetries=0/1 — surfacing error to user
    

    replaySafe=no → no retry bucket applies, so it surfaces directly to the user/cron:

    ⚠️ Agent couldn't generate a response. Note: some tool actions may have already been executed — please verify before retrying.
    

    (One cron turn: outcome=error duration=346534ms — i.e. the turn ran for minutes before surfacing.)

    Isolation result — it is NOT the OpenRouter backend

    I tested every tool-capable OpenRouter backend for deepseek/deepseek-v3.2 directly against the OpenRouter API (bypassing OpenClaw), pinning each via provider: {order:[slug], allow_fallbacks:false} and sending a tools[] + reasoning:{effort:"medium"} request that mirrors the gateway's shape:

    Backend finish_reason tool_calls
    baidu, siliconflow, deepinfra, atlas-cloud, alibaba, friendli, google-vertex tool_calls present ✓
    novita (404 on slug — availability, not the bug) —

    All 7 reachable backends return a well-formed finish_reason: "tool_calls" with a real tool call — single-tool and multi-tool prompts (e.g. "call get_weather for Tokyo, Paris, London separately"; the model correctly emits one tool call at a time, never stop). The stopReason=stop + pending tools=N malformation does not reproduce against the raw provider — so it appears to originate inside the embedded agent runner's handling of deepseek-v3.2 reasoning+tool turns across the multi-round loop, not in the upstream completion.

    Note for anyone trying a config workaround

    provider.require_parameters: true does not help and actively breaks deepseek-v3.2: the gateway's request carries a parameter union (reasoning/include_reasoning + tools + response_format + …) that no single backend supports in full, so OpenRouter returns 404 No endpoints found that can handle the requested parameters and the model fails 100% of turns.

    Happy to capture a full request/response trace on a live malformed turn if you can point me at the right log level / env flag to dump the embedded-runner round payloads.

  7. dante4567 commented on Jun 16, 2026

    @dante4567

    Confirming this still happens in 2026.6.6 with deepseek-v3.2 — and a live repro that narrows the cause

    We hit the identical signature on a different deepseek model and two minor versions later, so this isn't Flash-specific or fixed:

    [agent/embedded] incomplete turn detected: runId=… sessionId=…
      provider=openrouter/deepseek/deepseek-v3.2 stopReason=stop
      hasLastAssistant=yes hasCurrentAttemptAssistant=yes payloads=0 tools=9
      replaySafe=no compactions=0 planningRetries=0/1 reasoningRetries=0/2
      emptyRetries=0/1 missingAssistantRetries=0/1 — surfacing error to user
    
    • OpenClaw: 2026.6.6 (8c802aa), system install, systemd user service, tools.profile=coding, reasoning enabled
    • Model: openrouter/deepseek/deepseek-v3.2 (primary), multi-round reasoning+tool turns
    • Frequency: intermittent, ≈1×/day in steady traffic; degrades gracefully via the fallback chain

    New signal: it is not the model stopping mid-JSON, nor an OpenRouter-bridge defect (at least for v3.2)

    The summary here hypothesizes the model "stops before completing the tool call JSON" and that it's "specific to the OpenRouter bridge." We tested that directly. A read-only harness hits the OpenRouter API itself, pinning each tool-capable deepseek-v3.2 backend (provider.order=[slug], allow_fallbacks=false) and mirroring the gateway request shape (a tools[] function + reasoning). On a single-round tool prompt every reachable backend returns a well-formed finish_reason="tool_calls" with a populated tool_calls[]:

    BACKEND          VERDICT     finish_reason  tools  served_provider
    baidu            FAITHFUL    tool_calls     1      Baidu
    siliconflow      FAITHFUL    tool_calls     1      SiliconFlow
    deepinfra        FAITHFUL    tool_calls     1      DeepInfra
    atlas-cloud      FAITHFUL    tool_calls     1      AtlasCloud
    alibaba          FAITHFUL    tool_calls     1      Alibaba
    friendli         FAITHFUL    tool_calls     1      Friendli
    google-vertex    FAITHFUL    tool_calls     1      Google
    novita           ERR(404)    no endpoint    —      —     (unavailable, unrelated)
    

    So a single tool round is faithful end-to-end at the provider. The stopReason=stop + tools>0 malformation only surfaces inside the gateway's multi-round reasoning+tool loop — which points at the runner's round assembly / replay-safety classification rather than the model or the OpenRouter bridge.

    Dead ends (so others can skip)

    • require_parameters: true on provider params backfires → OpenRouter 404, model dies 100%. Rolled back.
    • No config knob we could find changes the incomplete-turn classification.

    Re the product decision (needs-product-decision)

    This strengthens the case for making the turn replay-safe when tools>0 && hasLastAssistant=yes && payloads=0 (re-issue the round) rather than surfacing an error with zero retries. In our data the turn is otherwise recoverable — the prior assistant message is intact and no payload was emitted, yet replaySafe=no spends none of the retry budgets.

    Happy to share the repro harness or adapt it to a minimal gateway-side reproduction.

  8. DaleXiao commented on Jun 17, 2026

    @DaleXiao

    Follow-up to our claude-opus-4.8 repro above (comment): a config-level workaround that empirically eliminated the symptom

    To be explicit up front: this is a workaround, not a root-cause fix. We did not touch the runner's replay-safety classification (the replaySafe=no + zero-retry path is unchanged). We changed model/reasoning config and the toolUse incomplete-turn signature stopped firing in our environment. Sharing the before/after in case it helps others triaging the same signature, and to narrow where the trigger lives.

    What we changed (single hot-reload, 2026-06-14 18:32 local)

    Two edits, applied together via config hot-reload + gateway restart:

    1. Declared reasoning explicitly per github-copilot model (previously the provider's models[] was empty {} and inherited default metadata):
      • claude-opus-4.8: reasoning: true
      • claude-opus-4.7: reasoning: false
      • claude-opus-4.6: reasoning: false
    2. Set params.thinking: "off" on the claude-opus-4.7 fallback.

    Session-level reasoning was also off for the interactive session.

    Before/after (gateway incomplete turn detected counts, same machine, same OpenClaw version)

    The OpenClaw version did not change across this window (steady 2026.6.5), so the config edit was the only variable:

    Date incomplete turn detected (toolUse variant)
    Jun 08 dozens (steady)
    Jun 13 ~35
    Jun 14 (until 18:32) high-frequency, last occurrence 18:32:49
    Jun 14 18:32 → +2.5 days (now) 0

    Last emitted line, 17s after the hot-reload landed and just before the restart:

    Jun 14 18:32:49 [agent/embedded] incomplete turn detected:
      provider=github-copilot/claude-opus-4.8 stopReason=toolUse
      hasLastAssistant=yes hasCurrentAttemptAssistant=yes
      payloads=1 tools=0 replaySafe=yes ... — surfacing error to user
    

    Nothing with this signature has fired since.

    What this suggests (not proves)

    The trigger appears sensitive to the reasoning/thinking configuration of the active + fallback models, not just the provider bridge. Turning reasoning off (and pinning the fallback's thinking: "off") on the github-copilot anthropic-messages path made the toolUse + replaySafe=no malformation stop surfacing entirely in our traffic.

    Caveat / honesty: this is an empirical correlation (symptom gone, timestamps aligned, single changed variable over a steady version) — not a confirmed source-level fix. The underlying product question from the summary still stands: when tools>0 && hasLastAssistant=yes, the turn surfaces an error while spending none of its retry budgets. A reasoning/thinking config change shouldn't be what's load-bearing here.

    Happy to share the exact config diff or run targeted diagnostics on this live environment if a maintainer wants more signal.

  9. 24 remaining items

  10. Suidge commented on Aug 17, 2026

    @Suidge

    Additional live reproduction on a different routing chain:

    • OpenClaw 2026.7.1-2 (0790d9f)
    • macOS arm64, npm global install
    • Provider/model: volcengine-plan/deepseek-v4-flash
    • API: openai-responses
    • Workload: four independent isolated agentTurn cron sessions

    In all four sessions, the model first produced a valid tool call (stopReason=toolUse). The tool completed successfully and returned a normal result. On the follow-up model turn, DeepSeek V4 Flash returned stopReason=stop with an empty text block and zero output tokens. OpenClaw then surfaced:

    Agent couldn't generate a response. Note: some tool actions may have already been executed — please verify before retrying.
    

    Because the completed tool might have had side effects, the run was marked replay-unsafe and was not automatically retried. A controlled minimal tool-follow-up test reproduced the same boundary four times with DeepSeek V4 Flash (0/4 successful final replies), while ark-code-latest, glm-5.3, and deepseek-v4-pro each completed the same pattern successfully (4/4). Plain text-only DeepSeek V4 Flash turns also succeeded.

    This suggests the failure is specifically at the post-tool continuation boundary and is not limited to the original OpenRouter/OpenAI-completions route. A safe recovery should continue to avoid replaying tools with uncertain side effects; the newer tools-disabled finalizer after exact settled-tool evidence appears to be the appropriate direction for this case.

  11. added
    issue-rating: 🦪 silver shellfishThin issue quality; more reproduction proof or environment detail is needed.
    P1High-priority user-facing bug, regression, or broken workflow.
    issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.
    clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.
    and removed
    clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.
    clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.
    clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.
    clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.
    issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.
    P2Normal backlog priority with limited blast radius.
    issue-rating: 🦪 silver shellfishThin issue quality; more reproduction proof or environment detail is needed.
    on Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority user-facing bug, regression, or broken workflow.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions