Add loop detector, budgets, and live session control
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>
This commit is contained in:
1 parent
7bf0986640
commit
bf609c2e0e
16 files changed
+1694
-55
No files matched your search
@@ -52,6 +52,20 @@ Machines are TOML files in `.hx/machines/` or `~/.hx/machines/` (examples in `ex
|
||||
with `report = "junit"` writes its JUnit XML to `$ORCH_REPORT` (also available as `{{report}}` in `cmd`); orch parses
|
||||
it into counts and failing tests. See ORCHESTRATOR.md for the whole design.
|
||||
|
||||
A running session can be steered from the session screen, also when `orch session` runs in another terminal: `i`
|
||||
interrupt (the agent stops, you reply with a hint), `m` message to the agent, `s` force a state, `k` kill (type
|
||||
`yes`; goes to `on_abort`), and `r` re-plan from the start state while the loop detector box shows (the last test
|
||||
runs failed on the same tests). On the goal screen `j/k` selects a decision and `v` vetoes it: the agent is told and
|
||||
the session goes back to `code`. The commands go through the database (`commands` table) and the runner picks them
|
||||
up within a fraction of a second, even in the middle of a shell command. A machine can set limits:
|
||||
|
||||
[budget]
|
||||
wall_secs = 5400 # time spent working, waiting for you does not count
|
||||
cost = 5.0 # US dollars
|
||||
compact_at = 85 # percent of the context window; hx gets `hx/compact`
|
||||
|
||||
Passing wall time or cost sends the session to `on_budget` (or fails it when the machine has none).
|
||||
|
||||
The goal lives in the same database: `orch goal "sentence"`, `orch check NAME CMD [--owner sN]` (an acceptance
|
||||
check: pass = exit 0), `orch checks [--owner sN | --main]`. `g` in the TUI opens the goal view (task graph, critical
|
||||
path, decisions, checks; `e` edit goal, `+` add check, `R` run all checks on main). `orch session --after s1,s2` makes
|
||||
|
||||
Reference in new issue
Block a user