Skip to content

feat(middleware): implement CodexCliRuntime concrete class (#12)#13

Merged
alexey-pelykh merged 1 commit intomainfrom
feat/codex-cli-runtime
Feb 25, 2026
Merged

feat(middleware): implement CodexCliRuntime concrete class (#12)#13
alexey-pelykh merged 1 commit intomainfrom
feat/codex-cli-runtime

Conversation

@alexey-pelykh
Copy link
Copy Markdown

Summary

  • Implement CodexCliRuntime extending CLIRuntimeBase for OpenAI's codex CLI (src/middleware/runtimes/codex.ts)
  • Handle the two-level Codex event model: 8 top-level event types (thread/turn/item lifecycle) × 8 item sub-types (agent_message, command_execution, mcp_tool_call, etc.)
  • Implement CodexMcpConfigManager with merge-restore pattern for ~/.codex/config.toml TOML config lifecycle
  • Delta text computation from progressive item.updated events (Codex sends accumulated text, not incremental deltas)
  • Cross-provider contamination prevention: strips ANTHROPIC_API_KEY from subprocess environment
  • 48 unit tests covering argument construction, all event types, environment setup, TOML serialization, MCP config management, and done event enrichment

Test plan

  • pnpm build passes
  • pnpm check (format + typecheck + lint) passes clean
  • 48 unit tests pass covering all acceptance criteria
  • Full test suite (10,691 tests) passes — 1 pre-existing flaky failure in supervisor.test.ts unrelated to changes

Closes #12

🤖 Generated with Claude Code

@alexey-pelykh alexey-pelykh merged commit 3706c53 into main Feb 25, 2026
2 checks passed
@alexey-pelykh alexey-pelykh deleted the feat/codex-cli-runtime branch February 25, 2026 14:39
@alexey-pelykh
Copy link
Copy Markdown
Author

The ANTHROPIC_API_KEY stripping in buildEnv() was scope creep from the issue spec — Claude and Gemini runtimes don't do this, so it's inconsistent. Follow-up #14 to clean it up.

@alexey-pelykh alexey-pelykh mentioned this pull request Feb 26, 2026
9 tasks
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.

Implement CodexCliRuntime concrete class

1 participant