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

Đang mở
#414 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@fx-kurumi đang làm issue này rồi.

Từ ngày 13/11/2026.

  • #415 của @fx-kurumi — đang mở

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
20/100
Loại issue
Tái cấu trúc
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
go
Lĩnh vực
tooling

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

现状问题

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/
Ngôn ngữ chính
Go
Star
141
Fork
28
Merge trung bình
1 ngày 15 giờ
Pull request đã merge (30 ngày)
113

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Tencent/LoopForge

Tất cả issue của Tencent/LoopForge

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.