Allowlist with claude_cli: fail closed until hx#182; record provider mode (#18)
This commit was merged in pull request #18.
This commit is contained in:
1 parent
374cf28aed
commit
a76c0ac16f
9 files changed
+259
-14
No files matched your search
@@ -32,6 +32,29 @@ after each attempt, rewritten before the next) and blocks the call before it exe
|
||||
Limit: plain `bash` (no pattern) is not confined; a shell cannot be parsed reliably. Use `sandbox = true` for that.
|
||||
A repo that already has its own `.hx/config.toml` is refused (`setup:` failure) so the guard is never silently skipped.
|
||||
|
||||
## Provider modes
|
||||
|
||||
hx reaches Claude in two ways:
|
||||
|
||||
| mode | who runs the tools | what orch sees |
|
||||
|---|---|---|
|
||||
| `direct` (API provider) | hx | every tool as a `tool_call` event |
|
||||
| `claude_cli` (hx starts the `claude` binary; auto-on when `claude` is in PATH and `HX_BASE_URL` is unset) | the `claude` binary | with johannes/hx#182: every tool as a `tool_call` event, decided by the guard through hx' permission bridge; without it: only a `[claude TOOL: ...]` text line |
|
||||
|
||||
`allow` works in both modes **provided hx reports claude's tools as `tool_call` events** (hx#182). orch checks this
|
||||
on every run: it counts the `[claude ...]` tool lines in the text stream and the `tool_call` events. If claude used
|
||||
more tools than hx reported, the run ends `needs-human` with `policy: claude used N tool(s) but hx reported M
|
||||
tool_call event(s) ...`: a profile is never silently unguarded. On an hx without #182 every claude_cli run that
|
||||
uses a tool therefore fails closed; the tool has already run by then (the check is after the fact), so on such an hx
|
||||
use no `allow` plus `sandbox = true` for claude_cli profiles.
|
||||
`max_turns` counts model turns; in claude_cli mode there is one hx request per run, so it is not a useful limit there.
|
||||
|
||||
Telemetry records the mode (`provider_mode`: `claude_cli`, `direct`, `codex`; old lines `unknown`). `orch report`
|
||||
shows it as a column and `orch eval` refuses to compare files with different (or mixed) modes ("NOT COMPARABLE",
|
||||
exit 1): tokens, turns and tool behaviour differ by an order of magnitude between the modes.
|
||||
Limit: the mode is derived from config and the `claude` binary, not from hx itself; hx' remembered last provider
|
||||
(`last.json`) is not read, so set `provider` in profiles you compare.
|
||||
|
||||
## Audit log
|
||||
|
||||
`<state>/audit.log`, append-only JSONL: `run_start` (profile, allowlist, sandbox, yolo), one `tool` line per call
|
||||
|
||||
Reference in new issue
Block a user