Your second bench run (readonly in place): 3 of 12 done. The 9 needs-human all came from Python test/inspect commands, and each denied bash call ended the whole run, so every gap in the allowlist killed the run instead of letting Claude pick another way. Also tok/run was 9711 while tok/done was 38845 (runs stopped by the guard reported 0 tokens).
1. readonly allowlist entry (unchanged from the first commit of this PR): bash commands that only look, flags that run or write refused.
Soft deny (not in the allowlist): the guard answers the call with orch-guard-soft: <reason>. Use another way ..., the tool does not run, the run goes on, the gate decides in the end.
Hard deny always stops the run, also under continue: credential-looking paths, paths outside the worktree, git push, writes to .git/.hx. (Decision::Hard vs Decision::Deny in policy.rs.)
Every deny is audited (decision: deny, new hard: true|false) and counted: denies in the run state, in telemetry and as a denies column in orch report.
3. Tokens of stopped runs. Per attempt orch sums the stream/done usage events and uses that as a lower bound when the final done line never comes (guard, budget or timeout kill). needs-human runs no longer show 0 tokens; tok/run becomes comparable. (A killed run's last request may still be missing, so it is a lower bound, never an overcount.)
Also: a guard-blocked claude tool shows up in hx' stream only as a tool_result (the bus tool_call is internal), so the soft/hard deny is counted from that result; the count check from #19 keeps working.
Verification: sh tests/all.sh exit 0 (24 unit tests, e2e, real-hx e2e), flake loop 5/5 under load.
Unit: hard vs soft table (credentials, outside worktree, push, metadata hard; not-in-allowlist soft). Mutation: a decide that always allows turns 5 tests red.
e2e (real orch guard process): under continue the agent tries python3 -c, gets the reason, then runs ls and writes; denied call never ran, denies = 1, audit deny, allow, allow. Hard denies (auth.json, git push, .hx/config.toml, ls /etc) still end needs-human. Default stop ends at the first soft deny. Mutation 1 (soft deny always stops) and mutation 2 (no token fallback) each turn the e2e red.
Real hx binary + fake claude: on_deny = continue with a denied ls ends done with denies = 1; the same profile with readonly has denies = 0; default stop ends needs-human.
Not verified with real claude: how it reacts to a denied call (it reads the reason and may retry the same command or give up with a text answer; the retry then counts as another deny). A run that loops on denies is limited only by max_turns / max_tokens / wall_secs, so set one of them when you use continue.
Your second bench run (`readonly` in place): 3 of 12 done. The 9 `needs-human` all came from Python test/inspect commands, and each denied bash call ended the whole run, so every gap in the allowlist killed the run instead of letting Claude pick another way. Also `tok/run` was 9711 while `tok/done` was 38845 (runs stopped by the guard reported 0 tokens).
**1. `readonly` allowlist entry** (unchanged from the first commit of this PR): bash commands that only look, flags that run or write refused.
**2. `on_deny = "continue"`** (profile key, default `"stop"` = old behaviour)
- Soft deny (not in the allowlist): the guard answers the call with `orch-guard-soft: <reason>. Use another way ...`, the tool does not run, the run goes on, the gate decides in the end.
- Hard deny always stops the run, also under `continue`: credential-looking paths, paths outside the worktree, `git push`, writes to `.git`/`.hx`. (`Decision::Hard` vs `Decision::Deny` in policy.rs.)
- Every deny is audited (`decision: deny`, new `hard: true|false`) and counted: `denies` in the run state, in telemetry and as a `denies` column in `orch report`.
**3. Tokens of stopped runs.** Per attempt orch sums the `stream/done` usage events and uses that as a lower bound when the final `done` line never comes (guard, budget or timeout kill). `needs-human` runs no longer show 0 tokens; `tok/run` becomes comparable. (A killed run's last request may still be missing, so it is a lower bound, never an overcount.)
Also: a guard-blocked claude tool shows up in hx' stream only as a `tool_result` (the bus `tool_call` is internal), so the soft/hard deny is counted from that result; the count check from #19 keeps working.
Verification: `sh tests/all.sh` exit 0 (24 unit tests, e2e, real-hx e2e), flake loop 5/5 under load.
- Unit: hard vs soft table (credentials, outside worktree, push, metadata hard; not-in-allowlist soft). Mutation: a `decide` that always allows turns 5 tests red.
- e2e (real `orch guard` process): under `continue` the agent tries `python3 -c`, gets the reason, then runs `ls` and writes; denied call never ran, `denies = 1`, audit `deny, allow, allow`. Hard denies (`auth.json`, `git push`, `.hx/config.toml`, `ls /etc`) still end `needs-human`. Default `stop` ends at the first soft deny. Mutation 1 (soft deny always stops) and mutation 2 (no token fallback) each turn the e2e red.
- Real hx binary + fake claude: `on_deny = continue` with a denied `ls` ends `done` with `denies = 1`; the same profile with `readonly` has `denies = 0`; default `stop` ends `needs-human`.
Not verified with real claude: how it reacts to a denied call (it reads the reason and may retry the same command or give up with a text answer; the retry then counts as another deny). A run that loops on denies is limited only by `max_turns` / `max_tokens` / `wall_secs`, so set one of them when you use `continue`.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Your second bench run (
readonlyin place): 3 of 12 done. The 9needs-humanall came from Python test/inspect commands, and each denied bash call ended the whole run, so every gap in the allowlist killed the run instead of letting Claude pick another way. Alsotok/runwas 9711 whiletok/donewas 38845 (runs stopped by the guard reported 0 tokens).1.
readonlyallowlist entry (unchanged from the first commit of this PR): bash commands that only look, flags that run or write refused.2.
on_deny = "continue"(profile key, default"stop"= old behaviour)orch-guard-soft: <reason>. Use another way ..., the tool does not run, the run goes on, the gate decides in the end.continue: credential-looking paths, paths outside the worktree,git push, writes to.git/.hx. (Decision::HardvsDecision::Denyin policy.rs.)decision: deny, newhard: true|false) and counted:deniesin the run state, in telemetry and as adeniescolumn inorch report.3. Tokens of stopped runs. Per attempt orch sums the
stream/doneusage events and uses that as a lower bound when the finaldoneline never comes (guard, budget or timeout kill).needs-humanruns no longer show 0 tokens;tok/runbecomes comparable. (A killed run's last request may still be missing, so it is a lower bound, never an overcount.)Also: a guard-blocked claude tool shows up in hx' stream only as a
tool_result(the bustool_callis internal), so the soft/hard deny is counted from that result; the count check from #19 keeps working.Verification:
sh tests/all.shexit 0 (24 unit tests, e2e, real-hx e2e), flake loop 5/5 under load.decidethat always allows turns 5 tests red.orch guardprocess): undercontinuethe agent triespython3 -c, gets the reason, then runslsand writes; denied call never ran,denies = 1, auditdeny, allow, allow. Hard denies (auth.json,git push,.hx/config.toml,ls /etc) still endneeds-human. Defaultstopends at the first soft deny. Mutation 1 (soft deny always stops) and mutation 2 (no token fallback) each turn the e2e red.on_deny = continuewith a deniedlsendsdonewithdenies = 1; the same profile withreadonlyhasdenies = 0; defaultstopendsneeds-human.Not verified with real claude: how it reacts to a denied call (it reads the reason and may retry the same command or give up with a text answer; the retry then counts as another deny). A run that loops on denies is limited only by
max_turns/max_tokens/wall_secs, so set one of them when you usecontinue.Allowlist entry readonlyto Allowlist: readonly entry, on_deny = continue, tokens of stopped runs