Fix Data Management history failure diagnostics and throttle handling - #1276
Merged
Paul Lizer (paullizer) merged 2 commits intoAug 18, 2026
Merged
Conversation
Backup Inventory and Job History failures returned a generic 503 telling admins to "review application logs", while the only log line emitted was the exception class name. The provider status code and message were discarded at the raise site, so the failure could not be classified from telemetry at all. _raise_data_management_history_unavailable built DataManagementHistoryUnavailableError without retaining the originating status code or message, and _data_management_history_unavailable_response logged only type(original_error).__name__. Classification was also too narrow: _is_data_management_history_index_error required status 400 and the literal substring "composite index", so every other provider failure, including throttling, collapsed into the same opaque response. Retain provider_status_code, provider_message, and retryable on the error and log the status code and sanitized message. Provider text stays in operator logs and never enters the browser payload; safe_message remains a fixed, non-reflective string. Also: - Classify throttling (429/503, "request rate is large") with distinct retryable busy guidance, and surface a retryable flag on the response. - Retry the history query up to 3 times for throttled and transient transport errors with jittered backoff capped at 4 seconds. Non-retryable errors still fail on the first attempt. - Broaden index detection to match ORDER BY failures reported as having no corresponding index, so maintenance guidance survives wording drift. Ruled out during investigation: missing composite index (Cosmos Maintenance reports 0 missing across 7 checked containers, including data_management_jobs), unsupported parameterized TOP, and the 400 entries in Cosmos diagnostics, which are the normal cross-partition query-plan negotiation and appear on containers whose queries succeed. The underlying provider failure remains unconfirmed. This change makes the next occurrence self-diagnosing. Drive-by: test_deployers_apply_the_data_management_history_index asserted deployer_version == "1.0.24" and broke when deployers/version.txt advanced to 1.0.25. It now compares with >= so it survives future bumps, matching the repository guidance against exact version assertions. Fixes #1275
Contributor
Author
|
Copilot resolve the merge conflicts in this pull request |
Co-authored-by: paullizer <34814295+paullizer@users.noreply.github.com>
Contributor
Done — I merged |
Copilot stopped work on behalf of
Paul Lizer (paullizer) due to an error
August 18, 2026 15:11
This was referenced Aug 19, 2026
Closed
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.
Fixes #1275
Problem
GET /api/admin/data-management/backupsreturns 503 and Backup Inventory shows "Data Management history could not be loaded. Please try again later or review application logs."Reviewing the application logs is not actionable. This is the entire diagnostic output:
error_typeis the exception class name. No status code, no provider message. Six rounds of investigation across App Service console logs, App Insights, Cosmos Maintenance, and Cosmos diagnostic logs could not determine the cause — because the component that caught the error with full detail discarded it.Root cause of the diagnosis failure
_raise_data_management_history_unavailableconstructedDataManagementHistoryUnavailableErrorwithout retaining the provider status or message, and_data_management_history_unavailable_responselogged onlytype(original_error).__name__.Classification was also too narrow —
_is_data_management_history_index_errorrequired status400and the literal substring"composite index", so throttling and every other provider failure collapsed into the same opaque 503.Ruled out during investigation
data_management_jobsis one of the checked containers.TOPunsupportedSELECT TOP @parameteris valid Cosmos NoSQL.400s in Cosmos diagnostics400+requestCharge 0+ sub-ms duration is the normal cross-partition query-plan negotiation. It appears ontabular_export_runsandsettingstoo, while those code paths log success.Remaining candidates are throttling or another non-
400CosmosHttpResponseError.data_management_jobswas observed oscillating 1,000→5,000 RU oncontainer_utilization_above_threshold, and Admin Settings fires a burst of Cosmos-heavy admin calls on load.Changes
1. Retain provider detail —
DataManagementHistoryUnavailableErrornow carriesprovider_status_code,provider_message, andretryable. The route logsstatus_codeanderror.Provider text is confined to operator logs and never enters the browser payload.
safe_messageremains a fixed, non-reflective string, so there is no new information-exposure surface.2. Throttle classification —
429/503or "request rate is large" / "too many requests" now raisesDATA_MANAGEMENT_HISTORY_BUSY_MESSAGEwithretryable=True, and the response carriesretryable: trueso the UI can offer a retry instead of pointing at logs.3. Bounded retry —
_query_data_management_history_itemsretries up to 3 times for throttled and transient transport errors with jittered backoff capped at 4 seconds, logging attempt, status code, delay, and provider message. Non-retryable errors still fail on the first attempt.4. Broader index detection — still requires
400, but now also matchesORDER BYcombined with "does not have a corresponding" / "not served", so maintenance guidance survives provider wording drift.Validation
test_history_throttling_is_retried_then_reported_as_busy429retries exactlyDATA_MANAGEMENT_HISTORY_QUERY_MAX_ATTEMPTStimes, then reportshistory_provider_throttledwithretryable=True; provider text absent fromsafe_messagetest_history_failures_capture_provider_detail_for_operator_logsprovider_status_code/provider_messagepopulated, absent fromsafe_message; a non-retryable403does not retrytest_history_index_errors_match_alternate_provider_wordingtest_history_provider_index_errors_are_actionableRegression probe: neutralizing
_is_data_management_history_throttle_errorfails the throttle test, confirming it exercises the new classification rather than passing incidentally.Full Data Management suite: 150 passed, 1 failed —
test_backup_recovery_and_admin_progress_are_bounded_and_sanitized, pre-existing onorigin/Developmentand unrelated.Drive-by test fix
test_deployers_apply_the_data_management_history_indexasserteddeployer_version == "1.0.24"and started failing whendeployers/version.txtadvanced to1.0.25. That is the exact brittle pattern the repository instructions prohibit for version assertions. Now usescompare_simplechat_versions(deployer_version, "1.0.24") >= 0, preserving intent without breaking on future bumps.Honest scope note
This does not fix the underlying provider failure, which is still unconfirmed. It makes the next occurrence self-diagnosing — status code and message land in one log line. If it turns out to be throttling, the bounded retry here may resolve it outright; the checkpoint batching in
0.250.218also reduces sustained write pressure on the same containers.Version
0.250.219→0.250.220Documentation
docs/explanation/fixes/DATA_MANAGEMENT_HISTORY_DIAGNOSTICS_FIX.mddocs/explanation/release_notes.md