[PR #22] [MERGED] feat: codex-acp support, agent priority, and ralph.yml auto-load #94

Closed
opened 2026-02-27 10:22:12 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/mikeyobrien/ralph-orchestrator/pull/22
Author: @jnyross
Created: 1/4/2026
Status: Merged
Merged: 1/5/2026
Merged by: @mikeyobrien

Base: mainHead: codex-acp-defaults


📝 Commits (1)

  • 42ce601 codex-acp: agent priority, auto-load ralph.yml, bigger ACP stream limit

📊 Changes

9 files changed (+523 additions, -59 deletions)

View changed files

ralph.codex-acp.yml (+33 -0)
📝 ralph.yml (+22 -1)
📝 src/ralph_orchestrator/__main__.py (+90 -5)
📝 src/ralph_orchestrator/adapters/acp_client.py (+24 -0)
📝 src/ralph_orchestrator/main.py (+4 -1)
📝 src/ralph_orchestrator/orchestrator.py (+165 -48)
📝 tests/test_acp_cli.py (+4 -4)
tests/test_agent_priority.py (+100 -0)
tests/test_codex_cli.py (+81 -0)

📄 Description

Why

I’m using Ralph locally on Apple Silicon and wanted Codex CLI to be a first-class agent option via the Agent Client Protocol (ACP). In practice that also surfaced two recurring usability issues:

  1. Running ralph run ... without -c ralph.yml silently ignores project settings (timeouts/iterations), leading to unexpected 5-minute ACP timeouts and fallbacks.
  2. codex-acp (and some ACP agents) can emit large single-line JSON-RPC frames; asyncio’s default per-line read limit (~64KiB) can crash the ACP read loop.

This PR makes Codex-over-ACP easier to use, configurable, and more robust.

What changed

  • Add Codex convenience flags:
    • ralph run --codex (equivalent to --agent acp --acp-agent codex-acp)
    • --codex-permission-mode {auto_approve,deny_all,allowlist,interactive}
    • --codex-model <model> (passed to codex-acp as -c model=...)
    • --codex-reasoning-effort {low,medium,high,xhigh} (passed as -c model_reasoning_effort=...)
  • Add agent_priority config field so agent: auto can prefer Codex/ACP first (and control fallback ordering).
  • Auto-load ./ralph.yml when present (so project defaults apply even if -c ralph.yml is omitted).
  • Increase ACP subprocess stream read limit (default 8MiB) to prevent LimitOverrunError: Separator is found, but chunk is longer than limit.
    • Optional override via RALPH_ACP_STREAM_LIMIT.
  • Add sample config preset ralph.codex-acp.yml.
  • Add/adjust tests covering Codex shortcut flags and agent priority ordering.

Files / highlights

  • src/ralph_orchestrator/__main__.py
    • Adds --codex* flags and the shortcut mapping.
    • Auto-loads ralph.yml when present.
  • src/ralph_orchestrator/orchestrator.py
    • Implements agent_priority ordering and auto selection.
    • Initializes adapters in priority order for deterministic fallback behavior.
  • src/ralph_orchestrator/adapters/acp_client.py
    • Raises asyncio stream read limit for ACP agent subprocesses.
  • ralph.codex-acp.yml
    • Example to run Codex via ACP with reasoning effort + permissions.

How to use

  • Use Codex directly:
    • ralph run --codex --codex-model gpt-5.2 --codex-reasoning-effort xhigh
  • Prefer Codex first in auto mode (project config):
    • agent: auto
    • agent_priority: [acp, claude, gemini]

Tests

  • New: tests/test_codex_cli.py, tests/test_agent_priority.py
  • Updated: tests/test_acp_cli.py

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/mikeyobrien/ralph-orchestrator/pull/22 **Author:** [@jnyross](https://github.com/jnyross) **Created:** 1/4/2026 **Status:** ✅ Merged **Merged:** 1/5/2026 **Merged by:** [@mikeyobrien](https://github.com/mikeyobrien) **Base:** `main` ← **Head:** `codex-acp-defaults` --- ### 📝 Commits (1) - [`42ce601`](https://github.com/mikeyobrien/ralph-orchestrator/commit/42ce601e6403d3f754bdad93bc2f7f46157cd4ae) codex-acp: agent priority, auto-load ralph.yml, bigger ACP stream limit ### 📊 Changes **9 files changed** (+523 additions, -59 deletions) <details> <summary>View changed files</summary> ➕ `ralph.codex-acp.yml` (+33 -0) 📝 `ralph.yml` (+22 -1) 📝 `src/ralph_orchestrator/__main__.py` (+90 -5) 📝 `src/ralph_orchestrator/adapters/acp_client.py` (+24 -0) 📝 `src/ralph_orchestrator/main.py` (+4 -1) 📝 `src/ralph_orchestrator/orchestrator.py` (+165 -48) 📝 `tests/test_acp_cli.py` (+4 -4) ➕ `tests/test_agent_priority.py` (+100 -0) ➕ `tests/test_codex_cli.py` (+81 -0) </details> ### 📄 Description ## Why I’m using Ralph locally on Apple Silicon and wanted Codex CLI to be a first-class agent option via the Agent Client Protocol (ACP). In practice that also surfaced two recurring usability issues: 1) Running `ralph run ...` without `-c ralph.yml` silently ignores project settings (timeouts/iterations), leading to unexpected 5-minute ACP timeouts and fallbacks. 2) `codex-acp` (and some ACP agents) can emit large single-line JSON-RPC frames; asyncio’s default per-line read limit (~64KiB) can crash the ACP read loop. This PR makes Codex-over-ACP easier to use, configurable, and more robust. ## What changed - Add Codex convenience flags: - `ralph run --codex` (equivalent to `--agent acp --acp-agent codex-acp`) - `--codex-permission-mode {auto_approve,deny_all,allowlist,interactive}` - `--codex-model <model>` (passed to `codex-acp` as `-c model=...`) - `--codex-reasoning-effort {low,medium,high,xhigh}` (passed as `-c model_reasoning_effort=...`) - Add `agent_priority` config field so `agent: auto` can prefer Codex/ACP first (and control fallback ordering). - Auto-load `./ralph.yml` when present (so project defaults apply even if `-c ralph.yml` is omitted). - Increase ACP subprocess stream read limit (default 8MiB) to prevent `LimitOverrunError: Separator is found, but chunk is longer than limit`. - Optional override via `RALPH_ACP_STREAM_LIMIT`. - Add sample config preset `ralph.codex-acp.yml`. - Add/adjust tests covering Codex shortcut flags and agent priority ordering. ## Files / highlights - `src/ralph_orchestrator/__main__.py` - Adds `--codex*` flags and the shortcut mapping. - Auto-loads `ralph.yml` when present. - `src/ralph_orchestrator/orchestrator.py` - Implements `agent_priority` ordering and auto selection. - Initializes adapters in priority order for deterministic fallback behavior. - `src/ralph_orchestrator/adapters/acp_client.py` - Raises asyncio stream read limit for ACP agent subprocesses. - `ralph.codex-acp.yml` - Example to run Codex via ACP with reasoning effort + permissions. ## How to use - Use Codex directly: - `ralph run --codex --codex-model gpt-5.2 --codex-reasoning-effort xhigh` - Prefer Codex first in auto mode (project config): - `agent: auto` - `agent_priority: [acp, claude, gemini]` ## Tests - New: `tests/test_codex_cli.py`, `tests/test_agent_priority.py` - Updated: `tests/test_acp_cli.py` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 10:22:12 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ralph-orchestrator#94
No description provided.