Skip to content

feat(sdk/go): add Codex and Gemini harness providers#305

Merged
AbirAbbas merged 5 commits intomainfrom
feat/harness-codex-gemini-providers
Mar 26, 2026
Merged

feat(sdk/go): add Codex and Gemini harness providers#305
AbirAbbas merged 5 commits intomainfrom
feat/harness-codex-gemini-providers

Conversation

@AbirAbbas
Copy link
Copy Markdown
Contributor

Summary

  • Adds Codex provider (codex.go) — invokes codex exec --json, parses JSONL event stream for turns, session IDs, and agent messages
  • Adds Gemini provider (gemini.go) — invokes gemini -p, captures plain text output (single-turn)
  • Adds BuildProvider() factory (factory.go) — unified constructor for all 4 providers
  • Refactors runner.buildProvider() to delegate to the factory
  • Full test coverage for both new providers and the factory function

Completes the Go SDK harness checklist from #207 (all 13 items now done).

Test plan

  • go test ./harness/ — all tests pass (including 12 new tests)
  • go test ./... — full Go SDK test suite passes
  • Manual test with real Codex CLI (OPENAI_API_KEY required)
  • Manual test with real Gemini CLI (GEMINI_API_KEY required)

How to test manually

// Codex
agent.Harness(ctx, "Write hello world", nil, nil, harness.Options{
    Provider: "codex",
    PermissionMode: "auto",
})

// Gemini
agent.Harness(ctx, "Write hello world", nil, nil, harness.Options{
    Provider: "gemini",
    Model: "gemini-2.5-pro",
    PermissionMode: "auto",
})

Fixes #207

🤖 Generated with Claude Code

…er factory

Implements the remaining two CLI-based harness providers for the Go SDK,
completing the feature parity with Python/TS implementations.

- codex.go: Codex provider using `codex exec --json` with JSONL event parsing
- gemini.go: Gemini provider using `gemini -p` with plain text output
- factory.go: BuildProvider() factory for all 4 providers
- Refactored runner.buildProvider() to delegate to BuildProvider()
- Full test coverage for both providers and the factory

Fixes #207

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@AbirAbbas AbirAbbas requested a review from a team as a code owner March 26, 2026 13:17
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 26, 2026

Performance

SDK Memory Δ Latency Δ Tests Status
Go 225 B -20% 0.61 µs -39%

✓ No regressions detected

AbirAbbas and others added 4 commits March 26, 2026 10:01
Real Codex CLI uses thread_id (not session_id) in thread.started events
and text (not content) in agent_message items. Fixed parser to handle
both field names. Added integration test (build tag: integration).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Run with: go test ./harness/ -tags=integration
Requires: codex CLI auth'd, GEMINI_API_KEY env var set with
gemini settings.json auth type set to gemini-api-key.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@AbirAbbas AbirAbbas merged commit 94c67c1 into main Mar 26, 2026
17 checks passed
@AbirAbbas AbirAbbas deleted the feat/harness-codex-gemini-providers branch March 26, 2026 14:55
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.

[Go SDK] Port .harness() to Go SDK

1 participant