Skip to content

fix(title): fall back to json_object response_format on provider rejection - #82751

Open
defgn wants to merge 1 commit into
NousResearch:mainfrom
defgn:fix/title-generator-json-object-fallback
Open

defgn wants to merge 1 commit into
NousResearch:mainfrom
defgn:fix/title-generator-json-object-fallback

Conversation

@defgn

@defgn defgn commented Aug 9, 2026

Copy link
Copy Markdown

Problem

Two-stage session titling (instant derived title, then an LLM "upgrade" to a short summary) fails for providers that reject the strict json_schema response_format. DeepSeek V4 returns HTTP 400 ("This response_format type is unavailable now"), the title task returns None, and the raw derived title ([Display Name] first words…) sticks forever.

Root cause

generate_title sends extra_body={"response_format": _TITLE_RESPONSE_FORMAT} (json_schema) unconditionally. Some providers only support json_object. Because callers treat a None title as "keep the derived title", the failure is silent — no error surfaces to the user.

Fix

Retry the title call with {"type": "json_object"} when the json_schema call raises. The prompt already demands a single JSON object and _extract_title_text's loose scan tolerates non-compliant output, so the looser hint is safe.

Verification

  • Live deployment with DeepSeek V4 as the title provider: before → threads stuck with [Name] <first words…>; after → clean 3–7 word summaries land ~3s after thread creation.
  • The json_schema path is still attempted first; the fallback only fires on provider rejection and is logged at warning level.
  • Models that accept json_schema (e.g. openai-api) are unaffected.

…ction

Two-stage session titling sends response_format=json_schema, which some
providers (DeepSeek V4) reject with HTTP 400. The title task then returns
None and the raw derived title sticks forever, silently. Retry the title
call with {"type": "json_object"} when the strict call raises; the prompt
already demands a single JSON object and _extract_title_text tolerates
non-compliant output.
@alt-glitch alt-glitch added type/bug Something isn't working comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint provider/deepseek DeepSeek API P3 Low — cosmetic, nice to have duplicate This issue or pull request already exists labels Aug 9, 2026
@alt-glitch

Copy link
Copy Markdown

This was generated by AI during triage.

Duplicate of #82073. Both implement the same json_schema-to-json_object retry for title generation; #82073 is the safer tested canonical version because it only retries a response-format rejection.

@defgn
defgn marked this pull request as ready for review August 9, 2026 22:13
viz-A-viz added a commit to viz-A-viz/hermes-agent that referenced this pull request Aug 10, 2026
Title generation hardcodes a strict json_schema response_format with no
fallback. Providers without structured-output support (DeepSeek returns
HTTP 400 "This response_format type is unavailable now") fail the whole
call and the session keeps its truncated derived name.

Walk a constraint ladder instead: json_schema -> json_object -> no
response_format, pinning thinking off on retries so default-on reasoning
models (DeepSeek V4) don't burn the 64-token budget on reasoning and
return an empty content field. Failures unrelated to response_format
(auth, quota, network) break out immediately - a different format cannot
fix those.

Unlike the other open PRs for this bug (NousResearch#82073, NousResearch#82372, NousResearch#82751, NousResearch#82868,
NousResearch#82890), the retried calls also send thinking: {"type": "disabled"} -
without it DeepSeek answers with an empty content and the title still
never appears, even though the 400 is gone.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint duplicate This issue or pull request already exists P3 Low — cosmetic, nice to have provider/deepseek DeepSeek API type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants