hengyuss opened a new pull request, #7668:
URL: https://github.com/apache/shenyu/pull/7668
Closes #7667.
Related to #7351.
Follow-up to #7532.
## What this PR does
- centralizes upstream HTTP status and classified transport failure
decisions in `AiProxyRetryPolicy`;
- retries only explicitly eligible failures and forwards non-retryable
upstream responses unchanged;
- retries the primary Provider before attempting fallback and attempts
fallback at most once;
- prevents retry or fallback after the first response body chunk has been
emitted;
- drains retryable upstream error bodies before another attempt so
connections can be released;
- rebuilds fallback requests using the fallback Provider configuration;
- adds separate retry limits for streaming and non-streaming requests;
- adds configurable exponential backoff for non-streaming retries while
keeping pre-emission streaming retries immediate;
- binds retry settings under `shenyu.plugins.ai.proxy.retry`;
- replaces the remaining legacy transport test fixture with classified
`AiTransportException`.
## Retry configuration
```yaml
shenyu:
plugins:
ai:
proxy:
retry:
max-retries: 3
streaming-max-retries: 1
initial-backoff: 1s
```
## Behavioral boundaries
- HTTP `429` and `5xx` responses are retry/fallback eligible.
- Other `4xx` responses are forwarded without retry or fallback.
- Transport failures use an explicit retry/fallback eligibility matrix.
- Once downstream emission starts, the original failure is propagated
without transparent replay.
- Terminal transport exception mapping to gateway `502/503/504` responses is
intentionally out of scope.
- Connection pool, TLS, HTTP proxy, lifecycle, and observability
configuration remain under #7384.
## Tests
- `./mvnw -pl shenyu-plugin/shenyu-plugin-ai/shenyu-plugin-ai-proxy
-Djacoco.skip=true test` — 253 tests passed.
- `./mvnw -pl
shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-ai-proxy
-am -Dtest=AiProxyPluginConfigurationTest
-Dsurefire.failIfNoSpecifiedTests=false -Djacoco.skip=true test` — 11 tests
passed.
- Checkstyle passed for all modules participating in both builds.
Make sure that:
- [x] You have read the [contribution
guidelines](https://shenyu.apache.org/community/contributor-guide).
- [x] You submit test cases (unit or integration tests) that back your
changes.
- [ ] Your local test passed `./mvnw clean install
-Dmaven.javadoc.skip=true`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]