fix: interactive sessions run with yolo under the sandbox, auto without
build / version (push) Successful in 12s
build / build (aarch64-apple-darwin) (push) Successful in 5m44s
build / build (x86_64-unknown-linux-musl) (push) Successful in 4m2s
build / release (push) Successful in 23s

orch dropped --yolo for ACP sessions (TUI, orch up), so hx started with a
bare --sandbox and asked for every edit. Interactive sessions now use the
same flags as batch runs: --sandbox --yolo when a sandbox is available,
--auto when not. A sandbox with yolo = false gets --sandbox --auto.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Johannes KresnerandClaude Opus 5.5 committed 2026-11-17 15:17:36 +01:00
1 parent c768ea79d4
commit 71f58d7b30
3 files changed
+21 -7

No files matched your search

+1
View File
@@ -13,6 +13,7 @@ env = ["GITEA_*"] # orch env vars hx may see (default: PATH HOME
# TMPDIR CARGO_* RUST* NIX_*, plus HX_HOME only when `home` is unset)
sandbox = true # hx --sandbox (bwrap/seatbelt). Default: on when available (macOS, Linux with bwrap),
# together with --yolo (yolo = false opts out). Unsandboxed hx runs with --auto.
# Interactive sessions (TUI, orch up) with yolo = false get --sandbox --auto.
```
## Allowlist (`allow`)
+1 -7
View File
@@ -64,13 +64,7 @@ impl Acp {
let mut parts = p.hx.split_whitespace();
let mut cmd = Command::new(parts.next().context("empty hx command")?);
// sandbox and permission flags are options of the root command, so they go before `serve`
// the TUI answers permission requests itself, so yolo only when the profile asks for it explicitly
let flags = p.hx_flags();
cmd.args(parts).args(
flags
.iter()
.filter(|f| **f != "--yolo" || p.yolo == Some(true)),
);
cmd.args(parts).args(p.acp_flags());
cmd.args(["serve", "--acp", "--cwd"])
.arg(worktree)
.args(["--session", id]);
+19
View File
@@ -178,6 +178,16 @@ impl Profile {
f
}
/// Flags for an interactive (ACP) session: like `hx_flags` (sandbox brings yolo, no sandbox falls back to
/// `--auto`), but a sandbox with `yolo = false` gets `--auto` too, so not every edit asks.
pub fn acp_flags(&self) -> Vec<&'static str> {
let mut f = self.hx_flags();
if f == ["--sandbox"] {
f.push("--auto");
}
f
}
/// A profile file named by its path (an issue session's profile in its worktree).
pub fn load_path(path: &std::path::Path) -> Result<Self> {
let s =
@@ -277,6 +287,15 @@ mod tests {
assert_eq!(f("sandbox=false"), ["--auto"]);
}
#[test]
fn acp_flags_yolo_with_sandbox_else_auto() {
let f = |s| Profile::parse(s).unwrap().acp_flags();
assert_eq!(f("sandbox=true"), ["--sandbox", "--yolo"]);
assert_eq!(f("sandbox=true\nyolo=true"), ["--sandbox", "--yolo"]);
assert_eq!(f("sandbox=true\nyolo=false"), ["--sandbox", "--auto"]);
assert_eq!(f("sandbox=false"), ["--auto"]);
}
#[test]
fn bwrap_lookup_scans_path() {
let dir = std::env::temp_dir().join(format!("orch-bwrap-{}", std::process::id()));