Skip to content

Session title generation fails for Claude models via Antigravity provider (OpenCode) #1394

@edxeth

Description

@edxeth

Is it a request payload issue?

  • No, it's another issue.

Describe the bug
OpenCode session title generation fails when using Claude models through the Antigravity provider. Sessions show "New session - 2026-02-02T13:00:43.469Z" instead of descriptive titles like "Friendly greeting".

This affects only Claude models routed through CLIProxyAPI. Gemini and OpenAI models through the same proxy generate titles correctly.

Root Cause Analysis:
After investigating both OpenCode and CLIProxyAPI codebases, the issue appears related to:

  1. Recent refactor (commit ac802a4) that removed selectInstructions and OpenCode User-Agent handling
  2. Streaming response translation for small/simple requests - the title agent sends a minimal streaming request that may not be properly translated back to Claude format
  3. The gzip fix in code_handlers.go:176-195 attempted to address this but doesn't fully resolve it

OpenCode's title generation flow:

  1. packages/opencode/src/session/summary.ts:summarizeMessage() triggers the "title" agent
  2. Uses LLM.stream() with a small model (defaults to Claude Haiku or similar)
  3. Request goes through CLIProxyAPI → Antigravity backend → response translation
  4. The translated response either returns empty or malformed, causing title generation to silently fail

CLI Type
Antigravity (Claude Code compatible)

Model Name

  • gemini-claude-opus-4-5-thinking
  • gemini-claude-sonnet-4-5-thinking
  • gemini-claude-sonnet-4-5

(Any Claude model routed through Antigravity provider)

LLM Client
OpenCode v1.1.48

Request Information
The title generation request is a simple streaming request to /v1/messages with:

  • Small payload (just a text summarization prompt)
  • stream: true
  • Uses the "title" agent system prompt

The request originates from OpenCode's Vercel AI SDK integration hitting http://localhost:8317/v1/messages.

Expected behavior
Session titles should be generated and displayed (e.g., "Friendly greeting", "TypeScript math utility functions") instead of "New session - {timestamp}".

OS Type

  • OS: Ubuntu 24.04.3 LTS (WSL2)
  • Architecture: x64

Additional context
Workaround: Setting "small_model": "google/gemini-3-flash-preview" in OpenCode's opencode.json bypasses the issue by routing title generation requests directly to Google instead of through CLIProxyAPI.

Relevant CLIProxyAPI files to investigate:

  • sdk/api/handlers/claude/code_handlers.go - handleStreamingResponse() and handleNonStreamingResponse()
  • internal/runtime/executor/claude_executor.go - ExecuteStream()
  • internal/translator/claude/gemini/claude_gemini_response.go - streaming response translation

The issue likely started after recent refactors to the translator layer. The fact that the gzip fix specifically mentions "title generation" suggests awareness of this issue area.

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