-
-
Notifications
You must be signed in to change notification settings - Fork 41
Fix AI security scan transport failures #145
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -116,10 +116,30 @@ jobs: | |||||
| temperature: 0.1 | ||||||
| }') | ||||||
|
|
||||||
| RESPONSE=$(curl -s "$URL" \ | ||||||
| CURL_EXIT=0 | ||||||
| RESPONSE=$(curl --silent --show-error \ | ||||||
| --retry 4 \ | ||||||
| --retry-all-errors \ | ||||||
| --retry-delay 2 \ | ||||||
| --connect-timeout 15 \ | ||||||
| --max-time 120 \ | ||||||
|
Comment on lines
+121
to
+125
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win 🔎 Supported by static analysis🤖 get_repo_knowledge executed:
Length of output: 5625 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- workflow excerpt ---'
sed -n '105,150p' .github/workflows/ci.yml
printf '%s\n' '--- curl version available ---'
curl --version | sed -n '1,2p'Repository: mini-software/MiniPdf Length of output: 2558 🏁 Script executed: #!/bin/bash
set -eu
sed -n '105,150p' .github/workflows/ci.yml
curl --version | sed -n '1,2p'Repository: mini-software/MiniPdf Length of output: 2502 🌐 Web query:
💡 Result: In curl, --max-time and --retry-max-time serve distinct purposes regarding timeout management and retry logic [1][2]. --max-time (also known as -m) sets a hard time limit for each individual transfer attempt [1]. If a single request exceeds this specified duration, curl will terminate that specific attempt regardless of its progress [3]. --retry-max-time acts as an outer time limit for the entire retry process [1]. When used in conjunction with the --retry option, it defines the maximum total amount of time that curl is allowed to spend on retrying [1]. Curl will stop retrying if either the maximum number of retry attempts (specified by --retry) is reached or if the total elapsed time exceeds --retry-max-time, whichever occurs first [1]. In summary: - --max-time limits the duration of each individual attempt [1]. - --retry-max-time limits the cumulative duration of all retry attempts [1]. For example, using: curl --max-time 60 --retry 40 --retry-max-time 600 curl will allow up to 60 seconds for each individual attempt and will continue to retry for a total cumulative time of up to 600 seconds, or until it has attempted 40 retries [1]. Citations:
🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- workflow excerpt ---'
sed -n '110,145p' .github/workflows/ci.ymlRepository: mini-software/MiniPdf Length of output: 1932 Set an end-to-end retry timeout.
🤖 Prompt for AI Agents |
||||||
| "$URL" \ | ||||||
| -H "Content-Type: application/json" \ | ||||||
| -H "api-key: $AZURE_OPENAI_API_KEY" \ | ||||||
| -d "$PAYLOAD") | ||||||
| -d "$PAYLOAD") || CURL_EXIT=$? | ||||||
|
|
||||||
| if [ "$CURL_EXIT" -ne 0 ]; then | ||||||
| case "$CURL_EXIT" in | ||||||
| 5|6|7|28|35|52|56) | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win 🔎 Supported by static analysis🤖 get_repo_knowledge executed:
Length of output: 1948 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- changed workflow hunk ---'
git diff -- .github/workflows/ci.yml | sed -n '1,220p'
printf '%s\n' '--- workflow context ---'
sed -n '105,155p' .github/workflows/ci.yml
printf '%s\n' '--- curl status handling and related references ---'
rg -n -C 4 '5\|6\|7\|28\|35\|52\|56|curl|review|unavailable|blocking|exit' .github/workflows/ci.ymlRepository: mini-software/MiniPdf Length of output: 5152 🏁 Script executed: #!/bin/bash
set -eu
python3 - <<'PY'
from pathlib import Path
p = Path('.github/workflows/ci.yml')
lines = p.read_text().splitlines()
for n in range(110, 150):
if n <= len(lines):
print(f'{n:4}: {lines[n-1]}')
PYRepository: mini-software/MiniPdf Length of output: 2292 🏁 Script executed: #!/bin/bash
set -eu
git diff --unified=30 -- .github/workflows/ci.yml | sed -n '1,260p'Repository: mini-software/MiniPdf Length of output: 159 Classify send failures with the selected network failures. When Proposed classification update- 5|6|7|28|35|52|56)
+ 5|6|7|28|35|52|55|56)📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
| echo "::warning::AI Security Review unavailable after retries (curl exit $CURL_EXIT); skipping external review" | ||||||
| exit 0 | ||||||
| ;; | ||||||
| *) | ||||||
| echo "::error::AI Security Review request failed (curl exit $CURL_EXIT)" | ||||||
| exit "$CURL_EXIT" | ||||||
| ;; | ||||||
| esac | ||||||
| fi | ||||||
|
|
||||||
| # Extract content | ||||||
| CONTENT=$(echo "$RESPONSE" | jq -r '.choices[0].message.content // empty') | ||||||
|
|
||||||
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.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
🔎 Supported by static analysis
🤖 get_repo_knowledge executed:
get_repo_knowledge mini-software/MiniPdf /tmp/coderabbit-repo-knowledge/mini-software-minipdf-2049b7d3/conventionsLength of output: 1948
🏁 Script executed:
Repository: mini-software/MiniPdf
Length of output: 6205
🌐 Web query:
curl --retry-all-errors POST output retry behavior official man page💡 Result:
The --retry-all-errors option in curl, introduced in version 7.71.0, is a command-line flag used in conjunction with --retry to force curl to retry on any error [1][2][3]. While the standard --retry option only triggers retries for transient errors (such as timeouts, FTP 4xx responses, or HTTP 5xx responses), --retry-all-errors makes curl treat all transfer failures as valid reasons to retry [1][4][2]. Key considerations and behaviors include: Usage: It must be used alongside --retry, which defines the maximum number of retries [1]. A typical command looks like: curl --retry 5 --retry-all-errors https://example.com [1][4]. Warning: This option is described as a "sledgehammer" of retrying and is not recommended for default use (e.g., in a.curlrc file) because it can lead to unintended consequences, such as receiving duplicate data [1]. Data Integrity: Curl attempts to reset the transfer state before retrying, but this is not possible when using redirected input or output (e.g., sending data to a pipe | or a file >). Using this option with redirects is strongly discouraged, as partial data from failed transfers may lead to corrupted or duplicate output [1]. HTTP Error Codes: By default, curl does not consider HTTP error codes (like 404) as transfer errors if the response was fully received [1]. To retry on all HTTP error codes (both 4xx and 5xx), you should combine --retry-all-errors with the --fail option [1].
Citations:
🏁 Script executed:
Repository: mini-software/MiniPdf
Length of output: 2195
🏁 Script executed:
Repository: mini-software/MiniPdf
Length of output: 2055
🏁 Script executed:
Repository: mini-software/MiniPdf
Length of output: 1995
Do not automatically retry this POST without idempotency protection. If Azure OpenAI receives the request but the response transfer fails,
--retry 4 --retry-all-errorscan send-d "$PAYLOAD"again.RESPONSE=$(...)captures output across attempts, so partial response bytes can precede the later JSON and cause thejqextraction to fail. Remove both retry flags, or use endpoint-supported idempotency and a fresh response file per attempt. Removing only--retry-all-errorsis insufficient because--retrystill retries transient transfer errors.🤖 Prompt for AI Agents