Feed recording, sessions and cost through one input that does not depend on the Go listeners
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 25/100
Línea de trabajo
Start with core/listener/internal/sessionevent, core/session/store.go, core/cost/settle/settle.go, and core/sessionapi/server.go; trace how events reach the recorder and how cost uses response headers. The proposal spans event construction, sink interfaces, cost calculation, ingestion, and schema versioning, with several open design questions. Done means meeting the listed parity and pricing tests and, if ingestion is included, matching replayed /v1/sessions and /v1/usage results.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Part of #1437 (assessment: laptop data plane on Praxis) · prep work, useful to Cortex on its own
Status: there is no Cortex–Praxis integration today, and the interim path is not decided (LLM traffic to praxis-ai as an inference server, or all traffic through Praxis via #1491). Nothing here depends on that choice: each item is useful to Cortex now, and makes an eventual move to Praxis easier whichever path is taken.
Problem
If Cortex's data plane ever moves to Praxis, the session store, archive, cost ledger, usage aggregator and agentop must keep working unchanged. Today they are fed only from inside Cortex's Go listeners, so nothing outside those listeners, Praxis included, has anything to plug into. Three things tie recording to the Go proxy:
- Events are built in 11 places. Each listener builds
pipeline.SessionEventliterals by hand, and they have drifted. - Cost is computed inside a plugin, from data the event does not carry.
- There is no way to feed events from outside the process.
What Cortex does today
Event construction — 11 literals plus the Deny helpers:
- forward proxy:
server.go:1234,:1523;transparent.go:246,:296 - reverse proxy:
server.go:457,:634,:827 - ext_proc:
server.go:355,:442,:478,:532 - shared:
sessionevent.Deny,DenyResponse
Drift this has caused:
- ext_proc never sets
requestedHost. - Only the forward proxy's request row sets
upgradeStripped. - The forward proxy's request row carries no
tls.
The back end is already clean. Every event goes through one choke point, Store.append → appendLocked, which then calls the Recorders (usage, ledger, archive). Each of those reads only the event.
Calls outside Append. Listeners also call the store directly:
Rekey:reverseproxy:617,extproc:520Claim/ClaimProcess/TouchProcessAppendTrailing/AppendPair, which take an in-process*session.Bucketto pair a tunnel's open and close rows (transparent.go:296,server.go:2633)
Cost.
- Computed by
settle.Settle(pctx, rates), called frominference-parser. - It reads
pctx.ResponseHeaders(LiteLLM cost headers),pctx.Hostand the parsed inference. Publishputs the result inExtensions.Custom, which reaches the event asplugins["cost"].- Response headers are not in the event, so cost can't be computed from an event alone.
No ingestion. The session API registers GET routes and two DELETEs only (sessionapi/server.go:199-209).
envoy-sidecar mode shows the cost of this.
cortex-envoybuilds a store but no ledger, usage aggregator or archive (warnCostLedgerInert).- So
/v1/usageanswers 404 there.
Proposal
- One set of event builders in
core/listener/internal/sessionevent:Request,Response,TunnelOpen,TunnelClose, each taking(pctx, ListenerFacts{status, failure, bytes, reason, duration}). Replace all 11 literals. Fixes the drift above. - One sink interface the listeners write through —
Append,AppendTrailing(requestID),Rekey,Claim*— so "feed the control plane" is one interface, not a struct and its methods. Pair tunnel rows byrequestIdinstead of*Bucket. - Make cost computable from the event. Narrow
settle.Settleto{host, inference, responseHeaders, isSSE}and record the cost-relevant response headers on the response event. - A loopback-only event-ingestion endpoint (e.g.
POST /v1/events, NDJSON) into the same sink. Use the same guards asDELETE /v1/sessions: loopbackHost, noOrigin, gated likeWithClearAllowed. - Version the event schema.
sessionEventWire(session.go:493) has no version, and its JSON is already persisted by the archive. Add a version, plus golden fixtures. State indocs/session-api.mdwhich fields only the store sets (sessionId,seq).
Items 1–3 and 5 benefit Cortex today. Item 4 can wait until a second producer exists (replay, tests, or another proxy).
Design questions
- Does ingestion live on the session API port, or on a separate loopback-only listener?
- Should the ingesting side recompute cost from the event, or trust a producer-supplied cost record?
- Is ext_proc's lack of
requestedHosta bug to fix in this change or separately?
Done when
- No
pipeline.SessionEvent{literal remains outsidesessionevent. core/listener/parityasserts identical event fields across forward proxy, reverse proxy and ext_proc for the same exchange.settlehas a unit test that prices from an event alone, with nopipeline.Context.- (Item 4) A replayed NDJSON capture through the ingestion endpoint produces the same
/v1/sessionsand/v1/usageas the live run.
Evidence read at main @ e455a04 (2026-10-25); not built or run.
- Lenguaje dominante
- Go
- Estrellas
- 18
- Forks
- 42
- Merge medio
- 12 h 20 min
- PR fusionados (30 d)
- 229
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de rossoctl/cortex
-
UI shows costs for all sessions even when drilled into a sessionPosiblemente ocupada @esnible la tomó hace 11 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
rossoctl/cortex#1116 · 2 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
enhancement laptop
Dificultad 5/5 Más de una semana Aptitud para principiantes 40/100
Los mantenedores suelen responder en 1 día
-
Decouple plugins from Go pipeline internals: parser test data, session facts, serializable recordsAbiertoenhancement laptop
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
Los mantenedores suelen responder en 1 día
-
enhancement laptop
Dificultad 5/5 Más de una semana Aptitud para principiantes 38/100
Los mantenedores suelen responder en 1 día
-
enhancement laptop
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
Los mantenedores suelen responder en 1 día
Todos los issues de rossoctl/cortex
Issues similares
-
consensus feature I2 S4 U2
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día
-
[Bug] [Go] Ack returns nil when the server answers with a non-OK statusPosiblemente ocupada @leizhiyuan la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
apache/rocketmq-clients#1465 ·
Los mantenedores suelen responder en 2 días
-
Priority/Low Type/Improvement
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
OpenNSW/nsw-srilanka#906 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
praetorianer777/Dynamo#57 ·
Los mantenedores suelen responder en 1 día
-
fix(handlers): explicitly set Content-Type header in static Index handlerPosiblemente ocupada @kage-zero la tomó hoy. Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día