Skip to content

Exclude non-retryable exceptions from retry mechanism in block_until_done#8

Merged
jacobseunglee merged 5 commits into
refactor/claude-copilotfrom
copilot/sub-pr-6-again
Oct 29, 2025
Merged

Exclude non-retryable exceptions from retry mechanism in block_until_done#8
jacobseunglee merged 5 commits into
refactor/claude-copilotfrom
copilot/sub-pr-6-again

Conversation

Copilot AI commented Oct 29, 2025

Copy link
Copy Markdown

The @retry_on_failure decorator on block_until_done was retrying all exceptions, including authentication failures, permission errors, and invalid task IDs that will never succeed on retry.

Changes

New exception types (utils/exceptions.py):

  • AuthenticationError - auth failures (401)
  • ProxmoxPermissionError - permission denied (403)
  • InvalidTaskError - invalid/missing task IDs (404)

Selective retry logic (utils/utils.py):

  • Decorator now only retries: ProxmoxAPIError, ConnectionError, TimeoutError
  • Exception handler uses Proxmoxer's native types (ProxmoxerAuthenticationError, ResourceException) with HTTP status code inspection instead of string matching
  • Non-retryable exceptions propagate immediately; retryable exceptions go through retry flow
@retry_on_failure(
    max_attempts=3,
    delay=2.0,
    exceptions=(ProxmoxAPIError, ConnectionError, TimeoutError)  # Only these retry
)
def block_until_done(...):
    try:
        data = prox.nodes(node).tasks(task_id).status.get()
    except ProxmoxerAuthenticationError as e:
        raise AuthenticationError(...)  # Won't retry
    except ResourceException as e:
        if e.status_code == 403:
            raise ProxmoxPermissionError(...)  # Won't retry
        elif e.status_code == 404:
            raise InvalidTaskError(...)  # Won't retry
        else:
            raise ProxmoxAPIError(...)  # Will retry

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits October 29, 2025 01:56
Co-authored-by: jacobseunglee <66867022+jacobseunglee@users.noreply.github.com>
Co-authored-by: jacobseunglee <66867022+jacobseunglee@users.noreply.github.com>
Co-authored-by: jacobseunglee <66867022+jacobseunglee@users.noreply.github.com>
Copilot AI changed the title [WIP] WIP on addressing feedback from PR #6 Exclude non-retryable exceptions from retry mechanism in block_until_done Oct 29, 2025
Copilot AI requested a review from jacobseunglee October 29, 2025 02:02
@jacobseunglee jacobseunglee marked this pull request as ready for review October 29, 2025 02:03
@jacobseunglee jacobseunglee merged commit e06a1b6 into refactor/claude-copilot Oct 29, 2025
@jacobseunglee jacobseunglee deleted the copilot/sub-pr-6-again branch October 29, 2025 02:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants