dirigent-plugin 0.15.2__tar.gz → 0.16.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dirigent-plugin
3
- Version: 0.15.2
3
+ Version: 0.16.1
4
4
  Summary: The dirigent plugin contract: block specs, protocols, and markers.
5
5
  License-Expression: LicenseRef-Proprietary
6
6
  License-File: LICENSE
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "dirigent-plugin"
3
- version = "0.15.2"
3
+ version = "0.16.1"
4
4
  description = "The dirigent plugin contract: block specs, protocols, and markers."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.13"
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "dirigent-plugin"
3
- version = "0.15.2"
3
+ version = "0.16.1"
4
4
  description = "The dirigent plugin contract: block specs, protocols, and markers."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.13"
@@ -43,7 +43,7 @@ class ErrorClass(StrEnum):
43
43
  """Network, 5xx, timeout: retryable."""
44
44
 
45
45
  REJECTED = "rejected"
46
- """Validation, auth, 4xx: never retried."""
46
+ """Validation, auth, any 4xx but 429: never retried."""
47
47
 
48
48
  UNKNOWN = "unknown"
49
49
  """Anything else: retried while the step's budget lasts."""
@@ -64,13 +64,17 @@ class BlockFailure(Exception):
64
64
 
65
65
 
66
66
  def classify_default(error: Exception) -> ErrorClass:
67
- """Classify an exception with no block-specific knowledge: transport and 5xx transient, 4xx rejected."""
67
+ """Classify an exception with no block-specific knowledge: transport and 5xx transient, 4xx rejected.
68
+
69
+ A 429 is the one client error that asks to be retried: the server is rate limiting, and
70
+ the same call succeeds once the window has passed.
71
+ """
68
72
  match error:
69
73
  case BlockFailure():
70
74
  return error.error_class
71
75
  case httpx2.HTTPStatusError():
72
76
  status = error.response.status_code
73
- if status >= 500:
77
+ if status >= 500 or status == 429:
74
78
  return ErrorClass.TRANSIENT
75
79
  if 400 <= status < 500:
76
80
  return ErrorClass.REJECTED