Repository navigation
fix: restart ollama proxy when token diverges from persisted token #2555
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
Closed
adrian-santos
wants to merge
1
commit into
NVIDIA:main
from
adrian-santos:fix/ollama-proxy-token-divergence
Closed
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
Oops, something went wrong.
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.
🧩 Analysis chain
🏁 Script executed:
Repository: NVIDIA/NemoClaw
Length of output: 115
🏁 Script executed:
Repository: NVIDIA/NemoClaw
Length of output: 115
🏁 Script executed:
Repository: NVIDIA/NemoClaw
Length of output: 115
🏁 Script executed:
Repository: NVIDIA/NemoClaw
Length of output: 91
🏁 Script executed:
Repository: NVIDIA/NemoClaw
Length of output: 93
🏁 Script executed:
Repository: NVIDIA/NemoClaw
Length of output: 746
🏁 Script executed:
Repository: NVIDIA/NemoClaw
Length of output: 833
🏁 Script executed:
Repository: NVIDIA/NemoClaw
Length of output: 818
🌐 Web query:
curl -sf flag exit code behavior 401 403 5xx timeout💡 Result:
With curl -sf (equivalent to --silent --fail), the exit code behavior for various scenarios is as follows: - HTTP 401 (Unauthorized) or 403 (Forbidden): Exits with code 22. The -f/--fail flag causes curl to fail silently (no output) and exit with error 22 for any HTTP response code >=400. Note that this is not always fail-safe, especially with authentication involved (e.g., 401/407 may sometimes slip through). - HTTP 5xx (server errors, e.g., 500): Exits with code 22, same as above for >=400. - Timeout: Exits with code 28 (CURLE_OPERATION_TIMEDOUT). This occurs if the operation exceeds the maximum allowed time (connect, transfer, etc.). Use --max-time or --connect-timeout to adjust. Without -f, curl exits with 0 even for HTTP errors >=400, as it considers the transfer successful if data was received. -s suppresses progress/output but does not affect exit codes directly.
Citations:
🌐 Web query:
curl --max-time timeout exit code semantics💡 Result:
When using curl with --max-time (or -m), if the maximum time is exceeded, curl exits with exit code 28, corresponding to CURLE_OPERATION_TIMEDOUT. This applies to the overall operation timeout, including connection, transfer, etc. The error message typically reads "Operation timed out after X milliseconds" (distinguishing it from connect-timeout, which says "Connection timed out" or "Resolving timed out", but both use code 28). curl returns 0 on success. Non-zero exit codes indicate errors, with 28 specifically for timeouts triggered by --max-time. Official documentation confirms: "--max-time makes curl exit with a timeout error code (28)" and lists CURLE_OPERATION_TIMEDOUT (28) for operation timeouts.
Citations:
Differentiate auth rejection from transient probe failures before forcing restart.
Line 108 treats any non-zero
curlresult as token divergence. With-f, the exit code 22 is returned for both auth rejection (401/403) and server errors (5xx), while timeouts exit with code 28. This means a valid proxy experiencing transient failures will be unnecessarily killed and restarted. Only explicitly reject the token on 401/403 responses; treat other failures as indeterminate.Suggested fix
Also update line 198 to use the returned status instead of a boolean check.
📝 Committable suggestion
🤖 Prompt for AI Agents