Skip to content

Spec: Hairpin gateway — run the Praxis filter pipeline on all laptop traffic, with no upstream changes #1491

Closed as not planned

Description

@huang195

Spec: Hairpin gateway — run the Praxis filter pipeline on all laptop traffic, with no upstream changes

Summary

Run the Praxis filter pipeline on all laptop traffic — inference, MCP, A2A and general web egress — without waiting on any upstream Praxis capability. Cortex stays the outermost proxy (CONNECT, TLS bridging, process attribution, sessions, cost, events) and hairpins every bridged request through a local, stock Praxis gateway whose filters run the checks and modifications; a small Cortex-side egress listener performs the actual dial to the real destination. The destination travels in a header Cortex injects, so Praxis needs configuration only: no custom filter and no Praxis change.

This is the companion to #1437. That issue concluded the laptop data plane cannot be replaced by Praxis today: three upstream blockers, and no upstream movement since 2026-08-22 (no #781 proposal filed among the 40 in praxis-proxy/enhancements; #782 still has zero comments). The hairpin is the interim shape that delivers the plugin pipeline value now — the thing the pinned-inference-server composition could not, because a pinned server only sees the sessions routed to it.

Zero upstream dependency. Everything built on this survives the clean shape (destination-from-request forwarding, if it ever lands): only the hairpin plumbing itself — the destination header, the egress listener and the extra traversal — is throwaway.

Grounded against cortex main @ dc69b1a5 and praxis-proxy/praxis as of 2026-10-22. Revised 2026-10-24 after a code check against cortex main @ e455a044, praxis main @ 362ade6 and praxis-proxy/ai @ f60e31c: see Revision 2026-10-24 below.

Background: pinned vs chained vs hairpin

Shape Meaning Status
Pinned Per-session redirect to a named server; the server is the destination and dials by its own config Exists today (agentop server, PRs #1340/#1360). Sees only pinned sessions' traffic
Chained (clean shape) All traffic forwarded through a gateway with the original destination preserved; the gateway dials it Blocked: Praxis routes configured routes → clusters → endpoints only. No destination-from-request routing (verified in docs/architecture/upstream-binding.md — bindings resolve through a catalog of declared clusters — and by runtime probe, 2026-10-17)
Hairpin (this spec) Chained semantics without the upstream feature: the destination rides in a request header (x-cortex-dest), Praxis's stock catch-all route sends everything to one cluster, and the dial stays in Cortex Buildable now

Design

agent ──► Cortex forward proxy (:47600)
          CONNECT, TLS bridge (minted certs), attribution,
          session resolution, outbound pipeline, recording
          │  transport hop (listener-level, not a redirect):
          │  dial 127.0.0.1:<praxis>; path and Host unchanged;
          │  inject x-cortex-dest: <scheme>://<host>:<port>, x-cortex-token
          ▼
        Praxis gateway (:<praxis>), stock binary
          classification → checks/modifications (filters see the real path and Host)
          catch-all route "/" → cluster "cortex-egress"
          │
          ▼
        Cortex egress listener (:<egress>)
          validates token, reads x-cortex-dest and strips both headers,
          dials the real destination (no-proxy client), streaming relay
          │
          ▼
        real destination
          response: destination → egress listener → praxis response filters
                    → forward proxy bridge client → agent

Chaining rule (ordered — first match wins)

  1. A pinned/redirected session: the pinned target is itself the hairpin destination (x-cortex-dest names the pin's server, not the host the client named) (see Pins compose by chaining below) — pinned traffic also traverses the gateway's checks.
  2. Bridged (decrypted) HTTP → chain to the gateway.
  3. Opaque tunnels (passthrough hosts, CA-refusing programs) → stay direct from Cortex. No pipeline anywhere can see them.
  4. listener.skip_hosts matches → bypass everything, direct.
  5. Cortex's own plugin outbound (Keycloak, JWKS) → net/http direct, never chained (already true today).

The chain step is listener-level, after the pipeline — not a plugin. Under on_error: observe, plugin redirects are dropped; and the composition with the inference-router's own redirect (pin-wins) is a listener concern.

Request mechanics

  • The hop is not a redirect. It must not go through pctx.Redirect. After a redirect, pctx.Host is where the request went, and the recorded event, settlement, the cost ledger, /v1/usage, the session's inferenceHost and the inference-router's continuation history all key on it (redirect applied at core/listener/forwardproxy/server.go:452-462 @ e455a044; ledger ledger/writer.go:445, usage usage/usage.go:809, settlement settle/settle.go:526-528). Hairpinning through pctx.Redirect would record every request against 127.0.0.1: host-scoped rates stop matching (OpenCode Zen's free models, the *.res.ibm.com multiplier, user host rules), /v1/usage by endpoint collapses to one row, and agentop's SERVER column misreads. Most bundled rates are Host: "*", so most models would still price. pctx.Redirect is also plugin-only: listener code cannot call it (pipeline.go:129, context.go:578).
  • The hop is a dial-only rewrite. After the pipeline and before client.Do (server.go:532), set only r.URL.Scheme = "http" and r.URL.Host = "127.0.0.1:<praxis>", and leave r.Host, pctx.Host and pctx.Path alone. Every recording site then keeps the real destination (the pipeline's redirect target if a plugin set one, else the client's host). Plugins still cannot steer the dial, because the hop never reads anything a plugin writes. Skip it for requests skip_hosts matched.
  • Host stays the real destination (BL1), so praxis-side filters and policies see true host context. Praxis forwards Host unchanged unless the cluster sets http.authority (crates/core/src/config/cluster.rs:89-126).
  • The path is not touched, so it reaches Praxis and the destination byte for byte. praxis-ai's filters classify by path (/v1/messages), so they work unmodified. Praxis forwards x-cortex-* headers unchanged; only x-praxis-, x-ext-protocol- and x-ext-agent- prefixes are refused (crates/core/src/reserved_headers.rs:44). It adds Via: 1.1 praxis to the request and the response; x-forwarded-* comes only from the opt-in forwarded_headers filter.
  • The egress listener validates the shared-secret token, reads x-cortex-dest, strips both headers, and dials with the forward proxy's own transport, which has no Proxy field and never reads proxy env.

Praxis configuration (stock binary)

Setting Default Why
route path_prefix: "/" → cluster cortex-egress, endpoint 127.0.0.1:<egress> — one catch-all route
insecure_options.allow_private_endpoints: true loopback refused at config load (crates/core/src/config/validate/cluster/endpoints.rs:140-175) the egress listener is on loopback; Praxis logs a WARN at startup. (allow_private_upstreams is a different key: it covers DNS-resolved names only.)
body_limits.max_request_bytes / max_response_bytes 10 MiB each way, enforced even when no filter buffers (body_limits.rs:13, filter/src/pipeline/mod.rs:861-871) over the limit a request gets a 413 and a response is cut mid-stream; long Claude Code requests and long SSE responses can exceed it. Ceiling 64 MiB; null needs insecure_options.allow_unbounded_body
cluster read_timeout_ms none (cluster.rs:457) nothing to change; if one is ever set it must exceed the longest silence mid-SSE

Already fine by default: no cluster or total-request timeout, so a 15-minute SSE with long silences survives (Pingora's 60 s downstream read timeout covers the request's header and body only); responses stream chunk by chunk; Accept-Encoding is not modified and nothing is recompressed (compression is opt-in); filters can add response headers and reject with a custom status; chunked requests and Expect: 100-continue work; downstream h2c is accepted.

Boundary contract (information flow)

Direction Channel Content
Push, per-request Headers, strip-then-inject X-Cortex-Session, X-Cortex-Proc ("<pid>.<start>"; attribution — the one fact praxis cannot derive), X-Cortex-Agent, and the other headers in core/attribution/wire.go (#1700)
Pull, on demand Cortex's existing APIs (/v1/sessions summaries, /v1/usage) via callout, cached per session Session aggregates: tokens, cost-so-far, budget state. Summaries, not events (privacy: full payloads carry raw user messages)
Push back, per-response Response headers (x-praxis-decision: …) recorded into the event's plugins map What each check decided — closes the observability gap for gateway decisions
Never crosses — Parsed protocol context (each side parses its own), raw event content, the cost ledger (Cortex stays the system of record)

Cortex is the trust root for its headers: strip any client-supplied copy before injecting (precedents: token-exchange replaces Authorization; Envoy's Lua filter injects x-authbridge-direction). Spoofing matters on the praxis side too — its own head_classifier publishes a "client-unspoofable" reserved header for exactly this reason.

Plugin pipeline boundary

Three pipelines coexist: Cortex's (parsing, attribution, recording), cpex/PPE in-process (policy, merged in #1429 — CPEX 0.3.1 embeds PPE 0.5), and praxis's (the main home going forward). The rule: new checks land as praxis filters; Cortex's pipeline owns parsing, attribution and recording; PPE policy stays for the cpex build.

Pins compose by chaining

A pinned session's target is encoded as just another hairpin destination, so pinned traffic (e.g. praxis-ai for translation) also traverses the universal gateway's checks. The naive "pin wins, redirect direct" composition silently opens a policy hole and is rejected. Pin-as-routing-hint inside the gateway (upstream sticky-sessions proposal 00108) is a later refinement, not a requirement.

Blockers (all Cortex-side — that is the point)

BL1 — Dial target vs Host. server.go:429-436 deliberately couples r.URL.Host and r.Host on redirect ("they move together, or the upstream sees one host while the transport dials another"), and reads the target from the validated RedirectTarget copy so a plugin that never declared WritesDestination cannot steer the dial. The hairpin needs dial-gateway/Host-real-destination. Safe (plaintext loopback leg, no SNI divergence). Since the hop is its own dial-only rewrite (see Request mechanics) rather than a redirect, the redirect path keeps its invariant, and no WritesDestination exception is needed. A test still proves a plugin without WritesDestination cannot steer the dial.

BL2 — Path byte-fidelity (largely resolved by the header design). The hop leaves the path untouched, so there is no encode → route → decode round trip. What remains: Praxis rejects any path with .. segments or %2e%2e, NUL or control characters with a 400 (request_filter/validation.rs:88-140), so such a request fails through the hairpin even where the destination would accept it. Rare from agents; covered by the parity suite (W11). %2F passes through escaped; // and trailing slashes are kept. The existing redirect still clears RawPath (server.go:460), which matters only for plugin redirects, not the hop. On the normal path %2F survives through EscapedPath(); no in-tree test pins that yet.

BL3 — The egress listener is a new open-dialer on loopback. Any local process can use it to reach anywhere, including localhost services (the unauthenticated session API). Needs: shared-secret token (strip-then-inject), a destination policy — which cannot blanket-refuse private ranges, because local inference servers (Ollama, vLLM, LiteLLM) are legitimate destinations — audit logging, no double-recording of events, and no mis-attribution of the praxis process's connections.

BL4 — Recursion through praxis callouts. A guardrails callout made by praxis under the laptop's proxy env enters the forward proxy, is chained back to praxis, and can trigger another callout: unbounded recursion under a realistic config. Mandatory: praxis launched with scrubbed proxy env; peerproc self-traffic exemption for the praxis process (precedent: the self-traffic child rule, #1269/#1270); the egress dialer built with an explicit no-proxy client, never http.ProxyFromEnvironment.

Known issues (accepted or to design around)

High:

  • H1 — Config coupling: a praxis config missing the catch-all route, allow_private_endpoints or the raised body limits breaks all traffic. Mitigation: a synthetic readiness probe through the whole chain before chaining engages; praxis is alpha software, so config churn is a real failure domain.

  • H2 — gzip re-negotiation on the egress leg: the exact silent-SSE failure documented in stripForUpstream's comment, in a second place. The egress dialer must own its encoding negotiation; pinned by test.

  • H4 — Connection ballooning: three H1 legs = one connection per in-flight request per leg. Internal legs should speak h2c; downstream h2c support in praxis is unverified (upstream h2 exists — gRPC example, ALPN in cluster config).

  • H5 — Timeout and cancellation semantics across four legs: Cortex never cuts a slow upstream (499 client_canceled philosophy); Praxis has no cluster read timeout by default, but its 10 MiB response limit cuts a longer SSE mid-stream unless body_limits is raised; agent hangup must propagate to the egress dial (Pingora closes upstream when the downstream drops, proxy_h1.rs; promptness mid-SSE unverified).

  • H6 — Cortex itself cuts a stream after 5 minutes with no bytes (streamReadIdleTimeout, server.go:91), so it is not true that it never times out. Each added leg needs no idle cap, or one of at least 5 minutes.

  • H7 — The egress listener takes over checking the destination's certificate. Today the bridge's upstream client does it, honouring upstream_ca_bundle and upstream_insecure; reuse tlsbridge.NewUpstreamClient (tlsbridge/upstream.go:17-35).

  • H8 — Plain-HTTP proxied requests (not bridged) also run the pipeline, and the chaining rule above leaves them out. Decide whether they are chained too.

Medium: M1 WebSocket benefit nullified (Cortex strips Upgrade — praxis's upgrade passthrough never sees one); M2 h2 trailers likely lost over H1 legs; M3 durationMs/byte counts now measure the forward leg, not the wire (decide the canonical metric); M5 a client-supplied x-cortex-dest or token must be stripped before injecting (strip-then-inject); M6 memory doubled where praxis filters buffer; M7 fail-closed default with a rollout flag and version pinning; M8 the bridge's pre-forge HEAD probe (server.go:826-838) still goes straight to the real host, outside the gateway.

Decision recorded: fail-closed when the gateway is down (matching the cpex plugin's default; a silent direct-dial fallback is the "quietly allow what policy meant to deny" trap), with the supervisor restarting praxis quickly.

Work breakdown

Each row is a candidate sub-issue. Sizing is coarse (S/M/L) on purpose — per the review of #1437, pre-spike week estimates are not trustworthy; the spike derives the numbers.

# Item Size Depends on
W1 Spike: minimal end-to-end — one hardcoded destination, no checks, one SSE stream through the loop; answers H2, H4, H5 and the unverified items below empirically S —
W2 Dial-only hop after the pipeline: r.URL scheme and host only, recorded host and pricing unchanged, steering-hole test (BL1) S —
W3 Path codec + parity fixtures dropped: the header design leaves the path untouched (BL2) — —
W4 Egress listener: reads and strips x-cortex-dest, streaming relay, encoding ownership, no-record, token auth (BL3 part 1) M W1
W5 Egress listener destination policy + audit (BL3 part 2) S W4
W6 Self-traffic rules: env scrub, peerproc exemption, recursion repro test (BL4) S W1
W7 Chaining rule engine, listener-level, ordered rules, pin composition M W2
W8 praxis config: catch-all route, allow_private_endpoints, raised body_limits S W1
W9 Boundary contract: strip-then-inject headers, decision headers back into events S W7
W10 Readiness probe, supervision, agentop setup integration, rollout flag M W4, W8
W11 Black-box parity suite: hairpin vs direct, events/bytes/timing/cost diffed M W2-W9
W12 Pinned-session chaining: x-cortex-dest names the pin's server (H3 resolution) S W7

Spike checklist (W1's exit criteria)

  1. Hop with decoupled Host/dial-target; a non-WritesDestination plugin still cannot steer the dial; the recorded host and the priced cost match a direct request.
  2. A path with %2F, unicode and empty segments arrives at the destination byte-identical.
  3. gzip-coded SSE through the egress leg — assert frames, not just 200s.
  4. h2c on the praxis downstream listener — yes/no, and connection count under 10 concurrent streams.
  5. Hang up mid-SSE at the agent; the egress dial closes; the row says client_canceled.
  6. Launch praxis with the laptop's proxy env and a callout filter; reproduce the recursion, then prove the scrub + exemption kill it.
  7. Chain-on with a broken praxis config must fail closed at startup, not per-request.
  8. A 60 s+ silence mid-SSE survives end to end, across all four legs.
  9. A request body and an SSE response each over 10 MiB, with the raised limits.
  10. Whether praxis-ai's token_count buffers SSE responses (latency and memory).
  11. Praxis closes the upstream promptly when the agent hangs up mid-SSE.

Revision 2026-10-24

A code check of both sides changed two things in the original design:

  1. The destination moved from the path to a header. Path encoding needs a Praxis change, not just a custom filter: a filter can set the path sent upstream (rewritten_path), but the request URI that later filters and conditions read is read-only (crates/filter/src/context.rs:442, condition/request.rs:230-236), so praxis-ai's path-based filters would all see /_egress/.... Stock path_rewrite / url_rewrite exist but normalize the path (collapse //, resolve dot segments). With x-cortex-dest, stock Praxis needs configuration only, and BL2 mostly goes away.
  2. The hop is not pctx.Redirect. A redirect changes the recorded host, and host-scoped pricing, usage by endpoint, agentop's SERVER column and the router's history follow it. pctx.Redirect is also plugin-only. The hop is a dial-only rewrite of r.URL after the pipeline (W2, S).

Also added: the required Praxis configuration, the pinned-session rule, three more spike checks, and four gaps under Known issues (H6–H8, M8). No Praxis change is needed for any of it.

Non-goals

References

Activity

  1. added
    laptop
    on Oct 22, 2026
  2. huang195 commented on Oct 30, 2026

    @huang195
    MemberAuthor

    W1 spike extension: one loop, both interim options (2026-10-30)

    Per the decision on #1437, W1 now covers the pinned-inference-server option compositionally instead of as a separate spike. The pinned shape has no Cortex design risk (it is the existing agentop server mechanism); its unknowns are praxis-ai product maturity. Wrapping it inside the hairpin loop answers the one genuinely new thing about it — composition — for near-zero extra cost.

    Leg A — hairpin loop skeleton + assertions (~1–2 days):

    • Stock Praxis locally, spike config only: catch-all route / → cluster cortex-egress → 127.0.0.1:<egress>, insecure_options.allow_private_endpoints: true, body_limits raised to 64 MiB.
    • Cortex patch behind an env flag, no chaining-rule engine: dial-only rewrite after the pipeline in forwardproxy/server.go (r.URL.Scheme/Host → 127.0.0.1:<praxis>, inject x-cortex-dest, strip-then-inject).
    • Minimal egress listener: token check, read+strip x-cortex-dest, no-proxy dial (reuse tlsbridge.NewUpstreamClient), streaming relay.
    • Checks from the spike checklist: 1 (host/pricing invariant), 3 (gzip SSE frames), 5 (mid-SSE hangup → client_canceled), 6 (callout recursion repro + env-scrub proof), 8 (60 s+ silence), 9 (>10 MiB bodies). Deferred: 2, 4, 11 — add only if the first six go green.

    Leg B — pinned praxis-ai inside the loop (~0.5 day):

    • Run praxis-ai locally against an OpenAI-compatible upstream; pin one session to it via the existing mechanism so the pin's target becomes an x-cortex-dest (the pins-compose-by-chaining rule, i.e. W12 exercised early in its simplest form).
    • Drive Claude Code through it — Anthropic Messages → translation → Chat Completions → back — while inside the hairpin. Watch: translation fidelity on tool calls, SSE shape out of praxis-ai, and whether token_count/token_usage buffers the stream (checklist check 10).

    Repo strategy for the spike (merge-back rule): spike lives on a fork worktree branch (spike/hairpin-w1), rebased on upstream/main at session start. Nothing merges from the spike branch. Real fixes found mid-spike are cherry-picked into their own small PRs against main immediately; graduated pieces (e.g. W2) are rewritten as clean PRs, using the spike branch as reference only. No stacked PRs on the spike branch (cross-repo stacking costs: planted base refs, CI drops to 3 checks on children).

    Assisted-By: Claude (Anthropic AI) [email protected]

  3. self-assigned this
    on Nov 7, 2026
  4. huang195 commented on Nov 7, 2026

    @huang195
    MemberAuthor

    W1 spike results (2026-11-07)

    Verdict: GO for W2–W12. All six required items pass. Five design changes are below. Also, re-check praxis#1480 before W4/W5 (see Upstream).

    Setup

    • Cortex: main @ 72b79e0e plus spike commit 5ee3950b on huang195:spike/hairpin-w1. The spike runs only behind env flags. Nothing on this branch merges.
    • The spike Cortex ran on ports 49600–49604, with a separate HOME. The shared proxy on :47600 was not touched.
    • Praxis: stock v0.8.0 (released 2026-11-07), config only. It has a catch-all route to 127.0.0.1:49621, allow_private_endpoints: true, and body_limits at 64 MiB.
    • praxis-ai: main @ f96d0114, as the pinned server, in front of Ollama granite4.2:8b.
    • Upstream for items 1–9: a mock Anthropic SSE server on loopback, reached as a plain-HTTP proxied request. Bridged HTTPS was also checked with real Claude Code traffic: api.anthropic.com and Datadog answered 200/202 through the loop, and the rows kept the real hosts.

    Checklist

    # Item Result Measured
    1 Hop changes only the dial target PASS Direct and hairpin rows are the same: host 127.0.0.1:49630, bytesUp 108, bytesDown 1175, costMicros 10500, one /v1/usage endpoint series. A unit test (TestSpikeHairpin_OnlyTheDialTargetMoves) shows that a plugin that writes pctx.Host or the hairpin headers changes nothing. The redirect that the pipeline checked picks X-Cortex-Dest, and Host stays the real one
    2 %2F, unicode, // path PASS (optional) The origin got /v1/a%2Fb/%E2%9C%93//c/?q=%2F&x=1 byte for byte, in both modes
    3 gzip-coded SSE arrives as frames PASS The origin sent Content-Encoding: gzip. Praxis relays the gzip bytes unchanged. The agent got all 10 frames 200 ms apart, and the parser counted 1500 tokens. The same result with and without plugins
    4 h2c and connection count Partial (optional) Praxis accepts h2c with prior knowledge (HTTP/2, 200). With 10 concurrent streams over HTTP/1 there are 10 connections on each of the 4 legs (40 in total). This agrees with H4. Praxis → egress over h2c was not tested
    5 Agent hang-up mid-SSE PASS Hang-up at 07.695996, origin close at 07.698516: 2.5 ms across all legs. The row says client_canceled
    6 Callout recursion PASS: it does not occur See Item 6 below
    7 Broken Praxis config fails closed at startup FAIL as built (optional) With Praxis down, every request fails closed with 502 upstream_refused. Nothing stops Cortex at startup, so this is W10's work
    8 60 s+ silence mid-SSE PASS A 65.2 s gap with all frames and no error. A 65 s wait before the response headers (the MCP slow-tool case) also passes
    9 Over 10 MiB each way PASS with the raised limits 12,583,020 bytes up and 12,588,215 down, all 45 events. Negative control with the default limits: the request gets 413, and the response is cut at about 10 MiB (unexpected EOF)
    10 token_count buffering Not tested —
    11 Praxis closes the upstream at once PASS (optional) Same 2.5 ms as item 5
    — Added latency — 50 small requests per mode: p50 2.6 → 3.0 ms, p90 3.1 → 4.0 ms. Measured in batches, not interleaved

    Item 6: why the recursion does not occur

    • Praxis and praxis-ai callouts use SubRequestClient, which dials the configured cluster. Neither code base reads HTTPS_PROXY. praxis-ai uses reqwest only in dev and test code.
    • Live check: praxis-ai with a NeMo ai_guardrails callout, under HTTP(S)_PROXY that points at the spike Cortex. The callout went direct, also for a DNS name (127.0.0.1.nip.io). Cortex had no row for it.
    • The only reqwest client in production is the OTLP HTTP exporter. Stock builds do not include it: otel is not in Praxis's default features or in praxis-ai's full. In a --features otel build, OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf panics on its first batch (there is no reactor running, must be called from the context of a Tokio 1.x runtime), so it sends nothing. The default gRPC (tonic) exporter made no connection to Cortex.
    • The peerproc exemption works: a client binary named praxis went direct, and the same binary under another name went through Praxis.

    So BL4 is not a live risk for stock binaries today. Keep the env scrub as a cheap defense, because a future exporter can read the env.

    Leg B: pinned praxis-ai inside the loop

    • The composition works. The pin target becomes X-Cortex-Dest. The response carries via: 1.1 praxis, 1.1 praxis (gateway, then praxis-ai). The rows record host 127.0.0.1:49610 and requestedHost ete-litellm….
    • Translation of tool calls works on a hand-made two-turn request. The response has a tool_use block for bash with {"command":"echo hairpin-ok"}, then end_turn after the tool_result. Cortex parsed the translated SSE: tool calls, and 292/58 and 344/120 tokens.
    • praxis-ai cannot carry stock Claude Code 2.1.295:
      1. thinking and cache_control give a 400. allow_lossy_features: [extended_thinking, prompt_caching] fixes this, and praxis-ai then reports x-degraded-features.
      2. Claude Code sends a role: "system" message inside messages, with a per-message output_config: {effort}. The translator allows only role and content on a message (apis/src/anthropic/messages_to_chat_completions/request.rs:531) and refuses the request. No config option covers this.
    • The cost was empty because granite has no rate. Cost through praxis-ai is still not checked with a priced model.
    • Not checked: the router did not change the model name of the hand-made request to the server's main. Ollama answered 404 until I set the model by hand. The router could not get the server's model list at startup, because praxis-ai started after Cortex. That can be the cause.

    Design changes

    1. W6: match the Praxis process by pid and start time, not by name. Any binary named praxis skips the gateway checks today. Cortex starts the Praxis child itself (W10), so it knows the pid and the start time.
    2. M5: remove X-Cortex-Dest and X-Cortex-Token when each request comes in, not in the hop. On the exempt path, a forged X-Cortex-Dest from the client reached the origin.
    3. W9 / W10: tell gateway answers apart from origin answers. Cortex records a Praxis 413 as the origin's 413. It records a cut at the body limit as upstream_error. It records Praxis down as upstream_refused under the real host, and only the log names :49620. These need an error kind of their own (for example gateway_unavailable), or a decision header from Praxis.
    4. W8: the 64 MiB body_limits is a requirement, not an option. The default cuts long SSE at 10 MiB. Add it to the readiness probe (H1).
    5. H4: use h2c on the Cortex → Praxis leg. Praxis accepts it. Check the Praxis → egress leg before W4 is final.

    Upstream

    Assisted-By: Claude (Anthropic AI) [email protected]

  5. huang195 commented on Nov 9, 2026

    @huang195
    MemberAuthor

    Closing as superseded. The W1 results above are still the reference, but the plan in this issue is replaced:

    The W1 spike code stays on huang195:spike/hairpin-w1 (5ee3950b) as the prototype for the hop and the egress listener (#1721).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

laptop

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions