Skip to content

bug: Hermes Agent — gpt-5.6-luna via opencode-go provider returns finish_reason:null (no [DONE]) #40420

Closed as not planned

Description

@jcmpgit

Description

When using opencode-go as a provider in Hermes Agent, every gpt-5.6-luna response fails. The OpenCode Go gateway (https://opencode.ai/zen/go/v1/chat/completions) never sends a terminal finish_reason for this model — streamed or non-streamed: non-streaming returns "finish_reason":null on a complete response, and streaming ends with data: {"choices":[],"cost":"0"} and no [DONE] marker. Hermes requires a terminal event and retries, then errors with "Response remained truncated after 4 continuation attempts" — gpt-5.6-luna is unusable via this provider. All other Go models tested (deepseek-v4-flash, deepseek-v4-pro, kimi-k2.7-code, glm-5.2) return finish_reason: "stop" correctly. Related to but distinct from #36766 (truncated tool args on native OpenAI Responses) — this is the Go gateway omitting the terminal event.

Plugins

N/A — no OpenCode plugins. Consumer is Hermes Agent v0.19.1 (docker, Linux), which fails on every gpt-5.6-luna response.

OpenCode version

N/A — issue is against the hosted Go gateway endpoint, not a local OpenCode install.

Steps to reproduce

  1. POST /chat/completions, model: gpt-5.6-luna, stream: false → HTTP 200, content correct, choices[0].finish_reason: null
  2. Same with stream: true → content chunk arrives with finish_reason: null, then final chunk {"choices":[],"cost":"0"} — no [DONE]
  3. Control (same calls, deepseek-v4-flash / kimi-k2.7-code / glm-5.2 / deepseek-v4-pro) → finish_reason: "stop" and a proper [DONE] chunk

Screenshot and/or share link

No UI screenshot applicable (API-level bug). Verbatim captures from a fresh repro run:

Non-streaming:

{"id":"gen-1785843293-273noTConb4mUERLVDI2","object":"chat.completion","created":1785843294,"model":"gpt-5.6-luna","choices":[{"index":0,"message":{"role":"assistant","content":"OK"},"finish_reason":null}],"usage":{"prompt_tokens":11,"completion_tokens":5,"total_tokens":16}}

Streaming (all data: lines):

data: {"id":"gen-...","object":"chat.completion.chunk","choices":[]}
data: {"id":"","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"content":"OK"},"finish_reason":null}]}
data: {"id":"gen-...","choices":[],"usage":{"prompt_tokens":11,"completion_tokens":5,"total_tokens":16}}
data: {"choices":[],"cost":"0"}

Operating System

Linux (Docker container)

Terminal

N/A — no terminal UI involved. Reproduced with plain curl from a non-interactive container shell (TERM=dumb, no TTY).

Activity

  1. github-actions commented on Aug 4, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    If your issue is distinct (specifically the missing terminal event / [DONE] marker rather than stream quality), please clarify how it differs from #39881 so maintainers can track them separately.

  2. jcmpgit commented on Aug 7, 2026

    @jcmpgit
    Author

    Workaround available (verified working 2026-08-07).

    Confirmed root cause matches #39881: the OpenCode Go chat/completions path never sends a terminal finish_reason / [DONE] for gpt-5.6-luna (and kimi-k3), while other models on the same endpoint return finish_reason:"stop" + [DONE]. Hermes deliberately refuses to fabricate a terminal marker on a text-only stream (guards a real truncation class — NousResearch/hermes-agent#32086), so the response is treated as a mid-stream drop and every turn fails with "Response remained truncated after 4 continuation attempts".

    Since this is an upstream endpoint defect, we shipped a narrow, model-scoped client-side workaround rather than waiting: a patch script that lets Hermes treat luna streams as complete (text IS fully delivered — only the terminal marker is missing):

    https://gist.github.com/jcmpgit/60087ac45da47c58ffe654781bada8fc

    • Applies one boolean clause to the Hermes drop-guard, scoped to gpt-5.6-luna only (extendable to kimi-k3)
    • Backs up the target file before patching; revert restores it
    • Requires restarting the Hermes gateway/dashboard service after apply
    • Note: trade-off is a genuine truncation of the bypassed model would be silently accepted as complete — acceptable as a stopgap

    For maintainers: the fix belongs upstream — either emit finish_reason:"stop" / [DONE] on the chat/completions path for these models, or route luna to the /zen/go/v1/responses path where termination is already correct (see #39881). Happy to run additional probes if useful.

  3. antoniosena-code commented on Aug 8, 2026

    @antoniosena-code

    Confirming reproduction from a second, independent Hermes Agent deployment (v0.20.0, Docker/Linux), fresh probe as of 2026-08-08:

    POST https://opencode.ai/zen/go/v1/chat/completions
    model=gpt-5.6-luna, stream=false, "say OK"
    → HTTP 200, content: "OK", finish_reason: null
    

    Still broken 4+ days after the original report — every Hermes turn on gpt-5.6-luna via this endpoint fails with "Response remained truncated after 4 continuation attempts".

    One additional data point isolating the defect: on the same endpoint, deepseek-v4-flash handled a 369,114-prompt-token request (needle retrieval over ~1.2 M chars) in 6 s and returned finish_reason: "stop" with correct usage accounting. The gateway and its large-context path are healthy; the bug is confined to the terminal-event handling of the luna shim (and reportedly kimi-k3) on the chat/completions path, consistent with the routing analysis in #39881.

  4. github-actions commented on Oct 9, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions