Repository navigation
Conversation
pimlock
left a comment
There was a problem hiding this comment.
Thanks for this. The design is sound: resending only when the transport proves the call never reached a handler is the same rule grpc-go and grpc-java use for transparent retry. I traced the hyper 1.9 / h2 0.4.19 / tonic 0.14 error paths and they hold up: is_canceled comes only from a still-queued envelope, and a remote GOAWAY(NO_ERROR) errors only streams above last_stream_id. I also ran a local harness against RemoteMiddlewareService. An abrupt close after the handler ran, a GOAWAY covering an accepted stream, and an Unavailable answer were each delivered exactly once. Ported to the base commit, the hand-over test fails, and at head it passed 200 of 200 runs.
Three things I'd like addressed before merge, inline below:
- Tie the retry window to the caller's deadline and keep the transport reason.
- Add a deterministic test that a call the service received is never resent.
- Move the middleware restart note out of the legacy accordion.
Optional nits
call_was_not_processedhas no caller outsidetransport.rs, so it could drop out of thepub useinlib.rs(or becomepub(crate)).- The PR description mentions a 10 s middleware timeout. The default is 500 ms (
openshell-core/src/middleware.rs), so the rows in your results table may reflect a non-default configuration. Worth saying so.
5325c7a to
145382b
Compare
145382b to
035b599
Compare
A gateway interceptor or supervisor middleware call failed closed when its connection to the extension service closed as the service restarted, even with a replacement instance already serving. Unary extension calls are now sent again when the transport reports that the service did not process them: a connect failure, a request cancelled before it was sent, a graceful GOAWAY, or a refused stream. Attempts back off from 5 ms to 100 ms until the call's timeout, and the last transport failure is reported in place of a timeout. A call the service may have processed is not sent again, and evaluations for a fail-open binding are not sent again, so a service that is down does not delay them. Closes ai-openshell#5713 Signed-off-by: Divya Vavili <dvavili@nvidia.com>
Head branch was pushed to by a user without write access
035b599 to
6455ca5
Compare
Summary
A gateway interceptor or supervisor middleware call fails closed when its connection closes as an extension service (like Agent Policy Fabric) restarts, even when a replacement instance is already serving. This PR resends a unary extension call when the transport reports the service did not process it.
Related Issue
Closes #5713
Changes
openshell-extension-core: addcall_with_retries, which resends a call when the transport shows the service did not process it: a connect failure, a request cancelled before it was sent, a gracefulGOAWAY, or a refused stream. Attempts are 5 ms to 100 ms apart and stop at the caller's deadline, returning the last transport failure in place of a timeout.openshell-gateway-interceptors:Evaluate,SnapshotProviderProfilesandDescribego throughcall_with_retrieswith the binding's timeout as the deadline.openshell-supervisor-middleware:EvaluateHttpRequest,DescribeandValidateConfigdo the same.Release Notes
Gateway interceptor and supervisor middleware calls no longer fail when an extension service is replaced by a rolling restart. A call that the service did not process is sent again within the call's timeout.
Testing
cargo fmt --all -- --check,cargo clippy --all-targets -- -D warningsandcargo testpass for the three changed crates. The tests include a call that the service received and whose connection is then reset, which is delivered once, and a fail-open binding that is not retried.Also run on a kind cluster against a build without this change, before the review changes to the deadline and to fail-open bindings, with egress requests and sandbox creations in loops while an extension service that serves an interceptor and a middleware is restarted:
The interceptor used the default 500 ms timeout. The middleware was registered with a 10 s timeout, not the 500 ms default; with the default, the row for a single instance down about 9 s would show no improvement for egress requests either. The table counts calls that failed in the transport. When the service is down for longer than the call's timeout, calls still fail closed, as the last row shows.
Checklist