Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.
Python agentagent-osaiai-agentsai-partnerchatopsclaudeclaude-codecodexdevtoolsdiscord-botlark-botllmlocal-firstlong-term-memoryopencodeslack-botvibe-codingvibeywechat
fix(regression): give batch runner commands a closed stdin (#2314)
Call White2f7a600bc6a6
diff --git a/scripts/incus_regression.py b/scripts/incus_regression.pyindex b82c4ead0..f58d3c209 100644--- a/scripts/incus_regression.py+++ b/scripts/incus_regression.py@@ -115,6 +115,7 @@ class Runner:check: bool = True,capture: bool = False,timeout: float | None = None,+ interactive: bool = False,) -> subprocess.CompletedProcess[str]:print("+ " + shlex.join(command))if self.dry_run:@@ -128,6 +129,11 @@ class Runner:kwargs["input"] = input_byteselif input_text is not None:kwargs["input"] = input_text+ elif not interactive:+ # A batch command never reads the caller's stdin. `incus init` and+ # `incus launch` read instance YAML from a non-terminal stdin, so an+ # inherited pipe that is never closed would keep them waiting forever.+ kwargs["stdin"] = subprocess.DEVNULLif timeout is not None:kwargs["timeout"] = timeouttry:@@ -2818,7 +2824,7 @@ def cmd_shell(args: argparse.Namespace) -> int:target = resolve_target(args, repo_root, dry_run=args.dry_run, allocate_port=False)if not args.dry_run:require_incus()- Runner(dry_run=args.dry_run).run(tenant_exec(target, "exec bash -l", remote=args.remote))+ Runner(dry_run=args.dry_run).run(tenant_exec(target, "exec bash -l", remote=args.remote), interactive=True)return 0diff --git a/tests/test_incus_regression.py b/tests/test_incus_regression.pyindex 8ead5a89e..37e0d5be8 100644--- a/tests/test_incus_regression.py+++ b/tests/test_incus_regression.py@@ -507,6 +507,30 @@ def test_runner_reports_command_timeout(monkeypatch: pytest.MonkeyPatch, capsys:assert "Command timed out after 300 seconds" in capsys.readouterr().err[email protected](("interactive", "expected"), [(False, ""), (True, "typed by the user\n")])+def test_only_an_interactive_command_reads_the_callers_stdin(interactive: bool, expected: str) -> None:+ # A background caller holds stdin open as a pipe it never closes. A batch+ # command that inherited it (`incus init` reads YAML from it) would wait+ # for an EOF that never comes.+ read_end, write_end = os.pipe()+ saved_stdin = os.dup(0)+ try:+ os.dup2(read_end, 0)+ os.write(write_end, b"typed by the user\n")+ if interactive:+ os.close(write_end)+ write_end = -1+ result = incus_regression.Runner().run(["cat"], capture=True, timeout=10, interactive=interactive)+ finally:+ os.dup2(saved_stdin, 0)+ os.close(saved_stdin)+ os.close(read_end)+ if write_end >= 0:+ os.close(write_end)++ assert result.stdout == expected++def test_existence_comes_from_the_names_the_daemon_listed(monkeypatch: pytest.MonkeyPatch) -> None:listing = json.dumps([{"name": "avr-master"}, {"name": "avr-wt-demo-branch"}])monkeypatch.setattr(incus_regression.subprocess, "run", stub_incus_result(0, stdout=listing))