【架构优化】从 runtime.codexConfigArgs 中拆出单个 MCP server 参数渲染 codexMCPServerArgs

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

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

@fx-kurumi がすでに取り組んでいます。

2026年11月13日 から。

  • #415 @fx-kurumi による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
20/100
issue の種類
リファクタリング
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
go
領域
tooling

調査の方向性

Read internal/runtime/provider_codex.go, focusing on codexConfigArgs and its MCP server argument rendering loop. Add tests in a new test file for an HTTP server, a stdio server with cwd/args/env/timeout, and the combined output; run gofmt, go vet ./internal/runtime/, and go test ./internal/runtime/. Done means the extracted function preserves the existing argument order and formatting, and all checks pass.

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

説明

现状问题

internal/runtime/provider_codex.go 的 codexConfigArgs 同时负责三件事:开发者指令与 shell 环境策略、skills 配置、以及每个 MCP server 的 -c mcp_servers.<id>.* 参数渲染。其中 MCP server 的渲染(http/stdio 分支、cwd、args 引号拼接、env 排序拼接、tool_timeout_sec)嵌套在 for 循环里达 4 层,占函数大半,可读性差,也无法单独测试单个 server 的渲染结果。

重构方案

把循环体抽成包内函数 codexMCPServerArgs(m domain.MCPServerDefinition) []string,原循环改为 args = append(args, codexMCPServerArgs(m)...)。参数顺序、引号与格式逐字保持一致。

影响范围

仅 internal/runtime/provider_codex.go 一个函数(包内私有),对外接口与行为不变;新增一个测试文件。

验证方式

  • 新增单元测试覆盖 http server、带 cwd/args/env/timeout 的 stdio server,以及 codexConfigArgs 整体输出与逐 server 拼接一致
  • gofmt、go vet ./internal/runtime/、go test ./internal/runtime/
主要言語
Go
スター
141
フォーク
28
平均マージ
1日 15時間
マージ済み PR(30日)
113

環境構築

はじめの一歩

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

Tencent/LoopForge のほかの issue

Tencent/LoopForge の issue をすべて見る

似ている issue

Go の issue をもっと見る

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

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