Skip to content

fix: add retry with exp backoff to action plugins#167

Open
fridim wants to merge 1 commit intomainfrom
fix-error-handling-transient-k8s
Open

fix: add retry with exp backoff to action plugins#167
fridim wants to merge 1 commit intomainfrom
fix-error-handling-transient-k8s

Conversation

@fridim
Copy link
Contributor

@fridim fridim commented Mar 16, 2026

The anarchy_subject_update and anarchy_schedule_action plugins call response.json() without error handling. When the anarchy API returns an empty body or a non-JSON response due to transient issues, json.loads("") raises JSONDecodeError: "Expecting value: line 1 column 1 (char 0)". This causes intermittent provision failures that succeed on retry.

  • Add retry loop (3 attempts, exponential backoff: 5s, 10s)
  • Add response.raise_for_status() before parsing JSON
  • Catch RequestException, ValueError, and KeyError
  • Log warnings on each failed attempt via ansible display
  • Return actionable error message when all retries exhausted

The anarchy_subject_update and anarchy_schedule_action plugins
call response.json() without error handling. When the anarchy
API returns an empty body or a non-JSON response due to
transient issues, json.loads("") raises JSONDecodeError:
"Expecting value: line 1 column 1 (char 0)". This causes
intermittent provision failures that succeed on retry.

- Add retry loop (3 attempts, exponential backoff: 5s, 10s)
- Add response.raise_for_status() before parsing JSON
- Catch RequestException, ValueError, and KeyError
- Log warnings on each failed attempt via ansible display
- Return actionable error message when all retries exhausted
@fridim fridim requested a review from jkupferer March 16, 2026 13:53
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.

1 participant