Repository navigation
Part of #3166: Python 3.11 adoption opportunities: claim one improvement at a time - #4422
Vedant-200 wants to merge 1 commit into
Conversation
|
Vedant-200 please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
There was a problem hiding this comment.
🟡 Changes recommended
Regression coverage is missing for service-specific exception notes through close_services_async(), including cancellation, preservation of original exceptions and existing notes, and ordering before the outer generic note.
1 open issue
What changed in this PR
This PR improves PyRIT backend shutdown diagnostics by identifying which cached service failed, using Python 3.11 exception notes.
Changes:
- Adds
_close_service_asyncto annotate failures while preserving the original exception. - Routes five cached-service close operations through the helper, including cancellation handling.
| File | Description |
|---|---|
pyrit/backend/services/service_lifecycle.py |
Adds service-specific exception notes to cached-service shutdown failures. |
Review effort: Balanced
| except (Exception, asyncio.CancelledError) as error: | ||
| error.add_note(f"Failed to close {name}.") | ||
| raise |

Description
Added a
_close_service_asynchelper that annotates shutdown failures with the failing service name and routed each cached service close through it.Part of #3166
Root cause
In
_close_cached_services_async, each cached service is closed without attaching which service failed, so shutdown errors only receive the generic outer noteFailed to close cached backend services.