Skip to content

feat(agent): name the cause when HTTP meets a TCP-only service (037 diagnostics) - #899

Merged
bpalermo merged 1 commit into
mainfrom
feat/037-diagnostics
Sep 22, 2026
Merged

bpalermo merged 1 commit into
mainfrom
feat/037-diagnostics

Conversation

@bpalermo

Copy link
Copy Markdown
Owner

The two remaining Phase 2 diagnostics. Both replace an error describing the proxy's confusion with one describing the caller's mistake.

421 for http://<svc>/ when the service serves no HTTP port

The cache emitted the ordinary cap_http vhost for every in-scope service including TCP-only ones, pointing at an h2 cluster it never builds for them. The caller got a 503 with cluster_not_found — deterministic, but indistinguishable from a cluster that vanished mid-reload, and it never reached ODCDS so even the coordinator's 404 didn't occur.

Such a service now gets a direct_response vhost:

421 Misdirected Request
x-aether-error: no-http-port
aether: <svc> serves no HTTP port. Reach it over TCP instead: <fqdn>:18082 or <fqdn>:<port>

421 is the status defined as "the server is not able to produce a response for the combination of scheme and authority" — precisely this case. No application behind the mesh emits it, so it can't be confused with an app's own 404/503, and it's immediate rather than waiting out a 2s ODCDS lookup that was never going to succeed.

Whether a service has an HTTP port is read from the cache — it has one exactly when the HTTP pass built it a default entry — not from the app-protocol annotation. That's the same fact the vhost would point at, so the two can't disagree. Which is what #878 was.

cap_tcp_blackhole for scoped capture

The CNI redirects :18082 unconditionally in scoped mode (it can't know which VIPs have TCP ports), and the scoped HCM chain is a catch-all with no match criteria. So raw TCP to :18082 on a service with no TCP port would hit the HCM and receive a fabricated HTTP/1.1 400 — the #460 shape.

A last chain matching destination_port alone — less specific than every /32 + port chain, so it only catches what none of them claimed — sends it to a static, endpoint-less cluster: immediate close, counted in cluster.blackhole.upstream_cx_none_healthy.

Not emitted under redirect-all, where passthrough → kube-proxy REJECT is already attributable.

The gate caught me again

The blackhole cluster is emitted before the #877 identity gate, because its chain is likewise ungated — it carries no transport socket and terminates connections rather than forwarding them, so it needs no SVID. Gating the cluster alone would leave the chain naming something absent.

I didn't notice that; the chain-to-CDS gate from #895 did, immediately:

filter chain "cap_tcp_blackhole" names cluster "blackhole", which is not in
the snapshot — tcp_proxy has no ODCDS cold path, so those connections die silently

Third occurrence of that hazard in this proposal, and the first one a gate caught before I did.

Negative controls

Suppressing the 421 vhost fails the TCP-only case while the HTTP case still passes — a 421 for a service that does serve HTTP would be an outage, not a diagnostic.

bazel build //... clean, 109 tests pass, lint clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

…iagnostics)

Two diagnostics that replace errors describing the proxy's confusion with ones
describing the caller's mistake.

421 for `http://<svc>/` when <svc> serves no HTTP port. The cache emitted the
ordinary cap_http vhost for every in-scope service including TCP-only ones,
pointing at an h2 cluster it never builds for them, so the caller got a 503
with cluster_not_found: deterministic, but indistinguishable from a cluster
that vanished mid-reload, and it never reached ODCDS so even the coordinator's
404 did not occur. Such a service now gets a direct_response vhost — 421, the
status defined as "cannot produce a response for this combination of scheme and
authority", with x-aether-error: no-http-port and a body naming the TCP
spellings to use instead. No application behind the mesh emits 421, so it
cannot be mistaken for an app's own error, and it is immediate rather than
waiting out a 2s ODCDS lookup that was never going to succeed.

Whether a service has an HTTP port is read from the CACHE — it has one exactly
when the HTTP pass built it a default entry — not from the app-protocol
annotation. That is the same fact the vhost would point at, so the two cannot
disagree, which is what #878 was.

cap_tcp_blackhole for scoped capture. The CNI redirects :18082 unconditionally
there (it cannot know which VIPs have TCP ports) and the scoped HCM chain is a
catch-all with no match criteria, so raw TCP to :18082 on a service with no TCP
port would hit the HCM and get a fabricated `HTTP/1.1 400` — the #460 shape.
A last chain matching destination_port alone (less specific than every
"/32 + port" chain, so it only catches what none of them claimed) sends it to a
static endpoint-less cluster: immediate close, counted in
cluster.blackhole.upstream_cx_none_healthy. Not emitted under redirect-all,
where passthrough -> kube-proxy REJECT is already attributable.

The blackhole cluster is emitted BEFORE the #877 identity gate, because its
chain is likewise ungated: it carries no transport socket and terminates
connections rather than forwarding them, so it needs no SVID — and gating the
cluster alone would leave the chain naming something absent.

That last point was caught by the chain-to-CDS gate from #895, not by review:
adding the chain without the cluster failed immediately with "filter chain
cap_tcp_blackhole names cluster blackhole, which is not in the snapshot". Third
occurrence of that hazard in this proposal, first one a gate caught before I
did.

Negative controls: suppressing the 421 vhost fails the TCP-only case while the
HTTP case still passes — a 421 for a service that DOES serve HTTP would be an
outage, not a diagnostic.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
@bpalermo
bpalermo merged commit dc41b61 into main Sep 22, 2026
22 checks passed
@bpalermo
bpalermo deleted the feat/037-diagnostics branch September 22, 2026 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant