O1: Rust crate, profiles, persistent run state #9

Merged
hermes merged 1 commits from o1-rust-core into main 2026-11-12 23:19:06 +00:00
Collaborator

Closes #2

Rust crate orch (binary), replaces the O0 spike (spike stays for reference until O3).

  • Profiles: ~/.config/orch/profiles/NAME.toml (override dir with ORCH_CONFIG_DIR): hx command, home (own HOME so each profile has its own hx auth), provider, sandbox, yolo, gate, budget (wall_secs, max_turns, max_tokens). Unknown keys are rejected; yolo = true requires sandbox = true.
  • Run state: one JSON file per run in ~/.local/state/orch/runs/ (ORCH_STATE_DIR), written atomically. States: queued, running, gating, done, failed (with reason: hx-failed, gate-failed, timeout, budget:turns, budget:tokens, interrupted, setup).
  • Crash safety: status detects a dead orchestrator pid, marks the run failed/interrupted and kills hx's process group, so no orphan keeps spending tokens.
  • hx runs in its own process group; timeout and budget kill the whole group, including bash children.
  • CLI: orch run TASK --repo DIR --profile NAME, orch status [ID], orch logs ID.

Verification: sh tests/all.sh (fmt, clippy -D warnings, 5 unit tests, e2e with a fake hx, spike check): exit 0. E2E covers done, gate-failed, hx error, no-JSON crash, timeout, turn budget, token budget, yolo-without-sandbox refused, and kill -9 of orch mid-run (status interrupted, hx dead).

Not in this PR (by design): retry (O2), sources/sinks (O3), locks and pool (O4), allowlist and audit (O5). Known ceiling: pid reuse can make a dead orch look alive (comment in state.rs, fix with O4 locking). Not run against real hx (no login on this box).

Closes #2 Rust crate `orch` (binary), replaces the O0 spike (spike stays for reference until O3). - Profiles: `~/.config/orch/profiles/NAME.toml` (override dir with ORCH_CONFIG_DIR): hx command, `home` (own HOME so each profile has its own hx auth), provider, sandbox, yolo, gate, budget (wall_secs, max_turns, max_tokens). Unknown keys are rejected; `yolo = true` requires `sandbox = true`. - Run state: one JSON file per run in `~/.local/state/orch/runs/` (ORCH_STATE_DIR), written atomically. States: queued, running, gating, done, failed (with reason: hx-failed, gate-failed, timeout, budget:turns, budget:tokens, interrupted, setup). - Crash safety: `status` detects a dead orchestrator pid, marks the run failed/interrupted and kills hx's process group, so no orphan keeps spending tokens. - hx runs in its own process group; timeout and budget kill the whole group, including bash children. - CLI: `orch run TASK --repo DIR --profile NAME`, `orch status [ID]`, `orch logs ID`. Verification: `sh tests/all.sh` (fmt, clippy -D warnings, 5 unit tests, e2e with a fake hx, spike check): exit 0. E2E covers done, gate-failed, hx error, no-JSON crash, timeout, turn budget, token budget, yolo-without-sandbox refused, and kill -9 of orch mid-run (status interrupted, hx dead). Not in this PR (by design): retry (O2), sources/sinks (O3), locks and pool (O4), allowlist and audit (O5). Known ceiling: pid reuse can make a dead orch look alive (comment in state.rs, fix with O4 locking). Not run against real hx (no login on this box).
hermes added 1 commit 2026-11-12 23:19:02 +00:00
hermes merged commit fb434c670c into main 2026-11-12 23:19:06 +00:00
hermes deleted branch o1-rust-core 2026-11-12 23:19:06 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: johannes/orch#9