Turn the MCP, A2A and inference parsers into libraries, with saved real-traffic test cases
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 25/100
Hướng nghiên cứu
Start by reading the three parser plugins under core/plugins/inferenceparser, core/plugins/mcpparser and core/plugins/a2aparser, plus the data package from #1502 and the Settle work in #1501. Extract request and response parsing into libraries with explicit streaming state, then add saved request, JSON response and SSE fixtures under testdata for each library. Done means the plugins delegate parsing, cpex's ParseResponse still works, and the libraries do not import pricing or settle.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Part of #1437 (assessment: laptop data plane on Praxis) · prep work, useful to Cortex on its own
Status: there is no shipped Cortex–Praxis integration today (the paused
cmd/cortex-praxisconverter is not one), and the interim path is not decided (LLM traffic to praxis-ai as an inference server, or all traffic through Praxis via #1491). This is a refactor with no behaviour change: it is useful to Cortex on its own, and would make a possible move to Praxis easier whichever path is taken.
Problem
Parsing an LLM, MCP or A2A request is mostly pure work (bytes in, structured result out), but most of it is reachable only as a plugin. One exported entry point exists: inferenceparser.ParseResponse(path, body), which cpex already calls. Everything else is unexported or inline:
- inference (mostly pure):
- requests:
parseAnthropicRequestandparseOpenAIRequesttake only the body;parseResponsesRequestalso needs headers (zstd decode); - responses:
parseAnthropicJSON,parseAnthropicSSE,parseResponsesJSON,parseResponsesSSE,parseInferenceJSON,parseInferenceSSE. The SSE parsers write into the request's existing result; - per-frame folds:
foldAnthropicFrame,foldOpenAIFrame,foldResponsesFrame(responses.go:499). They need stream state that the plugin keeps onpctx, andfoldResponseFrametakespctxitself; - plugin-only logic: the dialect is chosen from the path, the response arm from
Content-Typeand whether a stream ran, andAgentRoleis set inOnRequest.
- requests:
- MCP (not pure today): request parsing is inline in
OnRequest(mcpparser/plugin.go:166-266), and needs the method, path, the configured path matcher and theMcp-Session-Idheader.parseMCPResponsereturns an unexported type thatapplyMCPResponseRPCwrites intopctx. - A2A (not pure today): request parsing is inline in
OnRequest(a2aparser/plugin.go:35-127). Response parsing isextractSendResponse,extractStreamEventandsessionIDFromJSON(:259-430).parseA2APartsis only a helper over already-decoded data.
The inference parser also prices the request (cost.go:64-113), so parsing and pricing are one plugin. It imports core/cost/pricing and core/cost/settle from cost.go, cacheblind.go and plugin.go (pricing.Resolver, settle.IsEventStream).
Apart from ParseResponse, nothing outside the plugin can parse a body: not a replay tool, not a test, not another proxy. And there are no saved real-traffic test cases: inference-parser's 18 test files (about 4,900 lines) build inputs as inline JSON, with a few verbatim captured blocks pasted in (e.g. anthropic_test.go:166, :624). The only testdata/ in the repo is core/cost/pricing/testdata.
Proposal
- Parser libraries (e.g.
core/parse/inference,core/parse/mcp,core/parse/a2a): exportedParseRequest(method, path, headers, body, config),ParseResponse(...)and a streaming fold with explicit state, returning the parsed-request types. The three plugins become thin wrappers.- MCP and A2A request parsing must be extracted from
OnRequestfirst. - The libraries depend on the data package from #1502, so #1502 should land first.
- MCP and A2A request parsing must be extracted from
- Pricing out of the parser library. The library computes no cost. Pricing stays in the plugin wrapper (or moves to a separate cost step), calling #1501's plain-value
Settle. Moving it changes when the settle-once latch runs, so it needs its own test. - Saved test cases as the safety net: real captured request and response pairs (JSON and SSE, per agent) stored under
testdata/, each with the expected parsed result, run by one table test per library. They prove the move changed nothing, and they also show exactly what Cortex needs from a parser if another one (e.g. praxis-ai's) were ever used instead. A request to praxis-ai to expose parsed content to other filters is drafted as a Discussion, not yet posted; see #1437's tracker.
Design questions
- Library API: whole-body functions only, or also the incremental frame fold the streaming path uses?
- Should captured fixtures be scrubbed (no real prompts), and where do they come from — a capture tool reading the session archive?
- Fixture format: one file per case (request, response, expected), or one golden file per parser?
Done when
- The three parser plugins contain no parsing logic, only calls into the libraries;
ParseResponsekeeps working for cpex. - Each library has saved real-traffic test cases covering request, JSON response and SSE response.
- The parser libraries import neither
core/cost/settlenorcore/cost/pricing. The plugin wrapper may.
Evidence read at main @ e455a04 (2026-10-25); not built.
- Ngôn ngữ chính
- Go
- Star
- 21
- Fork
- 43
- Merge trung bình
- 14 giờ 26 phút
- Pull request đã merge (30 ngày)
- 239
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của rossoctl/cortex
-
UI shows costs for all sessions even when drilled into a sessionCó thể đã có người làm @esnible đã nhận 15 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
rossoctl/cortex#1116 · 2 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
agentop configure codex/opencode can wait on itself when an agent runs itCó thể đã có người làm @Alan-Cha đã nhận hôm nay. Đang mở
rossoctl/cortex#1530 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
Maintainer thường phản hồi trong vòng 1 ngày
-
WebSocket turns carry only new input, so conversation-level plugins see less of a Codex sessionCó thể đã có người làm @Alan-Cha đã nhận 1 ngày trước. Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
rossoctl/cortex#1515 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement laptop
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của rossoctl/cortex
Issue tương tự
-
Dokumentasjon på nais defaultsĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
agent-butler-finding bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
jordansmall/spindrift#6161 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
open-telemetry/opentelemetry-go-compile-instrumentation#1635 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
C-bug O-community X-blathers-untriaged
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 84/100
cockroachdb/cockroach#176210 · 1 bình luận ·
-
VLAgent `spec.k8sCollector.includePodLabels: false` has no effectCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
VictoriaMetrics/operator#2772 ·
Maintainer thường phản hồi trong vòng 1 ngày