Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Split the shared data types out of core/pipeline

未关闭
#1,502 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
35/100
Issue 类型
重构
描述清晰度
基本清楚
活跃度
活跃
技术栈
go
领域
backend

调研方向

Start by reading the listed data files in core/pipeline, especially extensions.go, session.go, promptcontext.go, client.go, and context.go, then trace their imports into core/session and core/cost/event. The issue leaves package boundaries and the transition strategy open, so settle those design questions before moving types. Done means the named session and cost packages build without importing core/pipeline and go test ./... passes in every module.

由索引模型根据 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

core/pipeline (about 6,900 non-blank lines) holds two different things:

46 non-test packages import it (39 in core, plus cmd/cortex, cmd/cortex-envoy, four agentop packages and scripts/readme-demo). Several use only the data half directly:

Package Uses from core/pipeline directly
core/cost/pricing InferenceExtension only
core/session/archive SessionEvent, RawJSON
core/cost/usage event and parsed-request types, plus the client and agent-name helpers (ParseUserAgent, IsKnownAgent, AgentName, IsControlRune)
core/cost/ledger event types, plus AgentName, IsControlRune, ParseUserAgent, UnknownClientLabel (pipeline.Context appears only in a test)

But they also reach the engine indirectly:

  • core/session imports pipeline, and returns *pipeline.SessionView from View, ViewTail and ViewPage. The archive imports core/session (Recorder, History, Interner, SummaryFold), and the ledger imports it for one compile-time check (var _ session.Recorder, writer.go:335).
  • core/cost/event imports pipeline (event.go:569, :594), and usage and ledger both import it.

So anything that wants to read or store a Cortex event — the session store, the archive, the cost ledger, agentop — pulls in the whole plugin engine with it.

Proposal

Move the data types into their own package (e.g. core/event or core/model) that imports no engine code, and have core/pipeline re-export or import them.

What moves to the data package:

  • the parsed-request types, SessionEvent and sessionEventWire with its JSON (un)marshalling;
  • PromptContext, EventClient, and the client and agent-name helpers in client.go;
  • Direction and its constants and JSON methods (they live in context.go:45);
  • SessionView and its query methods (session.go:675-787): pure data plus filters over events, and core/session returns it. Alternatively, have the store return []SessionEvent and leave SessionView in the engine;
  • SnapshotInference and PluginEventSuffix.

What stays in the engine: Context, SetState/GetState (they take *Context), the *Context helpers in snapshot.go, and Extensions.Custom.

Obstacles found (checked by compiling the data files as a standalone package, with no cycle):

  • extensions.go mixes data with SetState/GetState, so it has to be split.
  • content.go's Fragments() methods implement capabilities.ContentSource, and methods can't leave their type's package, so the data package imports core/capabilities (a leaf; no cycle).
  • cost/event also has to move off pipeline, and ledger's session.Recorder assertion move or go.

Also:

  • agentop uses some engine symbols too (ErrorPolicy*, Metric/MetricsProvider), so it won't drop the engine import entirely.
  • Unused exported SessionView methods (Intents, ToolCalls, ToolResponses, FailedEvents, LastError) are public API; keep them.

This should land before #1503 and #1504, so their libraries and decision cores can depend on the data package instead of the engine.

Design questions

  1. One data package, or one per concern (inference, event, client)?
  2. Type aliases in core/pipeline for a transition period, or a single rename across the tree?
    • core is consumed outside this repo: core/README.md names the operator and rossoctl-cli. Today both pin the old module path …/authbridge/authlib, so they break only when they bump, which is a module-path move anyway.
    • Aliases work for types. Constants and functions need re-declared wrappers.

Done when

  • core/session, core/session/archive, core/cost/event and core/cost/{ledger,usage,pricing} build without importing core/pipeline (go list -deps).
  • go test ./... passes in every module with no test changed other than imports.

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

主要语言
Go
星标
21
派生
43
平均合并
14 小时 25 分钟
30 天内合并 PR
245

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

rossoctl/cortex 的其他 Issue

查看 rossoctl/cortex 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。