Implement Ava orchestrator: spawn and monitor pi subprocesses

t-280.3·WorkTask·
·
·
·Omni/Ava.hs
Parent:t-280·Created1 month ago·Updated1 month ago

Dependencies

Description

Edit

Implement the core orchestration logic in Ava to spawn and monitor pi-orchestrate.sh.

Simplified Approach

Use the bash scripts directly instead of waiting for Haskell conversion:

  • Spawn pi-orchestrate.sh as subprocess
  • Parse stdout for progress updates
  • Report to Telegram

Implementation

Core Types

data WorkerState
  = Idle
  | Working TaskId ProcessHandle ThreadId  -- task, process, output reader
  | Failed TaskId Text

data OrchestratorEvent
  = StartTask TaskId
  | WorkerOutput Text      -- line from stdout
  | WorkerFinished ExitCode
  | UserMessage Text

Subprocess Management

1. Spawn pi-orchestrate.sh with task ID 2. Fork thread to read stdout line by line 3. Parse key lines (phase changes, completion) 4. Send Telegram updates at key points 5. Handle completion/failure

Integration Points

  • Omni.Agent.Telegram: send messages, receive commands
  • Omni.Task.Core: task lookup for validation
  • System.Process: subprocess spawning

Error Handling

  • Subprocess crash: notify user, mark needs-help
  • Timeout: kill subprocess, notify user
  • Task not found: error message
  • Already working: queue or reject

Files

  • Omni/Agent/Telegram/Orchestrator.hs (new)
  • Omni/Agent/Telegram.hs (wire up commands)

Timeline (1)

🔄[human]Open → Done1 month ago