Milestone 8: the loop detector alerts when test failures repeat, budget caps limit context/cost/wall-time per session with compaction support, and live control lets you interrupt, message, or kill a running session from the TUI. Decisions can now be vetoed, which sends hx/message and rewinds the session to code. All 82 tests pass. - src/budget.rs: pure functions for active time, budgets and loop detect - src/runner.rs: Ctl control object polls for commands ~100ms, handles interrupt/message/abort/stop at every blocking point, re-runs on hints, and compacts when context is high - src/db.rs: commands table for TUI→runner control - src/detail.rs, src/goal.rs, src/tui/: loop detector box, budget caps, session keys (i/m/s/k/r), goal keys (v for veto), state forcing - tests/fake_acp_hx.py: slow mode and hx/message, hx/compact log - examples/machines/task.toml: [budget] with wall_secs, cost, compact_at Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
77 lines
2.1 KiB
TOML
77 lines
2.1 KiB
TOML
name = "task"
|
|
on_abort = "aborted"
|
|
on_budget = "escalated"
|
|
|
|
[budget]
|
|
wall_secs = 5400 # 90 min of work, not counting time spent waiting for you
|
|
cost = 5.0 # US dollars
|
|
compact_at = 85 # percent of the context window
|
|
|
|
[[state]]
|
|
name = "plan"
|
|
kind = "start"
|
|
steps = [
|
|
{ name = "read-goal", run = "computer", cmd = "orch goal --export" },
|
|
{ name = "draft-plan", run = "agent", sets = "planning", prompt = "plan" },
|
|
]
|
|
catch = { PlanInvalid = "plan" }
|
|
next = "code"
|
|
|
|
[[state]]
|
|
name = "code"
|
|
steps = [ { name = "edit", run = "agent", sets = "coding", prompt = "implement" } ]
|
|
# ORCHESTRATOR.md maps ToolDenied to a "waiting" state that the file never defines; review is the human gate.
|
|
catch = { ToolDenied = "review" }
|
|
next = "build"
|
|
|
|
[[state]]
|
|
name = "build"
|
|
steps = [ { name = "cargo build", run = "computer", sets = "building", cmd = "cargo build" } ]
|
|
catch = { BuildFailed = "code" }
|
|
next = "test"
|
|
|
|
[[state]]
|
|
name = "test"
|
|
steps = [ { name = "cargo test", run = "computer", sets = "testing", cmd = "cargo test {{scope}}", report = "junit" } ]
|
|
catch = { TestsFailed = "code" }
|
|
retry = { TestsFailed = { max = 3, then = "escalated" } }
|
|
next = "review"
|
|
|
|
[[state]]
|
|
name = "review"
|
|
kind = "gate"
|
|
steps = [
|
|
{ name = "open-diff", run = "computer" },
|
|
{ name = "wait-approval", run = "human", sets = "waiting" },
|
|
]
|
|
catch = { ChangesRequested = "code" }
|
|
next = "merge"
|
|
|
|
[[state]]
|
|
name = "merge"
|
|
kind = "exit"
|
|
steps = [
|
|
{ name = "rebase-main", run = "computer", cmd = "git rebase main" },
|
|
{ name = "run-acceptance", run = "computer", cmd = "orch checks --owner {{session}}" },
|
|
{ name = "mark-merged", run = "computer", sets = "merged", cmd = "git -C {{repo}} merge --ff-only {{branch}}" },
|
|
]
|
|
catch = { RebaseConflict = "code" }
|
|
end = "merged"
|
|
|
|
[[state]]
|
|
name = "escalated"
|
|
kind = "exit"
|
|
only_on = ["TestsFailed x3", "budget"]
|
|
steps = [
|
|
{ name = "snapshot-worktree", run = "computer" },
|
|
{ name = "notify", run = "computer", sets = "needs you" },
|
|
]
|
|
end = "escalated"
|
|
|
|
[[state]]
|
|
name = "aborted"
|
|
kind = "abort"
|
|
only_on = ["abort"]
|
|
steps = [ { name = "remove-worktree", run = "computer", sets = "aborted" } ]
|
|
end = "aborted"
|