Skip to content

fix: update codex adapter for codex-cli >= 0.118.0#9

Closed
velvetmonkey wants to merge 1 commit into
askbudi:mainfrom
velvetmonkey:fix/codex-exec-v0.118
Closed

fix: update codex adapter for codex-cli >= 0.118.0#9
velvetmonkey wants to merge 1 commit into
askbudi:mainfrom
velvetmonkey:fix/codex-exec-v0.118

Conversation

@velvetmonkey
Copy link
Copy Markdown

Summary

  • codex proto was removed in recent codex-cli versions (tested on 0.118.0). This rewrites the Codex adapter to use codex exec --json instead.
  • Fixes argument ordering (--skip-git-repo-check must come after the exec subcommand)
  • Sets stdin=DEVNULL to prevent codex from reading the MCP server's JSON-RPC transport (which caused indefinite hangs)
  • Removes print() statements that corrupted MCP JSON-RPC stdout
  • Parses the new JSONL event format (item.completed, turn.completed)

What was broken

The adapter called codex proto which no longer exists, causing immediate process exit with 0 output. Even after switching to codex exec, two more issues surfaced:

  1. --skip-git-repo-check was placed before exec (invalid arg position)
  2. Without stdin=DEVNULL, codex inherited the MCP server's stdin and hung reading JSON-RPC messages

Test plan

  • Verified codex exec --json works directly from CLI
  • Verified roundtable codex_subagent MCP tool returns correct responses
  • Tested with codex-cli 0.118.0

🤖 Generated with Claude Code

The `codex proto` subcommand was removed in recent codex-cli versions.
This rewrites the adapter to use `codex exec --json` instead.

Key changes:
- Replace `codex proto` with `codex exec --json` (non-interactive JSONL)
- Move `--skip-git-repo-check` after `exec` subcommand (correct arg order)
- Set stdin=DEVNULL to prevent codex from reading the MCP JSON-RPC transport
- Parse the new JSONL event format (item.completed, turn.completed)
- Remove print() statements that corrupt MCP JSON-RPC stdout
- Remove unused LineBuffer import and session resume logic

Tested against codex-cli 0.118.0.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
velvetmonkey pushed a commit to velvetmonkey/roundtable that referenced this pull request Apr 5, 2026
* feat(server): expose Qwen agent in MCP server

- Add QwenCLI import and integration
- Create check_qwen_availability() tool
- Create qwen_subagent() tool with streaming support
- Update valid_subagents to include 'qwen'
- Update default configuration to include Qwen
- Update CLI help and examples
- Update README.md with Qwen documentation

Closes #1

* ci: add CodeQL security scanning workflow (#32)

- Enables Code Scanning for Python code
- Runs on push to main and extended branches
- Runs on pull requests
- Satisfies repository rule requirements

* test: add comprehensive test suite

- Create test structure (unit, integration, fixtures)
- Add pytest configuration with asyncio support
- Add coverage configuration (.coveragerc)
- Implement 27 tests across 5 test files:
  * test_server_config.py (8 tests)
  * test_availability_checker.py (6 tests)
  * test_mcp_tools.py (4 tests)
  * test_model_mapping.py (6 tests)
  * test_server_integration.py (3 tests)
- Add shared fixtures in conftest.py
- Add pytest-cov to dev dependencies
- Create development setup script
- Add testing documentation
- Update README with testing section

Closes askbudi#2

* chore: add .gitignore and clean cache files

- Add comprehensive .gitignore
- Remove __pycache__ and coverage files from tracking

* ci: add comprehensive CI/CD pipeline

- Add GitHub Actions workflows:
  * test.yml: Run tests on Python 3.10, 3.11, 3.12
  * release.yml: Automated releases and PyPI publishing
  * codeql.yml: Security scanning (resolves push blocking)
- Add Dependabot configuration for automated updates
- Add CONTRIBUTING.md with complete contribution guide
- Update README with CI/CD badges
- Configure Codecov integration

This resolves the Code Scanning blocking issue.

Closes askbudi#3

* docs: add comprehensive development documentation

- Add DEVELOPMENT.md with complete dev guide
  * Architecture overview
  * Project structure
  * Step-by-step guide for adding agents
  * Testing and debugging
  * Release process
- Add CHANGELOG.md following Keep a Changelog format
- Add ARCHITECTURE.md with technical details
  * System diagrams
  * Component descriptions
  * Data flow documentation
  * Configuration system
  * Security considerations
- Complete documentation for contributors

Closes askbudi#4

* refactor: improve error handling

- Add custom exception hierarchy
  * RoundtableError base class with error codes
  * Specific exceptions for different error types
  * Context tracking for debugging
- Add retry logic with exponential backoff
  * retry_async and retry_sync decorators
  * Configurable attempts and delays
  * Support for retryable errors
- Add error handling utilities
  * Path validation with detailed errors
  * Error response formatting
  * Structured error logging
- Add 29 new tests for error handling
  * Exception tests
  * Retry logic tests
  * Error handler utility tests

Closes askbudi#5

* feat: add optional metrics and observability

- Add metrics collection system (OPTIONAL, disabled by default)
  * ExecutionMetric dataclass for tracking
  * MetricsCollector for aggregation
  * track_execution() context manager
  * Per-agent statistics
  * JSON export functionality
- Enable with CLI_MCP_METRICS=true
- Add 13 new tests for metrics
- Update README with metrics documentation

This is an OPTIONAL feature for advanced users.

Closes askbudi#6

* fix: Add --skip-git-repo-check flag to Codex CLI command

Resolves issue askbudi#11 - Codex CLI fails with 'Not inside a trusted directory' error

* fix: Complete Qwen implementation in availability_checker and cli_subagent

- Add check_qwen_availability() method to AvailabilityChecker
- Add qwen to check_all_availability() parallel checks
- Add qwen_subagent() function with full implementation
- Add get_qwen_cli() helper function
- Add _qwen_cli global variable
- Add QwenCLI import

Resolves issue askbudi#9

* fix: Integrate error handling modules into server.py

- Import exceptions, retry, error_handler, and metrics modules
- Add ERROR_HANDLING_AVAILABLE flag with fallback classes
- Initialize metrics collector in initialize_config()
- Add _execute_codex_with_error_handling() helper function
- Integrate error handling in codex_subagent()
- Add logging for metrics status

Partial fix for issue askbudi#8 - demonstrates integration pattern for other agents

* test: Fix test suite - all 63 tests passing

- Fix integration tests to use async list_tools()
- Comment out tests for non-existent methods (_check_cli_exists, save_availability)
- Remove duplicate and orphaned assertions
- All tests now passing with 12% code coverage

Resolves issue askbudi#10

* fix: Complete error handling integration for all agents

- Add helper functions with error handling for claude, cursor, gemini, qwen
- Integrate error handling in all subagent functions
- Use AgentNotAvailableError and AgentExecutionError exceptions
- Call handle_agent_error() for generic exceptions
- All 63 tests still passing
- Code coverage increased to 25% for server.py

Resolves issue askbudi#8

* feat: Add Kiro CLI agent support

- Create KiroCLI adapter with streaming support
- Add check_kiro_availability() to availability_checker
- Add kiro_subagent() to cli_subagent
- Add kiro tools to server.py with error handling
- Add kiro to default subagents list
- Update tests to include kiro
- All 63 tests passing

Resolves issue askbudi#12

* feat: Add GitHub Copilot CLI agent support

- Create CopilotCLI adapter
- Add check_copilot_availability() and copilot_subagent()
- Integrate with error handling
- Add to default subagents
- All 63 tests passing

Resolves issue #13

* feat: Add 5 new CLI agents (grok, kilocode, crush, opencode, antigravity)

- Create adapters for all 5 agents
- Add availability checks to availability_checker
- Add imports and globals to cli_subagent
- Partial implementation (helpers and tools pending)

Progress: 7/15 agents complete, 5 more in progress

* feat: Complete implementation of 5 CLI agents

- Add helpers, subagent functions, and availability checks for:
  * Grok CLI
  * Kilocode CLI
  * Crush CLI
  * OpenCode CLI
  * Antigravity CLI
- Integrate all agents with error handling in server.py
- Update default subagents list to include all 12 agents
- All 63 tests passing

Resolves issues #16, #17, #18, #19, #21
Total agents: 12/15 (80% complete)

* feat: Add Factory/Droid CLI agent support

- Create FactoryCLI adapter using 'droid' command
- Add to availability_checker, cli_subagent, and server
- Integrate with error handling
- All 63 tests passing

Resolves issue #14
Total agents: 13/15 (87% complete)

* feat: Add Rovo Dev CLI agent support

- Create RovoCLI adapter using 'acli rovodev' command
- Add to availability_checker, cli_subagent, and server
- Integrate with error handling
- All 63 tests passing

Resolves issue #15
Total agents: 14/15 (93% complete)

* feat: support --key=value argument format for GitHub Copilot CLI compatibility

- Modified argument parser to use parse_known_args() instead of parse_args()
- Added processing for --agents=, --working-dir=, --debug=, --verbose= formats
- Maintains backward compatibility with existing --key value format
- Fixes GitHub Copilot CLI bug that prevents reading ENV variables

* docs: add alternative configuration format for GitHub Copilot CLI

- Added args-based configuration example for GitHub Copilot
- Documented known bug with ENV variables in GitHub Copilot CLI
- Provided workaround using --agents= format instead of env variables

* ci: add CodeQL security scanning workflow

- Enables Code Scanning for Python code
- Runs on push to main and extended branches
- Runs on pull requests
- Satisfies repository rule requirements
@velvetmonkey
Copy link
Copy Markdown
Author

Superseded by velvetmonkey/roundtable fork which combines PR #4's features with this fix.

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.

1 participant