Skip to content

Add support for Codex and Gemini#2

Open
mgorunuch wants to merge 3 commits into
mainfrom
claude/add-codex-gemini-support-0152gFJoVdj7DWeS2uBb9cJy
Open

Add support for Codex and Gemini#2
mgorunuch wants to merge 3 commits into
mainfrom
claude/add-codex-gemini-support-0152gFJoVdj7DWeS2uBb9cJy

Conversation

@mgorunuch

Copy link
Copy Markdown
Contributor

This commit enables OpenAI Codex and Google Gemini as runner options for task execution, expanding the available AI providers beyond Claude.

Changes:

  • Enable codex and gemini runners in pipeline-executor.ts

    • Remove from disabled runners list
    • Add to runnerKeyMap with appropriate API key requirements
    • OPENAI_API_KEY for codex
    • GOOGLE_API_KEY for gemini
  • Implement codex-pipeline.ts with OpenAI SDK integration

    • Add workspace cloning and git branch management
    • Integrate OpenAI SDK for code generation
    • Support MOCK_MODE for testing
    • Track usage metrics and costs
    • Push changes to file spaces with merge requests
  • Implement gemini-pipeline.ts with Google Generative AI SDK

    • Add workspace cloning and git branch management
    • Integrate Google Generative AI SDK
    • Support MOCK_MODE for testing
    • Track usage metrics and costs
    • Push changes to file spaces with merge requests

Both pipelines follow the same pattern as claude-pipeline.ts:

  • Validate environment variables
  • Fetch session and task from API
  • Clone and prepare workspaces
  • Execute AI agent with task prompt
  • Run completion and clarification checks
  • Push results and create merge requests

This commit enables OpenAI Codex and Google Gemini as runner options
for task execution, expanding the available AI providers beyond Claude.

Changes:
- Enable codex and gemini runners in pipeline-executor.ts
  - Remove from disabled runners list
  - Add to runnerKeyMap with appropriate API key requirements
  - OPENAI_API_KEY for codex
  - GOOGLE_API_KEY for gemini

- Implement codex-pipeline.ts with OpenAI SDK integration
  - Add workspace cloning and git branch management
  - Integrate OpenAI SDK for code generation
  - Support MOCK_MODE for testing
  - Track usage metrics and costs
  - Push changes to file spaces with merge requests

- Implement gemini-pipeline.ts with Google Generative AI SDK
  - Add workspace cloning and git branch management
  - Integrate Google Generative AI SDK
  - Support MOCK_MODE for testing
  - Track usage metrics and costs
  - Push changes to file spaces with merge requests

Both pipelines follow the same pattern as claude-pipeline.ts:
- Validate environment variables
- Fetch session and task from API
- Clone and prepare workspaces
- Execute AI agent with task prompt
- Run completion and clarification checks
- Push results and create merge requests
This commit adds two new worker microservices for executing AI tasks using OpenAI Codex and Google Gemini, completing the multi-provider support for the ADI system.

New Microservices:
- micros-codex-worker: OpenAI Codex worker for task evaluation and implementation
- micros-gemini-worker: Google Gemini worker for task evaluation and implementation

Features:
- RabbitMQ-based task queue integration via worker-sdk
- Support for both evaluation and implementation phases
- Workspace cloning and git branch management
- Cost tracking and usage metrics
- Graceful shutdown and error handling
- Configurable concurrency

Architecture:
Both workers follow the same pattern as micros-claude-worker:
- src/index.ts: Main worker entry point with RabbitMQ integration
- src/utils/*-executor.ts: AI model execution logic
- src/utils/workspace-cloner.ts: Shared workspace management

Configuration:
Codex Worker:
- RABBITMQ_URL: RabbitMQ connection URL
- WORKER_NAME: Worker identifier (default: codex-worker)
- MAX_CONCURRENCY: Max parallel tasks (default: 3)
- OPENAI_API_KEY: OpenAI API key (can be overridden per task)

Gemini Worker:
- RABBITMQ_URL: RabbitMQ connection URL
- WORKER_NAME: Worker identifier (default: gemini-worker)
- MAX_CONCURRENCY: Max parallel tasks (default: 3)
- GOOGLE_API_KEY: Google API key (can be overridden per task)

These microservices work alongside the existing pipeline-based runners to provide flexible execution options for different use cases.
This commit adds Docker support for the Codex and Gemini worker microservices, enabling containerized deployment of the multi-provider AI system.

Changes:
- docker-compose.prod.yaml: Add micros-codex-worker and micros-gemini-worker services
- packages/micros-codex-worker/Dockerfile: Multi-stage Docker build for Codex worker
- packages/micros-gemini-worker/Dockerfile: Multi-stage Docker build for Gemini worker

Docker Services:
Both services follow the same architecture as micros-claude-worker:
- Depend on RabbitMQ and database migrations
- Support configurable concurrency
- Include health checks for monitoring
- Auto-restart on failure
- Run with tsx for TypeScript support

Environment Variables:
Codex Worker:
- RABBITMQ_URL: RabbitMQ connection
- WORKER_NAME: codex-worker
- MAX_CONCURRENCY: ${CODEX_WORKER_CONCURRENCY:-3}
- OPENAI_API_KEY: OpenAI API key (optional fallback)
- OPENAI_API_BASE: Custom endpoint (optional)
- OPENAI_ORGANIZATION: Organization ID (optional)

Gemini Worker:
- RABBITMQ_URL: RabbitMQ connection
- WORKER_NAME: gemini-worker
- MAX_CONCURRENCY: ${GEMINI_WORKER_CONCURRENCY:-3}
- GOOGLE_API_KEY: Google API key (optional fallback)

Deployment:
# Start all services including new workers
docker-compose -f docker-compose.prod.yaml up -d

# Scale workers independently
docker-compose -f docker-compose.prod.yaml up -d --scale micros-codex-worker=2
docker-compose -f docker-compose.prod.yaml up -d --scale micros-gemini-worker=2
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.

2 participants