Skip to content

feat: add Go test-runner MCP plugin - #23

Merged
kwrkb merged 3 commits into
masterfrom
feat/test-runner
Sep 19, 2026
Merged

kwrkb merged 3 commits into
masterfrom
feat/test-runner

Conversation

@kwrkb

@kwrkb kwrkb commented Sep 19, 2026

Copy link
Copy Markdown
Owner

Goテストの実行結果をAIが扱いやすくするため、go_test MCPツールを提供する test-runner プラグインを追加します。1モジュールずつ同期実行し、テスト失敗とビルド失敗を区別して、失敗ログと対象を絞った再実行引数を返します。

変更内容

  • パッケージのモジュール所属確認、ログ保持・返却量の制限、全体タイムアウト、MCPキャンセルと子プロセス停止に対応。
  • 実Goを使った成功・失敗・panic・TestMain・ビルド失敗・モジュール境界・再実行・MCP stdioのテストを追加。
  • Go 1.26.8によるLinux amd64・macOS arm64・Windows amd64の配布バイナリとdispatcherを追加。
  • ビルドスクリプト、3環境のCI、日英README、利用スキル、プロジェクト文書を更新。

検証

  • Linux / Go 1.26.8: go vet ./...、go test -race -count=1 ./... 通過。
  • 既存の govulncheck-gate.sh による脆弱性検査通過。
  • ./build.sh test-runner による3環境のビルドと、再ビルド前後のSHA-256一致を確認。
  • 一時配置した配布物を別ディレクトリから起動し、MCP tool list・成功/失敗結果・キャンセルを確認。
  • macOS/Windows向けテストバイナリのクロスコンパイル、プラグインvalidator、skill validator、git diff --check 通過。

macOS/Windowsでのネイティブ実行とPowerShellビルドはローカル未検証です。ネイティブ実行用CIを追加しています。テストはホスト権限・Go環境を継承してプロジェクトコードを実行し、このプラグイン自体はサンドボックスを提供しません。

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 19, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-19T12:07:00.096731Z 80e4c15 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2129044630

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread test-runner/src/main.go
}
}
for _, p := range o.Packages {
if p == "" || strings.HasPrefix(p, "-") || strings.ContainsAny(p, "\x00\r\n") || strings.HasSuffix(p, ".go") {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Accept package paths ending in .go

A valid package directory or import path may end in .go; Go 1.24.3 accepts go list -- ./pkg.go, and go help packages states that a path beginning with . denotes the package in that directory. This check rejects such packages, and it also makes a generated rerun unusable when a failed package's resolved import path ends in .go, because passing the returned object back through parseOptions fails before execution. Distinguish actual Go file lists using discovery results rather than the string suffix.

AGENTS.md reference: AGENTS.md:L38-L38

Useful? React with 👍 / 👎.

kwrkb and others added 2 commits September 19, 2026 20:53
…rails

- An all-skipped run reports `passed` with only `tests.skipped`, not `no_tests`
- Restore the notes lost in the Japanese localization: no_tests is not proof,
  counts include parent tests and subtests, error/timeout/cancelled are never a
  clean run, no automatic retries, broaden testing only when warranted
- Drop the README sentence that only explained the old -codex skill name

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@kwrkb
kwrkb merged commit 1b316f6 into master Sep 19, 2026
11 checks passed
@kwrkb
kwrkb deleted the feat/test-runner branch September 19, 2026 12:03

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 80e4c15195

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread test-runner/src/main.go
Comment on lines +48 to +50
o.Run, ok = v.(string)
if !ok || strings.ContainsRune(o.Run, 0) {
return o, fmt.Errorf("run must be a string without NUL bytes")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reject invalid -run expressions before invoking tests

When run is a malformed expression such as [, the -run regexp semantics documented by go help testflag make go test emit a package-level fail event and exit 1; the current parser consequently returns status: "failed" with MCP isError: false, even though no test failed and the caller supplied invalid input. Validate the expression here and return status: "error" so agents do not misreport an invocation error as a project test failure.

AGENTS.md reference: AGENTS.md:L42-L43

Useful? React with 👍 / 👎.

kwrkb added a commit that referenced this pull request Sep 19, 2026
Both findings come from the Codex review on PR #23 (already merged), so
they land as a follow-up.

- Accept package patterns ending in ".go". A directory or import path may
  end in ".go" (go list resolves ./pkg.go to <module>/pkg.go), and the
  spelling check also rejected the tool's own generated rerun arguments.
  A real .go file list is rejected by its discovery result instead,
  because go list reports it as "command-line-arguments".
- Reject a -run expression the test binary would reject at startup. Left
  to go test, "-run [" fails every package with zero failing tests, so an
  input error was reported as status "failed" with isError false. The
  element split mirrors testing.splitRegexp, including the escape branch
  (without it an escaped separator such as `a\/b` splits into `a\`, which
  does not compile) and the whitespace rewrite (without it `(?P<a b>x)`
  would be rejected although go test accepts it). Agreement with real
  "go test -run" verified on 22 expressions.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant