-
Notifications
You must be signed in to change notification settings - Fork 129
Open
Labels
ai-friendlyWell-documented task suitable for AI-assisted developmentWell-documented task suitable for AI-assisted developmentarea:harnessCoding agent harness integrationCoding agent harness integrationenhancementNew feature or requestNew feature or requestsdk:pythonPython SDK relatedPython SDK relatedsdk:typescriptTypeScript SDK relatedTypeScript SDK related
Description
Overview
Implement the Codex provider. Python uses CLI subprocess (codex exec --json). TypeScript uses native SDK (@openai/codex-sdk).
Branch: feat/harness-v2
Design doc: docs/design/harness-v2-design.md (Sections 4, 10.2)
Scope
Python (sdk/python/agentfield/harness/providers/)
-
codex.py—CodexProviderimplementingHarnessProvider:- CLI subprocess:
codex exec --json [--full-auto] [-C cwd] prompt - Parse JSONL event stream from stdout
- Extract final result text, messages, metrics
- Support configurable binary path via
codex_bin
- CLI subprocess:
-
_cli.py— Shared async subprocess utilities:async run_cli(cmd, env, cwd, timeout)→ stdout, stderr, returncode- JSONL line parser
- Register in
_factory.pyfor provider name"codex" - Tests with mocked subprocess
TypeScript (sdk/typescript/src/harness/providers/)
-
codex.ts—CodexProviderimplementingHarnessProvider:- Uses
@openai/codex-sdk(native TS SDK, optional peer dep) - Maps HarnessOptions → Codex SDK options
- Collects results
- Uses
-
cli.ts— Shared subprocess utilities (for other CLI providers) - Register in
factory.ts - Tests with mocked SDK
Key Details
- Codex CLI outputs JSONL events to stdout
--full-automaps topermission_mode: "auto"-C <path>sets working directory--jsonenables JSONL output mode- Binary path configurable via
HarnessConfig.codex_bin
Acceptance Criteria
- CLI command constructed correctly for all option combinations
- JSONL parsing extracts messages and final result
- Handles binary not found (FileNotFoundError → clear error)
- Handles non-zero exit codes
- Shared CLI utilities reusable by Gemini/OpenCode providers
- All tests pass
Dependencies
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
ai-friendlyWell-documented task suitable for AI-assisted developmentWell-documented task suitable for AI-assisted developmentarea:harnessCoding agent harness integrationCoding agent harness integrationenhancementNew feature or requestNew feature or requestsdk:pythonPython SDK relatedPython SDK relatedsdk:typescriptTypeScript SDK relatedTypeScript SDK related