Skip to content

D5 follow-up: /generate and /batch/generate still return 500 for over-KV CUDA prompts #4619

Closed as not planned

Description

@noahgift

Follow-up to #4616 / PR #4614 (OPERATOR D5: an over-length request must get a clear 4xx, never a 500).

The non-author pr-review receipt for #4614 (sonnet-5; agy gemini corroborated it) measured that try_cuda_generate (crates/aprender-serve/src/api/batch_processing.rs:492) and try_cuda_batch_generate (batch.rs:515) map every CUDA error to 500. So /generate and /batch/generate still turn an over-KV prompt into a 500. The CUDA chat, completions and stream handlers do not; #4614 fixed those.

Fix: the same serve_context_refusal pre-flight, plus generation_error_status, on both paths. It was kept out of #4614 so that PR's signed receipt stays valid.

Gate question for the cop: does any gate-named serve cell hit /generate? If one does, this joins the rc.2 set.

Activity

  1. noahgift commented on Sep 28, 2026

    @noahgift
    MemberAuthor

    Scope note (2e, read-only): the ladder calls /v1/chat/completions, /v1/completions and /api/chat, never /generate (scripts/model_ladder.sh:778, check_ladder_serve_verdict.sh), so this is off the gate path. Separate observation: the Ollama /api/chat and /api/generate reshape (apr-cli serve/ollama.rs:350, openai_response_to_parts:304) drops the inner status and returns 200 with the error text as content. An over-length refusal (400) there becomes a 200 whose body is the error. That is by design (PMAT-923: 'ALWAYS yields parts'), but a gate reading only HTTP status on /api/chat would count it as a pass. The cop should decide whether that needs a ticket.

  2. added this to the 0.71.0 milestone on Oct 8, 2026
  3. noahgift commented on Oct 14, 2026

    @noahgift
    MemberAuthor

    merged into #5312 (master ticket for epic #3994; triage rule 7b, 2026-10-14). It is a checklist row there; reopen this issue when work on it starts or its PR opens.

  4. noahgift commented on Oct 14, 2026

    @noahgift
    MemberAuthor

    Moved: this sub-ticket is now a row in #5329 (apr serve request path: BPE tokenization, graceful drain, no 500 on oversize prompts), split out of #5312 by theme.

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 priorityowner:la-0.71Owned by the 0.71 look-ahead slotsize:MK̂ 3-4 h

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions