Retry httpcore RemoteProtocolError in SpanPanelApi#1
Merged
NickBorgersOnLowSecurityNode merged 1 commit intomainfrom Dec 30, 2025
Merged
Conversation
Collaborator
Testing PerformedI tested the changes on this branch and verified the implementation works correctly. Test ResultsAPI Tests (54 passed) The two new tests added by this PR both pass:
Full Test Suite (221 passed, 1 skipped) Linting Implementation VerificationThe retry logic is correctly implemented:
The implementation aligns with the goal of transparently recovering from transient |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This seeks to close SpanPanel#156
Motivation
RemoteProtocolError: Server disconnected without sending a responsecaused by httpx/httpcore connection-pool reuse of server-closed keep-alive connections.Description
httpcore.RemoteProtocolErrorby importingRemoteProtocolErrorand adding helper methodsasync def _recreate_clientandasync def _call_with_protocol_retryto recreate theSpanPanelClientand retry once.authenticate,get_status,get_panel_state,get_circuits,get_storage_soe,set_circuit_relay,set_circuit_priority, andget_all_data) with_call_with_protocol_retryto perform a single recreate-and-retry on protocol disconnects.SpanPanelConnectionErrorif the retry also fails to provide a consistent error surface.test_get_all_data_retries_on_remote_protocol_errorandtest_get_all_data_remote_protocol_error_after_retrytotests/test_span_panel_api.pyto validate retry and failure-after-retry behavior.Testing
tests/test_span_panel_api.pycovering successful retry and failure-after-retry ofget_all_datawhenhttpcore.RemoteProtocolErroris raised.PYENV_VERSION=3.11.12 pyenv exec python -m pytest tests/test_span_panel_api.pyin the local environment which failed withModuleNotFoundError: No module named 'span_panel_api'due to the externalspan-panel-apidependency not being available here.Codex Task