[PR #156] [MERGED] feat: add pi-coding-agent as first-class backend #169

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

📋 Pull Request Information

Original PR: https://github.com/mikeyobrien/ralph-orchestrator/pull/156
Author: @mikeyobrien
Created: 2/5/2026
Status: Merged
Merged: 2/5/2026
Merged by: @mikeyobrien

Base: mainHead: feat/pi-agent-support


📝 Commits (3)

  • ad4d03b feat: add pi-coding-agent as first-class backend
  • f66efef fix: clippy and rustfmt issues
  • be0878d fix: remaining clippy wildcard in test code

📊 Changes

22 files changed (+2815 additions, -21 deletions)

View changed files

📝 Cargo.lock (+8 -8)
📝 crates/ralph-adapters/src/auto_detect.rs (+24 -1)
📝 crates/ralph-adapters/src/cli_backend.rs (+153 -0)
📝 crates/ralph-adapters/src/lib.rs (+6 -0)
crates/ralph-adapters/src/pi_stream.rs (+805 -0)
📝 crates/ralph-adapters/src/pty_executor.rs (+73 -3)
📝 crates/ralph-adapters/tests/pty_executor_integration.rs (+98 -0)
📝 crates/ralph-cli/src/hats.rs (+2 -2)
📝 crates/ralph-cli/src/init.rs (+2 -2)
📝 crates/ralph-cli/src/sop_runner.rs (+2 -3)
📝 crates/ralph-core/src/config.rs (+2 -2)
ralph.pi.yml (+25 -0)
specs/pi-agent-support/design.md (+514 -0)
specs/pi-agent-support/plan.md (+184 -0)
specs/pi-agent-support/requirements.md (+106 -0)
specs/pi-agent-support/research/01-stream-format-comparison.md (+87 -0)
specs/pi-agent-support/research/02-stream-handler-architecture.md (+132 -0)
specs/pi-agent-support/research/03-rpc-mode-analysis.md (+80 -0)
specs/pi-agent-support/research/04-backend-patterns.md (+82 -0)
specs/pi-agent-support/research/05-pi-cli-flags.md (+102 -0)

...and 2 more files

📄 Description

Summary

Add pi-coding-agent (pi) as a first-class backend in ralph-orchestrator with NDJSON stream parsing, structured tool call display, cost tracking, and configuration support.

Changes

New: pi_stream.rs (813 lines)

  • PiStreamEvent enum with serde tagged deserialization
  • PiStreamParser::parse_line() for NDJSON parsing
  • dispatch_pi_stream_event() mapping to StreamHandler calls
  • PiSessionState for cost/turn accumulation
  • 47 unit tests covering all event types, edge cases, and error handling

Modified

  • cli_backend.rs: pi() and pi_interactive() constructors, OutputFormat::PiStreamJson
  • pty_executor.rs: Pi NDJSON parsing branch in run_observe_streaming()
  • auto_detect.rs: pi added last in DEFAULT_PRIORITY
  • config.rs, hats.rs, init.rs, sop_runner.rs: Pi in validation lists

Testing

  • 49 tests pass locally (47 unit + 2 integration)
  • Waiting on CI for full suite

🔄 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/156 **Author:** [@mikeyobrien](https://github.com/mikeyobrien) **Created:** 2/5/2026 **Status:** ✅ Merged **Merged:** 2/5/2026 **Merged by:** [@mikeyobrien](https://github.com/mikeyobrien) **Base:** `main` ← **Head:** `feat/pi-agent-support` --- ### 📝 Commits (3) - [`ad4d03b`](https://github.com/mikeyobrien/ralph-orchestrator/commit/ad4d03b24d2b265ab97cc70c4ef0c6c125e7476e) feat: add pi-coding-agent as first-class backend - [`f66efef`](https://github.com/mikeyobrien/ralph-orchestrator/commit/f66efef68bea7df45a7df208f7176acda1577ef1) fix: clippy and rustfmt issues - [`be0878d`](https://github.com/mikeyobrien/ralph-orchestrator/commit/be0878d2c59e6499f4ee77b470281c5f4e197471) fix: remaining clippy wildcard in test code ### 📊 Changes **22 files changed** (+2815 additions, -21 deletions) <details> <summary>View changed files</summary> 📝 `Cargo.lock` (+8 -8) 📝 `crates/ralph-adapters/src/auto_detect.rs` (+24 -1) 📝 `crates/ralph-adapters/src/cli_backend.rs` (+153 -0) 📝 `crates/ralph-adapters/src/lib.rs` (+6 -0) ➕ `crates/ralph-adapters/src/pi_stream.rs` (+805 -0) 📝 `crates/ralph-adapters/src/pty_executor.rs` (+73 -3) 📝 `crates/ralph-adapters/tests/pty_executor_integration.rs` (+98 -0) 📝 `crates/ralph-cli/src/hats.rs` (+2 -2) 📝 `crates/ralph-cli/src/init.rs` (+2 -2) 📝 `crates/ralph-cli/src/sop_runner.rs` (+2 -3) 📝 `crates/ralph-core/src/config.rs` (+2 -2) ➕ `ralph.pi.yml` (+25 -0) ➕ `specs/pi-agent-support/design.md` (+514 -0) ➕ `specs/pi-agent-support/plan.md` (+184 -0) ➕ `specs/pi-agent-support/requirements.md` (+106 -0) ➕ `specs/pi-agent-support/research/01-stream-format-comparison.md` (+87 -0) ➕ `specs/pi-agent-support/research/02-stream-handler-architecture.md` (+132 -0) ➕ `specs/pi-agent-support/research/03-rpc-mode-analysis.md` (+80 -0) ➕ `specs/pi-agent-support/research/04-backend-patterns.md` (+82 -0) ➕ `specs/pi-agent-support/research/05-pi-cli-flags.md` (+102 -0) _...and 2 more files_ </details> ### 📄 Description ## Summary Add pi-coding-agent (`pi`) as a first-class backend in ralph-orchestrator with NDJSON stream parsing, structured tool call display, cost tracking, and configuration support. ## Changes ### New: `pi_stream.rs` (813 lines) - `PiStreamEvent` enum with serde tagged deserialization - `PiStreamParser::parse_line()` for NDJSON parsing - `dispatch_pi_stream_event()` mapping to `StreamHandler` calls - `PiSessionState` for cost/turn accumulation - 47 unit tests covering all event types, edge cases, and error handling ### Modified - **cli_backend.rs**: `pi()` and `pi_interactive()` constructors, `OutputFormat::PiStreamJson` - **pty_executor.rs**: Pi NDJSON parsing branch in `run_observe_streaming()` - **auto_detect.rs**: `pi` added last in `DEFAULT_PRIORITY` - **config.rs, hats.rs, init.rs, sop_runner.rs**: Pi in validation lists ## Testing - 49 tests pass locally (47 unit + 2 integration) - Waiting on CI for full suite --- <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:30 +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#169
No description provided.