Repository navigation
fix(middleware): preserve HTTP request failure causes - #4145
Conversation
|
This pull request has had no activity for 14 days and is now marked stale. |
|
Label |
9a62429 to
bd0b5ba
Compare
|
🌿 Preview your docs: https://nvidia-preview-pr-4145.docs.buildwithfern.com/openshell |
|
/ok to test bd0b5ba |
bd0b5ba to
34e7be6
Compare
|
This pull request has had no activity for 14 days and is now marked stale. |
143526f to
5654e97
Compare
5654e97 to
d4b667e
Compare
pimlock
left a comment
There was a problem hiding this comment.
Thanks for picking this up. The plumbing looks careful: allow/deny and the sandbox-facing text are unchanged, no service status text leaks, and the new tests catch real regressions (removing delivery.start() or classifying a remote status as StageTimeout both fail tests). I found four things to address, with inline comments on each:
- Nothing reads the new failure kind or upload state, but the docs say the runtime distinguishes them.
middleware_eventsbuilds OCSF only fromfailedandreason.reject_live_request_body(relay.rs:1221) matchesMiddleware { denial, failure, .. }and dropskindanddelivery.deadline_scope()has no callers, andcategory()is used only byDisplay. An operator sees the same event for a remoteDEADLINE_EXCEEDEDas for a stage timeout. The per-invocationfailure_kindonMiddlewareInvocationandHttpStageInvocationis likewise only written. Either emit the category, deadline scope and delivery state on the existing middleware events and document those fields, or drop the two docs lines until the #4144 consumer lands. - The kind is derived by re-parsing reason strings.
of_platform_reasonduplicatesHttpFailureCode::of_reasonand already disagrees with it (session_capacity_exhaustedisUnavailablein one andCapacityin the other). Its_ => InvalidResultfallback silently files any new reason asprotocol. - A service that is down is reported as a remote status. Reproduced by shutting down the test server in
external_registry_attaches_same_service_under_multiple_namesand evaluating again:failure_kind = RemoteStatus(Unavailable), categoryremote_status, the same as a live service that returnsUNAVAILABLE. #4144 asks for these to be distinguishable. - Two behaviours have no regression test. Changing the early-upstream-response cancel kind from
CancelledtoIostill passes all network tests. Flipping the merge precedence inHttpStageDiagnostics::extendstill passes all middleware and network tests.
Smaller notes:
status_failurenow uses.expect("a status comes from a resolved stage")where the base had a non-panicking fallback. The invariant holds today, but returningbinding_not_describedwould avoid a relay panic after a future refactor.request_terminal_cause_survives_successful_stage_recordstests a helper extracted only for that test, so it mostly restates the implementation.- A stale policy generation is reported as
Cancelled. Is that how operators should read it?
812a274 to
5d3432d
Compare
|
Thanks for the shutdown repro, @pimlock. I pushed the fixes. I also restored the |
pimlock
left a comment
There was a problem hiding this comment.
Thanks for the quick turnaround — everything from my review is resolved in 5d3432d. I checked each fix against the code: the reason-string tables are gone (with the sandbox codes unchanged), a service that is down now reports Unavailable, and the two new tests fail when the cancel kind or the merge order is changed.
5d3432d to
d78e7f5
Compare
Carry typed causes through HTTP request middleware diagnostics. Distinguish local deadlines, gRPC statuses, built-in errors and stale-policy cancellation while preserving diagnostic messages and response selection. Track live upstream writes from the first attempt through the final flush. Retain delivery progress when a stage fails while output is still queued. Refs #4144 Signed-off-by: Shiju <shiju@nvidia.com>
Keep platform failure causes and sandbox response codes together at the point of failure. Distinguish transport errors from service-reported gRPC statuses and track policy generation changes during upload. Preserve cancellation through the final diagnostic merge. Cover service shutdown, early upstream responses and competing causes in existing tests. Remove the operations guide claims about deadline and upload details until the middleware events expose them. Refs #4144 Signed-off-by: Shiju <shiju@nvidia.com>
d78e7f5 to
65f4ae4
Compare
Summary
A remote service returning
DEADLINE_EXCEEDEDand an OpenShell stage timeout used to produce the same request outcome. HTTP middleware now keeps the cause alongside the diagnostic message. The relay also records how far a live request got when an upstream write failed.Related Issue
Part of #4144.
Changes
Testing
Checklist