Epic: Unify agent runner — stdin-driven persistent mode in Omni/Agent

t-759·WorkTask·
·
·
Created1 week ago·Updated1 week ago·pipeline runs →

Description

Edit

Context

Agentd currently uses two different agent runners:

  • Omni/Agent for one-shot runs (shebang interpreter, emits Trace.Event JSONL, supports agentd replay/debug)
  • pi --mode rpc for persistent runs (stdin RPC loop, no Trace.Event emission, no replay/debug support)

This split means persistent agents can't use agentd's replay/debug tooling, and we maintain two runners. The goal is to make Omni/Agent the sole runner for both modes, bringing its Trace.Event integration to persistent workflows, while keeping it Unix-pure (no --mode flags, no RPC JSON schema).

Design: Unix-native stdin-driven mode

Instead of pi's JSON command schema, agent becomes a well-behaved Unix program:

  • agent script.md → current behavior, shebang-compatible, exits when loop finishes
  • agent with no script → reads prompts from stdin delimited by null bytes (\0); each prompt runs the loop, then blocks reading the next prompt; EOF → clean exit
  • SIGINT → cancel current iteration (unwinds via SteeringCancel in Op loop)
  • SIGTERM → finish current iteration and exit
  • No set_model / shutdown commands — use the signal vocabulary Unix already provides
  • Steering file goes away (replaced by writing to stdin)

Null-byte delimiter is chosen because it's binary-safe, unambiguous, trivially implemented, and matches xargs -0 / find -print0 conventions.

Why this is good

  • Shebang case is completely unchanged
  • One binary, one loop, two prompt sources (argv script or stdin)
  • Agentd becomes trivial: spawn agent, hold stdin pipe, write null-terminated prompts, read Trace.Event JSONL from stdout
  • Cancel is just SIGINT — same as every Unix REPL
  • Replay/debug work for persistent agents because they emit the same Trace.Event stream

Subtasks

1. Add stdin prompt-reading mode to Omni/Agent (null-byte delimited) 2. Signal handling: SIGINT → cancel current iteration, SIGTERM → graceful exit 3. Swap Daemon.hs persistent-agent spawner from pi to agent 4. Remove pi-specific code paths and the steering file mechanism once cutover is verified

Child Tasks

  • t-759.2 - Signal handling in Omni/Agent: SIGINT cancel, SIGTERM graceful exit [Done]
  • t-759.1 - Add null-byte delimited stdin prompt mode to Omni/Agent [Verified]
  • t-759.3 - Swap Agentd persistent-agent spawner from pi to Omni/Agent [Approved]
  • t-759.4 - Remove pi persistent-agent code paths and steering file mechanism [Review]

Git Commits

3343fc66agentd: remove steering-file mechanism and pi rpc remnants
Coder Agent10 days ago7 files
c21cf2a1agentd: run persistent agents via agent stdin mode
Coder Agent11 days ago1 files
b3a7429dagent: handle SIGINT cancel and SIGTERM graceful stop
Coder Agent12 days ago1 files
db61b554agent: add null-delimited stdin mode and persistent session
Coder Agent12 days ago2 files

Timeline (0)

No activity yet.