Skip to content

feat: add pi coding agent support#408

Open
mariusvniekerk wants to merge 5 commits intomainfrom
pi-agent
Open

feat: add pi coding agent support#408
mariusvniekerk wants to merge 5 commits intomainfrom
pi-agent

Conversation

@mariusvniekerk
Copy link
Collaborator

Summary

Adds support for the pi coding agent CLI.

Changes

  • internal/agent/pi.go — new PiAgent implementing the Agent interface. Runs pi -p with the prompt written to a temp file, supports --provider, --model, and --thinking flags.
  • internal/config/config.go — adds pi_cmd config field to override the pi binary path.
  • internal/agent/acp.goGetAvailableWithConfig now applies pi_cmd override (alongside existing codex_cmd etc.).
  • internal/storage/models.go, jobs.go, db.go — adds provider field to ReviewJob and review_jobs table (with migration) so the daemon can pass it to the worker asynchronously.
  • internal/daemon/server.goEnqueueRequest accepts provider and passes it through to all enqueue paths.
  • internal/daemon/worker.go — applies job.Provider via WithProvider when the resolved agent is a *PiAgent.
  • cmd/roborev/review.go — adds --provider CLI flag and forwards it in the daemon enqueue request.

Usage

roborev review HEAD --agent pi --provider anthropic --model claude-sonnet-4-5

Or in ~/.roborev/config.toml:

agent = "pi"
provider = "anthropic"
model = "claude-sonnet-4-5"

- Add provider field to ReviewJob, EnqueueOpts, and EnqueueRequest
- Store provider in review_jobs table with migration
- Pass provider from CLI --provider flag through daemon enqueue
- Apply provider in worker when agent is PiAgent via WithProvider
@mariusvniekerk
Copy link
Collaborator Author

This pull request was created with the assistance of pi.

@roborev-ci
Copy link

roborev-ci bot commented Mar 2, 2026

roborev: Combined Review (5247d4c)

Verdict: Changes require modifications to address a high-severity race condition and a
medium-severity argument formatting issue.

Summary: Adds support for the "pi" AI agent, including CLI configuration, provider selection, agent execution logic, and database schema migrations.

High Severity

  • Location: internal/agent/acp.go (Lines 1530-1
    549 inside GetAvailableWithConfig)
    • Problem: Modifying agent.Command directly mutates the global registered agent instance. In a long-running daemon with repository-specific configs, this will cause race conditions and leak command overrides across different repositories and concurrent review jobs.

Fix: Return a cloned agent instance (e.g., copy := *agent; copy.Command = cfg.PiCmd; a = &copy) or use a WithCommand() method instead of mutating the shared instance.

Medium Severity

  • Location: internal/agent/pi. go (Around line 150)
    • Problem: The argument " @"+tmpFile.Name() contains a leading space. Because exec.CommandContext passes arguments exactly as provided without shell tokenization, the pi CLI will receive the leading space as part of the argument,
      which may prevent it from correctly recognizing the @file input syntax.
    • Fix: Remove the leading space: append(args, "@"+tmpFile.Name(), ...)

Synthesized from 3 reviews (agents: codex, gemini | types: default, security)

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