[Go SDK] Add tests for harness providers (claim one file if you want)
Test coverage: Go SDK harness/ — factory, cli, result, provider, providers
The harness package has a factory, CLI wrapper, result struct, options helpers, and four provider implementations (claudecode, codex, gemini, opencode). Four of these providers follow the same shape. Bundled into one issue because the testing patterns share infrastructure.
Scope
New test files:
sdk/go/harness/factory_test.gosdk/go/harness/cli_test.gosdk/go/harness/result_test.gosdk/go/harness/provider_test.gosdk/go/harness/claudecode_test.gosdk/go/harness/opencode_test.gosdk/go/harness/gemini_test.gosdk/go/harness/codex_test.go
Test cases
factory.go / BuildProvider:
BuildProvider("opencode", "path")returns*OpenCodeProviderBuildProvider("claude-code", "path")returns*ClaudeCodeProviderBuildProvider("unknown", "")returns a helpful error
cli.go:
RunCLIexecutes a basic command (echo) and captures stdoutRunCLIcorrectly merges env vars (and unsets when value is empty)RunCLIrespects context cancellation / timeoutStripANSIremoves complex escape sequencesisExecNotFoundidentifies "executable file not found" errors
result.go:
(r *Result) Text()returns the raw result string- Various
FailureTypevalues produce consistent serialization
provider.go / Options:
maxRetries()returns set value or default (3)timeout()returns set value or default (600)- Each default/override path covered
claudecode.go / opencode.go / gemini.go / codex.go .Execute:
- Constructs correct CLI flags per provider (model, max-turns, etc.)
- Parses session metrics from provider output
- Handles binary-not-found gracefully
- Captures stdout as result; handles non-zero exit codes
Fixture / mock boundary
- Real
exec.Commandwith short shell scripts (sh -c 'echo ...') forRunCLI - Mock
claude/codex/gemini/opencodebinaries via tiny shell scripts int.TempDir() - Table-driven subtests
Acceptance criteria
- [ ] All 8 test files added
- [ ]
go test ./sdk/go/harness/...passes - [ ] Coverage on
sdk/go/harness≥80%
Claim one or all: this issue is contributor-friendly to split — feel free to claim just one file (
factory_test.gois the easiest entry point) and leave the rest for others.
Size: L · Difficulty: intermediate · Language: Go
Part of epic #387 — parent tracker.
How to work on this
Setup
git clone https://github.com/Agent-Field/agentfield.git
cd agentfield
make install # installs Go, Python (via uv), and Node deps
make build # optional — builds the control plane binary
Run the baseline test suite
Before you change anything, run the tests for the language this issue targets so you know what "green" looks like:
- Go control plane:
cd control-plane && go test ./... -count=1 - Go SDK:
cd sdk/go && go test ./... -count=1 - Python SDK:
cd sdk/python && uv run pytest -q - TypeScript SDK:
cd sdk/typescript && bun test
Package coverage baseline (so you can show improvement in the PR):
go test -cover ./control-plane/internal/...uv run pytest --cov=agentfield sdk/python/testsbun test --coverage(TypeScript)
Using Claude Code or another AI coding agent
This repo has a CLAUDE.md at the root that Claude Code and compatible agents will read automatically. A working flow:
cdinto the repo and runclaude(or open in your IDE's agent).- Paste this issue URL and say: "Please implement this issue, following every acceptance-criteria checkbox. Do not change source files — only add tests under the target path in the issue. When you're done, run the test suite command from the issue and paste the result."
- Let the agent read existing tests in the same package as a model for style / fixtures — we point to them in the issue.
- Run
make lintbefore opening the PR.
See the AI-Assisted Contributions guide for testing requirements. Tag your PR with ai-assisted if you used an AI agent.
Claiming this issue
Comment I'd like to work on this and a maintainer will assign it to you. If you're new to open source, issues labelled good first issue or first-timers-only are hand-picked for a smooth first PR — we'll guide you if you get stuck.
Opening the PR
- Branch name:
tests/<short-description>orrefactor/<short-description> - Link this issue in the PR description with
Closes #<number> - Paste the before/after test output or coverage delta in the PR body
- Keep the diff to the scope in this issue — no drive-by cleanups
Help & questions
- Comment on this issue — we monitor all assigned issues.
- Join the community Discord: run
/gsd-join-discordor check the README for the invite. - For repo-wide questions, open a discussion with the
helptag.
i already worked and created the opencode_test.go with that i like to contribute on sdk/go/harness/factory_test.go this file too.
Thanks for picking this up, @dinzz005! :tada:
Here's what to expect:
- We'll check in after 7 days if we haven't heard an update
- After 14 days, we'll send a second reminder
- After 21 days without activity, we'll unassign to let others contribute
Tips for success:
- Drop a comment when you start working on it
- Share any blockers - we're here to help!
- Link your PR with
Fixes #404in the description
Happy coding! :rocket:
Hey @dinzz005! :wave:
Just a friendly reminder that you're assigned to this issue. It's been about a week since assignment.
How's it going? We'd love to hear:
- Any progress updates?
- Running into any blockers we can help with?
- Need more time? (Totally fine!)
A quick comment helps us know you're still interested. If your plans have changed, no worries at all - just let us know and we can find another contributor.
Thanks for contributing to AgentField! :rocket:
Hi @dinzz005,
Just checking in again! It's been 14 days since we last heard from you on this issue.
Quick options:
- :speech_balloon: Drop a comment with a progress update
- :link: Link a draft PR if you've started working on it
- :wave: Let us know if you'd like to be unassigned (no judgment!)
If we don't hear back in 7 days, we'll unassign this issue to give other contributors a chance to help.
Thanks for understanding!
Hi @dinzz005,
It's been 22 days since the last update on this issue. To keep the project moving, we've unassigned this issue so other contributors can pick it up.
No worries at all! Life happens, and we totally understand. If you'd like to continue working on this, just comment here and we'll reassign it to you.
This issue is now available for anyone who'd like to contribute. Check out our contribution guidelines if you're interested!
Thanks for your interest in AgentField! :heart:
I'd like to work on sdk/go/harness/factory_test.go from this issue.
I'd like to work on result_test.go
Hi! I'd like to work on the sdk/go/harness/provider_test.go slice of this issue.