Skip to content

feat: add Codex adapter, judge personas, and Claude routing updates#149

Merged
jacsamell merged 1 commit into
mainfrom
feat/codex-personas-claude-routing
Apr 30, 2026
Merged

feat: add Codex adapter, judge personas, and Claude routing updates#149
jacsamell merged 1 commit into
mainfrom
feat/codex-personas-claude-routing

Conversation

@jacsamell
Copy link
Copy Markdown
Contributor

@jacsamell jacsamell commented Apr 30, 2026

Summary

  • Add first-class Codex CLI adapter/parser and config mappings.
  • Route Opus through Claude Code CLI with opus --effort max, including stale-session protection when judge CLI backends change.
  • Add built-in judge personas and switch the third default judge to a GPT security/pentest persona.
  • Improve Claude parser handling for thinking/rate-limit telemetry and single-agent thinking box titles.
  • Clean up PR body wording for single-writer mode and add push-race recovery for cube auto --fix.

Test plan

  • python -m pytest tests/ -q (177 passed, 1 skipped)

Summary

This PR introduces comprehensive updates to the agent orchestration system, centred on adding Codex integration, improving Claude model routing, and enhancing session management.

Key Changes

Codex CLI Integration

  • Adds a first-class CodexAdapter and CodexParser for sandboxed code execution via the Codex CLI
  • Codex is configured as a standard CLI tool alongside Claude and Cursor, with full resume/session support

Claude Routing & Model Configuration

  • Routes Opus through Claude CLI with --effort max flag for intensive reasoning tasks
  • Adds Codex model mappings (codex-gpt-5.5, gpt-5.5-codex) to the CLI routing configuration

Judge Panel Enhancements

  • Introduces a built-in judge persona registry with "security-pentest" persona for security-focused code review
  • Changes the default third judge from Qwen to GPT with security-pentest persona
  • Implements stale-session protection: judge sessions only resume when both the model and CLI backend remain unchanged, preventing cross-backend reuse

Parser Improvements

  • Claude parser now suppresses rate-limit events and properly handles top-level thinking blocks (emitting only non-empty thinking messages)
  • Codex parser maps structured JSON events to system messages, tool calls, and reasoning blocks

UI & Workflow Updates

  • Agent layout titles now include task IDs (e.g., "Agent ▶ task_id") for better context visibility
  • PR body text now shows "Writer: ()" in single-writer mode instead of "Winner:", clarifying authorship
  • Single-writer mode propagates consistently across PR creation paths

Push Recovery

  • Adds detection and recovery for non-fast-forward git push failures: automatically fetches and rebases when remote changes are detected, then retries the push

Test Coverage

  • 177 tests pass; 1 skipped
  • New test suites cover Codex adapter/parser, judge session matching, PR labelling in single/dual modes, and push recovery logic

@jacsamell jacsamell merged commit a1cdccb into main Apr 30, 2026
1 check passed
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 30, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 91fed829-00bb-4151-81d3-a3b32701af49

📥 Commits

Reviewing files that changed from the base of the PR and between ba02cfc and b7a79ee.

📒 Files selected for processing (27)
  • python/cube.yaml
  • python/cube/automation/judge_panel.py
  • python/cube/automation/single_writer.py
  • python/cube/cli.py
  • python/cube/commands/orchestrate/handlers.py
  • python/cube/commands/orchestrate/phases.py
  • python/cube/commands/orchestrate/pr.py
  • python/cube/commands/orchestrate/prompts.py
  • python/cube/commands/pr_fix.py
  • python/cube/core/adapters/__init__.py
  • python/cube/core/adapters/claude.py
  • python/cube/core/adapters/codex.py
  • python/cube/core/adapters/registry.py
  • python/cube/core/judge_personas.py
  • python/cube/core/parsers/__init__.py
  • python/cube/core/parsers/claude.py
  • python/cube/core/parsers/codex.py
  • python/cube/core/parsers/registry.py
  • python/cube/core/single_layout.py
  • python/cube/core/user_config.py
  • python/cube/models/types.py
  • tests/cli/test_adapters.py
  • tests/cli/test_pr_fix.py
  • tests/core/test_judge_panel_retry.py
  • tests/core/test_orchestrate_pr.py
  • tests/core/test_single_layout.py
  • tests/core/test_user_config.py

Walkthrough

This pull request introduces multiple interconnected enhancements across the codebase: a new Codex CLI adapter and parser with full JSON event streaming support; judge persona registry and strict session resumption matching by model and CLI backend; threading of task_name parameters through layout and prompter initialization; single-writer vs dual-mode detection and formatting in PR creation; non-fast-forward Git push recovery with automatic rebase; and updated Claude adapter effort parameter support.

Changes

Cohort / File(s) Summary
Configuration & Judge Persona Registry
python/cube.yaml, python/cube/core/judge_personas.py, python/cube/core/user_config.py, python/cube/models/types.py
Updated judge_3 model from qwen to gpt, changed label to Judge Security, and added persona field. Introduced built-in judge personas registry with security-pentest definition and resolve_judge_persona function to map persona references in config.
CLI Routing & Adapter Registry
python/cube/core/adapters/__init__.py, python/cube/core/adapters/registry.py, python/cube/core/parsers/__init__.py, python/cube/core/parsers/registry.py
Registered new CodexAdapter and CodexParser in adapter/parser registries. Updated cube.yaml model-to-CLI mappings: claude-opus-4-7-thinking-max routed to claude, new entries for codex-gpt-5.5 and gpt-5.5-codex routed to codex.
Codex Adapter Implementation
python/cube/core/adapters/codex.py
New adapter for OpenAI Codex CLI with binary availability checks, augmented PATH setup, codex exec --json command construction, asynchronous subprocess streaming with error capture, resume session support, and installation instructions.
Codex Parser Implementation
python/cube/core/parsers/codex.py
New parser for Codex JSON event lines handling thread lifecycle, turn events, result completion with duration, and item-level events (agent messages, reasoning, tool calls, web search) with appropriate StreamMessage mapping.
Claude Adapter & Parser Enhancements
python/cube/core/adapters/claude.py, python/cube/core/parsers/claude.py
Claude adapter now supports effort parameter via expanded alias tuples; parser improved to emit top-level thinking messages and suppress rate-limit events with conditional empty thinking block filtering.
Judge Session & Persona Management
python/cube/automation/judge_panel.py
Judge sessions now resume only when saved metadata matches both model and CLI backend. Judge prompt generation injects optional persona text before shared review rules. Session logging and JudgeInfo construction updated to include cli_name and persona.
Task Name Threading
python/cube/core/single_layout.py, python/cube/automation/single_writer.py, python/cube/commands/orchestrate/phases.py, python/cube/commands/orchestrate/prompts.py
SingleAgentLayout now accepts optional task_name parameter, formatting agent title as "{title} ▶ {task_name}". Updated all call sites to pass task identifiers for layout initialization context.
PR Creation Mode Detection & Formatting
python/cube/commands/orchestrate/pr.py, python/cube/cli.py, python/cube/commands/orchestrate/handlers.py
create_pr now accepts single_mode flag (default False). PR body formatting conditionally displays Writer: <label> (<key>) in single mode or Winner: <label> in dual mode. CLI command and handlers propagate mode throughout workflow.
PR Fix Push Recovery
python/cube/commands/pr_fix.py
Enhanced error handling for non-fast-forward Git pushes: detects rejection via stderr scanning, attempts recovery by fetching remote branch and rebasing local commits, retries push on successful rebase with early return and HEAD refresh.
Comprehensive Test Coverage
tests/cli/test_adapters.py, tests/cli/test_pr_fix.py, tests/core/test_judge_panel_retry.py, tests/core/test_orchestrate_pr.py, tests/core/test_single_layout.py, tests/core/test_user_config.py
New and extended tests for Codex adapter/parser behaviour, Claude effort and thinking handling, non-fast-forward recovery helpers, judge session matching and persona injection, PR single/dual mode formatting, layout task_name rendering, and persona config preservation.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~70 minutes

Possibly related PRs

Poem

🐰✨ A rabbit hops through adapters new,
Codex joins the CLI crew!
Judges wear personas, sessions resume right,
Writers and winners, both formatted bright.
Git rebases dance, task names align—
The workflow's complete, tutto bene! 🎯


Review rate limit: 4/5 reviews remaining, refill in 12 minutes.

Comment @coderabbitai help to get the list of available commands and usage tips.

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