Skip to content

fix(api): stop swallowing document indexing errors in create handler#38192

Merged
wylswz merged 19 commits into
langgenius:mainfrom
Harsh23Kashyap:fix/create-document-index-error-handling
Jul 2, 2026
Merged

fix(api): stop swallowing document indexing errors in create handler#38192
wylswz merged 19 commits into
langgenius:mainfrom
Harsh23Kashyap:fix/create-document-index-error-handling

Conversation

@Harsh23Kashyap

Copy link
Copy Markdown
Contributor

Fixes #38190

Summary

The create_document_index event handler wrapped IndexingRunner.run in contextlib.suppress(Exception), which swallowed every indexing failure and made the inner DocumentIsPausedError handler useless for unexpected errors.

This change removes the suppress wrapper and matches the logging pattern used in document_indexing_task: log pauses at info level and log unexpected failures with logger.exception.

Test plan

  • cd api && uv run --group dev python -m pytest tests/unit_tests/events/event_handlers/test_create_document_index.py -q (3 passed)
  • uv run --group dev ruff check events/event_handlers/create_document_index.py tests/unit_tests/events/event_handlers/test_create_document_index.py

@dosubot dosubot Bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Jun 30, 2026
@github-actions

github-actions Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Pyrefly Type Coverage

Metric Base PR Delta
Type coverage 51.86% 51.86% 0.00%
Strict coverage 51.38% 51.38% 0.00%
Typed symbols 31,539 31,539 0
Untyped symbols 29,545 29,545 0
Modules 2952 2952 0

@Harsh23Kashyap

Copy link
Copy Markdown
Contributor Author

Hey, this PR is ready for review when you have a chance. Happy to adjust if anything needs changing.

Comment thread api/events/event_handlers/create_document_index.py
@Harsh23Kashyap Harsh23Kashyap force-pushed the fix/create-document-index-error-handling branch from 147c15f to 81192dd Compare June 30, 2026 13:46
@autofix-ci autofix-ci Bot requested a review from crazywoola as a code owner July 1, 2026 02:16
@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Jul 1, 2026
@github-actions github-actions Bot added the web This relates to changes on the web. label Jul 1, 2026
@Harsh23Kashyap

Copy link
Copy Markdown
Contributor Author

Synced with latest main (behind 0). fatelei asked about logging level on the handler — switched unexpected failures to logger.warning (ruff TRY400 blocks bare logger.error in except without exc_info). Regression tests updated; thread resolved.

Verification: cd api && uv run --group dev python -m pytest tests/unit_tests/events/event_handlers/test_create_document_index.py -q → 3 passed.

CI is mostly green; a few jobs were still finishing on the last run. Happy to adjust if you want logger.error(..., exc_info=True) instead.

@Harsh23Kashyap Harsh23Kashyap requested a review from iamjoel as a code owner July 1, 2026 02:30
@autofix-ci autofix-ci Bot requested a review from a team July 1, 2026 03:29
@dosubot dosubot Bot removed the size:M This PR changes 30-99 lines, ignoring generated files. label Jul 1, 2026
@dosubot dosubot Bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Jul 1, 2026
@github-actions github-actions Bot removed the web This relates to changes on the web. label Jul 1, 2026
Comment thread api/events/event_handlers/create_document_index.py Outdated
@wylswz wylswz enabled auto-merge July 2, 2026 06:12
@wylswz wylswz added this pull request to the merge queue Jul 2, 2026
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Jul 2, 2026
Merged via the queue into langgenius:main with commit 31bb8ab Jul 2, 2026
1 check passed
@Harsh23Kashyap Harsh23Kashyap deleted the fix/create-document-index-error-handling branch July 2, 2026 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: create_document_index handler swallows all indexing errors

3 participants