-
Notifications
You must be signed in to change notification settings - Fork 0
[codex] Add Binance dispatch retry guard #50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| from __future__ import annotations | ||
|
|
||
| import unittest | ||
| from pathlib import Path | ||
|
|
||
|
|
||
| ROOT = Path(__file__).resolve().parents[1] | ||
| WORKFLOW = ROOT / ".github" / "workflows" / "install-dispatch-guard.yml" | ||
|
|
||
|
|
||
| class DispatchGuardWorkflowTests(unittest.TestCase): | ||
| @classmethod | ||
| def setUpClass(cls) -> None: | ||
| cls.workflow_text = WORKFLOW.read_text(encoding="utf-8") | ||
|
|
||
| def test_dispatch_guard_retries_transient_failures(self) -> None: | ||
| text = self.workflow_text | ||
|
|
||
| self.assertIn('DISPATCH_MAX_ATTEMPTS="${DISPATCH_MAX_ATTEMPTS:-4}"', text) | ||
| self.assertIn('DISPATCH_RETRY_BASE_SECONDS="${DISPATCH_RETRY_BASE_SECONDS:-15}"', text) | ||
| self.assertIn("is_retryable_http_status()", text) | ||
| self.assertIn("000|500|502|503|504) return 0 ;;", text) | ||
| self.assertIn('retryable=true', text) | ||
| self.assertIn('sleep "$delay"', text) | ||
| self.assertIn('dispatch retry ${attempt}/${DISPATCH_MAX_ATTEMPTS}', text) | ||
|
|
||
| def test_dispatch_guard_keeps_non_retryable_failures_immediate(self) -> None: | ||
| text = self.workflow_text | ||
|
|
||
| self.assertIn('if [ "$attempt" -ge "$DISPATCH_MAX_ATTEMPTS" ] || [ "$retryable" != "true" ]; then', text) | ||
| self.assertIn('fail_dispatch "$reason" "$details"', text) | ||
| self.assertIn('GitHub dispatch returned HTTP ${http_status}', text) | ||
|
|
||
| def test_dispatch_guard_bounds_curl_runtime(self) -> None: | ||
| text = self.workflow_text | ||
|
|
||
| self.assertIn("--connect-timeout 20", text) | ||
| self.assertIn("--max-time 60", text) | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| unittest.main() |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When GitHub creates the
workflow_dispatchrun but the client receives a transient500/502/503/504, retrying this POST sends another dispatch because the request has no idempotency key; I checked.github/workflows/main.ymland it does not define aconcurrencyguard, so this can start overlapping live Runtime jobs after a single ambiguous server-side success, contrary to the runbook's scheduler-overlap warning. Consider verifying whether a run was created before retrying, or adding workflow-level concurrency before treating these statuses as retryable.Useful? React with 👍 / 👎.