Repository navigation
Conversation
|
Important Review skippedAuto reviews are limited based on label configuration. 🏷️ Required labels (at least one): 1
Please check the settings in the CodeRabbit UI or the
|
OpenAPI changes ⚪ No API surface changesNote This PR does not modify the API contract.
|
…ions - Updated error logging to include exception information for better traceability. - Introduced `ConflictError`, `UpstreamError`, and `ServiceUnavailableError` for more granular HTTP status codes. - Changed HTTP status codes in various tests and service methods to align with new error handling conventions. - Added tests to ensure correct behavior when handling exceptions, including cases for missing resources, state conflicts, and upstream errors. - Updated documentation to reflect changes in exception handling and status code mappings.
2898d88 to
10ed0a4
Compare
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
…s codes - Replaced custom exceptions (InvalidPayloadError, ServiceUnavailableError, etc.) with HTTPException across various services and CRUD operations to standardize error responses. - Updated the exception handling logic in evaluations, guardrails, LLM jobs, STT evaluations, and onboarding to raise HTTPException with appropriate status codes. - Removed references to custom exceptions in tests and replaced them with HTTPException assertions. - Added a new exception taxonomy in app/core/exceptions.py to categorize domain-specific errors. - Updated documentation to reflect changes in exception handling and status code consistency.
…andling in the core
…tus codes and hints
- Updated tests to propagate IntegrityError instead of raising HTTPException for unique constraint violations in config and version creation. - Introduced make_integrity_error utility to simulate IntegrityError with SQLSTATE and constraint details. - Enhanced test coverage for handling foreign key violations and ensuring proper logging behavior for duplicate run names in evaluation runs. - Adjusted exception handling in credentials management to correctly propagate unique constraint violations and other integrity errors. - Improved documentation on exception handling and observability practices related to error logging and status code consistency.
…ation and update exception handling for HTTP exceptions
| # Fixed detail: str(exc) here leaked provider bodies and DB text to callers. | ||
| # logger.error alone reports it; adding capture_exception makes a second event. |
There was a problem hiding this comment.
can you take a look at this? why we need this?
Issue
Closes #834
Summary
Status codes now mean the same thing across endpoints, every error is reported once with the route and tenant on it, and a Celery task stays in the same trace as the request that started it.
Error responses
Status code fixes
ValueError→ 500ValueError→ 500Observability
api request llm.start_job apply_async - (manual inject/extract) → worker spans reparented to the request, Sentry split them into separate transactions + run/run_llm_job → CeleryInstrumentor parents it; one trace end to end celery task_prerun + tags celery.task_name, tenant.project_id, tenant.org_id (strings) from task kwargs log levels - 4xx from the client side (LLM job HTTPException, send_callback failures) logged as error + logged as warning; 5xx stay error sentry - profiling, Redis tracing (Redis is still used; only its spans are gone) + gen_ai.input.messages / gen_ai.output.messages masked like the other GenAI content keysDocs updated:
docs/wiki/cross-cutting/exceptions.md,docs/wiki/cross-cutting/observability.md, the observability and LLM-call architecture docs,.claude/conventions/celery.md.Evidence
{"detail": "Not Found"}; each LLM job showed up in Sentry as two transactions (request, worker) and callback 401s were error-level alerts.After: checked live against a personal Sentry project:
http.server → llm.start_job → apply_async → run_llm_job → chat → provider.executeAPIResponseshapetest_exception_handlers.py(DB handler 409/422/500, generic handler captures once, 404/405 shape), credentials, config, version, onboarding, security, collection and tracing tests updated or added. CIchecks (3.12)passes.Merge Danger
Door: two-way
Revert restores the old handlers and status codes; there are no migrations and no data changes.
Blast Radius: API clients
codecov/patchis below target on this PR; everything else in CI passes.