fix: interactive sessions run with yolo under the sandbox, auto without
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:
1 parent
c768ea79d4
commit
71f58d7b30
3 files changed
+21
-7
No files matched your search
@@ -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)
|
# 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),
|
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.
|
# 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`)
|
## Allowlist (`allow`)
|
||||||
|
|||||||
+1
-7
@@ -64,13 +64,7 @@ impl Acp {
|
|||||||
let mut parts = p.hx.split_whitespace();
|
let mut parts = p.hx.split_whitespace();
|
||||||
let mut cmd = Command::new(parts.next().context("empty hx command")?);
|
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`
|
// 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
|
cmd.args(parts).args(p.acp_flags());
|
||||||
let flags = p.hx_flags();
|
|
||||||
cmd.args(parts).args(
|
|
||||||
flags
|
|
||||||
.iter()
|
|
||||||
.filter(|f| **f != "--yolo" || p.yolo == Some(true)),
|
|
||||||
);
|
|
||||||
cmd.args(["serve", "--acp", "--cwd"])
|
cmd.args(["serve", "--acp", "--cwd"])
|
||||||
.arg(worktree)
|
.arg(worktree)
|
||||||
.args(["--session", id]);
|
.args(["--session", id]);
|
||||||
|
|||||||
@@ -178,6 +178,16 @@ impl Profile {
|
|||||||
f
|
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).
|
/// 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> {
|
pub fn load_path(path: &std::path::Path) -> Result<Self> {
|
||||||
let s =
|
let s =
|
||||||
@@ -277,6 +287,15 @@ mod tests {
|
|||||||
assert_eq!(f("sandbox=false"), ["--auto"]);
|
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]
|
#[test]
|
||||||
fn bwrap_lookup_scans_path() {
|
fn bwrap_lookup_scans_path() {
|
||||||
let dir = std::env::temp_dir().join(format!("orch-bwrap-{}", std::process::id()));
|
let dir = std::env::temp_dir().join(format!("orch-bwrap-{}", std::process::id()));
|
||||||
|
|||||||
Reference in new issue
Block a user