fix(hermes-plugin): retry the health probe when a gateway redirects to its login page #5984
All Vouch review confidence checks passed
Residual risk 0.25 = Change Risk (0.47) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.47 · 486 lines diff across 6 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.370
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #5984"
general
weight: 0.35
ehz0ah
What
The startup identity probe (
GET /health) is anonymous-first on purpose — credentials must not reach an unknown host — and it only retried with credentials when the anonymous call came back401/403. Gateways that answer a header-less request by redirecting to their own login page were not covered:_parse_response()turns the HTML login page of that302into{}, so_probe_openviking_identity()classified a perfectly reachable server asand dropped the client — while every authenticated request (including the data API) worked fine. Deployments behind Cloudflare Access could therefore never use this provider, even with
extra_headersconfigured correctly (#5884 made those headers reach the probe; this is the remaining step).The change
_anonymous_json()surfaces a 3xx as an_OpenVikingHTTPErrorcarrying the status instead of parsing the redirect body into an empty dict._probe_needs_credentials()keeps401/403as "the server itself wants credentials" and retries a 3xx only when the connection carries gateway headers (extra_headers/OPENVIKING_EXTRA_HEADERS). Those headers are the operator's declaration that an authenticating gateway fronts the endpoint. A redirect on a connection with none of them is an ordinary redirect from an endpoint that has not been shown to be OpenViking, which is not authorization to resend the API key: it fails once, as it did before, and no credential leaves the process.openapi_payload()shares_anonymous_json(), and its caller already wraps the call intry/except Exception, so the stricter probe only changes what the redirect case reports.Thanks @ehz0ah — the first revision retried any 3xx and so sent the key on ordinary redirects. Narrowed in
ff99f26c; the reasoning and the test are below.Tests
_start_server()intests/test_extra_headers.pymodels both sides:redirect_to=(a gateway that redirects header-less requests) andplain_redirect_to=(an endpoint that simply redirects).test_startup_probe_retries_when_gateway_redirects_to_login()— with gateway headers configured the probe retries and the client is kept.test_ordinary_redirect_receives_no_secrets()— with none configured, an ordinary302gets a single anonymous request and no retry: noX-API-Key, noAuthorization, noX-OpenViking-Account, and the client is dropped. Onafaa711it fails withan ordinary redirect was answered with credentials: {… "X-API-Key": "test-key", "Authorization": "Bearer test-key"}; onff99f26cit passes.afaa71121 failed / 387 passed,ff99f26c21 failed / 388 passed, failure list identical (21test_quick_local_preflight.pycases that need a real host install this box doesn't have). CI'shermes-plugin-testspasses onff99f26c.How it was verified
Against a real self-hosted OpenViking published through Cloudflare Access:
302without the service token,200with it, data API200, MCP handshake200.initialize()through the public hostname withOPENVIKING_EXTRA_HEADERSset: 3/3 stable passes (2.8–4.0 s), followed by a realGET /api/v1/fs/lsagainst the same client.200in ~0.1 s).Follow-up to #5884 — the review there asked whether a gateway that protects every route including
/healthwould really work; that question is what led to this.