mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-16 01:06:59 +08:00
feat: add x402 payment retry logic and extend retryable status codes
Add retry loop (up to 3 attempts with exponential backoff) for 5xx server errors on payment-signed x402 requests, reusing the same payment signature to avoid double-charges. Also add 502/503/520/524 to the retryable error patterns in the MCP client.
This commit is contained in:
@@ -32,6 +32,10 @@ var (
|
||||
"no such host",
|
||||
"stream error", // HTTP/2 stream error
|
||||
"INTERNAL_ERROR", // Server internal error
|
||||
"status 502", // Bad Gateway
|
||||
"status 503", // Service Unavailable
|
||||
"status 520", // Cloudflare origin error
|
||||
"status 524", // Cloudflare timeout
|
||||
}
|
||||
|
||||
// TokenUsageCallback is called after each AI request with token usage info
|
||||
|
||||
Reference in New Issue
Block a user