Skip to content

fix(chat): expose structured provider query errors - #280

Merged
jacob-bd merged 1 commit into
jacob-bd:mainfrom
Sanity-Cloud:upstream/typed-provider-errors-20260805
Aug 5, 2026
Merged

fix(chat): expose structured provider query errors#280
jacob-bd merged 1 commit into
jacob-bd:mainfrom
Sanity-Cloud:upstream/typed-provider-errors-20260805

Conversation

@insane66613

Copy link
Copy Markdown
Contributor

Summary

  • map provider query rejection codes to stable categories and retry guidance
  • preserve provider code, retryability, suggested action, and a debug code in ServiceError
  • expose metadata through an additive MCP error_details object
  • retain the existing {status, error, hint} error contract

Motivation

Provider failures such as INVALID_ARGUMENT, NOT_FOUND, RESOURCE_EXHAUSTED, and UNAUTHENTICATED currently collapse into similar text responses. Agents cannot reliably decide whether to correct input, retry later, check access, or refresh authentication.

This change prevents invalid arguments from being presented as authentication failures and makes retry decisions machine-readable.

Compatibility

  • existing error fields and text remain present
  • error_details is added only when structured metadata exists
  • retryable=False is preserved rather than dropped as a falsey value
  • async query status retains the same structured failure metadata
  • no new dependencies

Validation

  • uv run ruff check .
  • uv run ruff format --check .
  • focused chat service and MCP suites — 41 passed
  • full upstream-first integration stack on Windows — 1,318 passed, 39 skipped

Provider-code transitions were validated through deterministic QueryRejectedError service and MCP-wrapper cases; no live query mutation was required.

@jacob-bd
jacob-bd merged commit bed08ac into jacob-bd:main Aug 5, 2026
3 checks passed
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.

2 participants