Skip to content

fix: name the provider, endpoint, model and status of a failed model call - #236

Merged
goldbarth merged 1 commit into
mainfrom
fix/model-call-failure-names-endpoint
Sep 23, 2026
Merged

goldbarth merged 1 commit into
mainfrom
fix/model-call-failure-names-endpoint

Conversation

@goldbarth

Copy link
Copy Markdown
Owner

Closes #234

  • Read off the wire, below both SDKs: a handler under the provider clients (next to the request count from feat(observability): record how long each model call took and how often it was retried #229) keeps the last error response of the call in progress - address, status, the endpoint's own message. Both SDKs word their exceptions differently (Status Code: NotFound vs HTTP 404 (...)) and neither names the address; read here, they come out the same and no provider exception type is named.
  • Written where all three are known: FailureDescribingChatClient wraps the provider client in the composition root, the one place that knows provider, endpoint and model. The domain still sees an exception with a message, so ReleaseChangelogGenerator is unchanged.
  • The message: <provider> at <address> answered <status> for model '<model>'., then what the status usually means, then The endpoint said: .... The address is the one requested, which shows a doubled or missing /v1; query and user info are left out, since some providers take a key there.
    • 404: the model id is not served (check llm.model), or Chartula__Llm__BaseUrl is not this provider's API. Without a base URL only the model is named - the endpoint is the provider's own.
    • 401/403: names the key variable; a 401 with the variable unset (possible with openai-compatible) says so.
    • No answer at all: the configured endpoint and the transport's reason (Connection refused (...)), not the SDK's I/O exception around it.
  • Said once: audiences that failed with the same text print it under the first and The same as Technical. under the rest. Continuation lines are indented under their audience instead of starting flush left.
  • A failed thorough check no longer crashes the run: found while reproducing. With faithfulness.model set to a model the endpoint does not serve, the check's call threw out of the pipeline as an unhandled exception with a stack trace and a core dump, and the renderings were lost. It is now NotEvaluated with the same explanation, naming faithfulness.model; the rendering is kept and flagged, as for an unreadable verdict. Cancellation still propagates.
  • Merges cleanly with fix(llm): refuse a base URL that belongs to another provider's API #235 (An Anthropic key is sent to an OpenAI endpoint when the provider is not set #233), which touches another part of LlmServiceCollectionExtensions.
  • Docs: cli.md (When a model call fails), configuration.md (the 401 sentence).

Reproduced before the fix with the release binary against a local stub (Chartula__Llm__BaseUrl pointed at it, dummy keys), both providers:

--- Technical ---
  (failed) Changelog generation for 'v1.1.0' failed: Status Code: NotFound
{"type": "error", "error": {"type": "not_found_error", "message": "model: claude-sonnet-5"}}

--- Customer ---
  (failed) Changelog generation for 'v1.1.0' failed: Status Code: NotFound
{"type": "error", "error": {"type": "not_found_error", "message": "model: claude-sonnet-5"}}
  (failed) Changelog generation for 'v1.1.0' failed: HTTP 401 (invalid_request_error: invalid_api_key)

Incorrect API key provided: sk-dummy.

and with the stub answering 404 only for the check's model:

Unhandled exception. Anthropic.Exceptions.AnthropicNotFoundException: Status Code: NotFound
   at Anthropic.AnthropicClientWithRawResponse.Execute[T](...)
   ...
(core dumped)  [exit code: 134]

Verified after the fix, same commands:

--- Technical ---
  (failed) Changelog generation for 'v1.1.0' failed: anthropic at http://127.0.0.1:8799/v1/messages answered 404 Not Found for model 'claude-sonnet-5'.
           Either the endpoint does not serve that model id (check llm.model), or Chartula__Llm__BaseUrl is not the address of this provider's API - another provider's, or a wrong path such as a missing /v1.
           The endpoint said: model: claude-sonnet-5

--- Customer ---
  (failed) The same as Technical.
  (failed) Changelog generation for 'v1.1.0' failed: openai-compatible at http://127.0.0.1:8799/v1/chat/completions answered 401 Unauthorized for model 'gpt-luna'.
           The endpoint rejected the key in OPENAI_API_KEY: it is expired, revoked or mistyped, or it is another provider's key.
           The endpoint said: Incorrect API key provided: sk-dummy.
  Flagged for review:
    ! The thorough check could not be evaluated: anthropic at http://127.0.0.1:8799/v1/messages answered 404 Not Found for model 'check-model'.
      Either the endpoint does not serve that model id (check faithfulness.model), or Chartula__Llm__BaseUrl is not the address of this provider's API - another provider's, or a wrong path such as a missing /v1.
      The endpoint said: model: check-model.

Also checked: openai-compatible 404 and anthropic 401, a 401 with OPENAI_API_KEY unset (The endpoint needs a key, and OPENAI_API_KEY is not set.), and a refused connection for both providers.

Tests: ModelCallFailureTests (through the real Anthropic and OpenAI adapters with only the network stubbed: 404 with and without a base URL, 401, 401 without a key, 403, the check's own model, an empty body, an unreachable endpoint), ReleaseCommandOutputTests (same reason said once, different reasons each, indentation), ThoroughFaithfulnessCheckerTests (a failed call is not evaluated, cancellation propagates); full suite 751 passing, build and dotnet format clean.

@goldbarth
goldbarth merged commit 35990fa into main Sep 23, 2026
4 checks passed
@goldbarth
goldbarth deleted the fix/model-call-failure-names-endpoint branch September 23, 2026 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A failed model call reports only 'Status Code: NotFound'

1 participant