Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Turn the MCP, A2A and inference parsers into libraries, with saved real-traffic test cases

オープン
#1,503 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
25/100
issue の種類
リファクタリング
明瞭さ
おおむね明確
活発さ
活発
技術スタック
go
領域
backend, testing

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

enhancement laptop

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-praxis converter 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):
  • 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 the Mcp-Session-Id header. parseMCPResponse returns an unexported type that applyMCPResponseRPC writes into pctx.
  • A2A (not pure today): request parsing is inline in OnRequest (a2aparser/plugin.go:35-127). Response parsing is extractSendResponse, extractStreamEvent and sessionIDFromJSON (:259-430). parseA2AParts is 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

  1. Parser libraries (e.g. core/parse/inference, core/parse/mcp, core/parse/a2a): exported ParseRequest(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 OnRequest first.
    • The libraries depend on the data package from #1502, so #1502 should land first.
  2. 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.
  3. 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

  1. Library API: whole-body functions only, or also the incremental frame fold the streaming path uses?
  2. Should captured fixtures be scrubbed (no real prompts), and where do they come from — a capture tool reading the session archive?
  3. 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; ParseResponse keeps 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/settle nor core/cost/pricing. The plugin wrapper may.

Evidence read at main @ e455a04 (2026-10-25); not built.

主要言語
Go
スター
21
フォーク
43
平均マージ
13時間 8分
マージ済み PR(30日)
267

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

rossoctl/cortex のほかの issue

rossoctl/cortex の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。