Skip to content

[Bug]: #39684 fallback still triggers 4x 400 retries (~4s overhead) on every title generation for text-only Claude models #40038

Closed

Description

@KevinXC5

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/server

Steps to reproduce

  1. Configure a Claude provider instance with a text-only custom model behind an Anthropic-compatible proxy/endpoint (e.g. InceptionAI mercury-3, which returns 400 invalid_request_error: Image inputs are not supported for this model).
  2. Set Text Generation (textGenerationModelSelection) to that text-only model.
  3. Open any thread containing an image attachment and trigger Regenerate title (or start a new thread with an image attachment).
  4. Inspect the proxy request log and T3 Code's server.trace.ndjson.
  5. Repeat on another thread with an image attachment.

Expected behavior

After #39684 (fixing #39675), text-only models should not repeatedly waste ~4 seconds and 4 failed image-upload requests on every single title/branch generation for threads containing images.

Either (or both):

  1. Provide a setting/toggle to disable sending image attachments for text generation (e.g. in Text Generation settings or per custom model such as supportsImages: false), so users configuring a text-only model can opt out cleanly.
  2. Cache/remember that a given (instanceId, model) rejected image inputs (at least in-memory for the server lifetime or until settings change) so subsequent text generation calls skip the image attempt and go straight to text-only.

Actual behavior

Related to #39675 and #39684 (this is a follow-up, not a duplicate: #39684 prevents hard failure, but leaves a severe per-call retry/latency penalty).

Because ClaudeTextGeneration.ts always tries runClaudeAttempt(true) with base64 image blocks first and does not remember image-rejection or allow opting out:

  • On every call with images, the first claude -p process receives 400 invalid_request_error ("Image inputs are not supported for this model"), and Claude Code CLI retries internally 4 times (modifying tool/parameter payloads while still resending the full base64 image every time) before exiting non-zero.
  • Only after all 4 failed HTTP requests does T3 Code spawn the second text-only claude -p, which succeeds immediately on 1 request.

Measured on a single title regeneration (from server.trace.ndjson + local proxy log):

  • 1st runClaudeJson.runClaudeCommand (with image, 4× HTTP 400 inside Claude CLI): 3.89 s, uploading ~350 KB of image data 4 times (~1.4 MB wasted)
  • 2nd runClaudeJson.runClaudeCommand (text-only fallback, 1× HTTP 200): 2.00 s (~20 KB payload)
  • Total: 5.91 s instead of 2.00 s (~3× slower), while continuously incrementing upstream/proxy failure counters (which can also trip proxy health/circuit-breaker metrics).

Impact

Major degradation or frequent failure

Version or commit

v0.1.12-nightly.20261120.4994 (includes #39684 / 7fcec36)

Environment

macOS, T3 Code (Nightly) 0.1.12-nightly.20261120.4994, Claude Code CLI 2.1.329, Anthropic-compatible proxy routing to InceptionAI mercury-3

Logs or stack traces

# T3 Code server.trace.ndjson (single generateThreadTitle call):
runClaudeJson.runClaudeCommand (attempt 1, with images): durationMs=3888.50
runClaudeJson.runClaudeCommand (attempt 2, text-only):   durationMs=2000.63
TextGeneration.generateThreadTitle:                      durationMs=5907.48

# Local proxy requests during that single title regeneration:
# Session 1 (1st claude -p, 4x 400 with ~351KB image each; note tools payload drops from 605 -> 401 bytes on retries 3-4):
21:35:13.019 status=400 ms=1381 up_bytes=371116 up_parts={system:12673, tools:605, images:350820} err="Image inputs are not supported for this model"
21:35:14.452 status=400 ms=558  up_bytes=371116 up_parts={system:12673, tools:605, images:350820} err="Image inputs are not supported for this model"
21:35:15.045 status=400 ms=791  up_bytes=371116 up_parts={system:12680, tools:401, images:351013} err="Image inputs are not supported for this model"
21:35:15.862 status=400 ms=392  up_bytes=371116 up_parts={system:12680, tools:401, images:351013} err="Image inputs are not supported for this model"

# Session 2 (2nd claude -p, text-only fallback):
21:35:16.605 status=200 ms=1663 up_bytes=20634  up_parts={system:12885, tools:615}

Workaround

Switch Text Generation to a vision-capable model instead of a fast text-only custom model.

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