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
test(agent-core): decide the bash job tests by the job host, not the wall clock (#2395)
Call White1ee0db40a120
diff --git a/tests/agent_core/tools/test_bash.py b/tests/agent_core/tools/test_bash.pyindex 06888d7ec..0190ebdaa 100644--- a/tests/agent_core/tools/test_bash.py+++ b/tests/agent_core/tools/test_bash.py@@ -141,9 +141,17 @@ async def test_only_the_recorded_reason_makes_a_gone_job_a_timeout(tmp_path, mak"""A wrapper failure inside a short timeout is reported as what it was, not as the timeout."""monkeypatch.setattr(jobs_module, "OUTPUT_HEAD_BYTES", 10)host = _host(tmp_path)- running = asyncio.ensure_future(- BashTool(host).execute({"command": "sleep 0.3; seq 1 1000; sleep 30", "timeout": 1.0}, make_ctx())- )+ real_start = host.start++ async def start_with_a_distant_deadline(*args, **kwargs):+ # bash keeps the call's 1 s timeout; the job's own deadline lies past the test, so only the+ # wrapper failure stops it, however long the launch takes.+ return await real_start(*args, **{**kwargs, "timeout_s": 3600.0})++ monkeypatch.setattr(host, "start", start_with_a_distant_deadline)+ go = tmp_path / "go"+ command = f"until [ -e {go} ]; do sleep 0.01; done; seq 1 1000; sleep 30"+ running = asyncio.ensure_future(BashTool(host).execute({"command": command, "timeout": 1.0}, make_ctx()))job_id = Nonewhile job_id is None or not os.path.exists(os.path.join(host.job_dir(job_id), "pid")):await asyncio.sleep(0.01)@@ -151,6 +159,7 @@ async def test_only_the_recorded_reason_makes_a_gone_job_a_timeout(tmp_path, mak# The wrapper cannot write its tail snapshot once the head is full, as on a full disk.wrapper_pid = open(os.path.join(host.job_dir(job_id), "pid")).read().strip()os.mkdir(os.path.join(host.job_dir(job_id), f"tail.log.{wrapper_pid}.tmp"))+ go.touch() # only now does the command writeresult = await asyncio.wait_for(running, timeout=10)@@ -394,22 +403,52 @@ async def test_the_foreground_window_hands_over_and_the_command_runs_once(tmp_paassert watches.by_job == {job_id: "wch_1"}+class SteppedClock:+ """``bash``'s monotonic clock, moved only by the test; ``read`` is set each time ``bash`` looks at it."""++ def __init__(self) -> None:+ self.now = 0.0+ self.read = asyncio.Event()++ def monotonic(self) -> float:+ self.read.set()+ return self.now++async def test_watch_true_returns_at_once(tmp_path, make_ctx, monkeypatch):- """At once after the command may run (the 0.5 s grace), however long the launch itself took."""+ """At the 0.5 s grace after the command may run, however long the launch itself took."""+ clock = SteppedClock()+ monkeypatch.setattr(bash_module, "time", clock)host = _host(tmp_path, Watches())- may_run_at = []real_start = host.start- async def start_and_note(*args, **kwargs):+ async def slow_start(*args, **kwargs):job_id = await real_start(*args, **kwargs)- may_run_at.append(time.monotonic())+ clock.now = 100.0 # the launch took 100 s; the grace counts from herereturn job_id- monkeypatch.setattr(host, "start", start_and_note)+ monkeypatch.setattr(host, "start", slow_start)+ running = asyncio.ensure_future(BashTool(host).execute({"command": "sleep 30", "watch": True}, make_ctx()))- result = await BashTool(host).execute({"command": "sleep 2; echo late", "watch": True}, make_ctx())+ async def next_read() -> None:+ clock.read.clear()+ reading = asyncio.ensure_future(clock.read.wait())+ await asyncio.wait({reading, running}, return_when=asyncio.FIRST_COMPLETED)+ reading.cancel()++ try:+ while clock.now != 100.0:+ await next_read()+ clock.now = 100.49+ # bash reads 100.49, then comes back for another reading: it decided to keep waiting.+ await next_read()+ await next_read()+ assert not running.done()+ clock.now = 100.5+ result = await asyncio.wait_for(running, timeout=10)+ finally:+ running.cancel()- assert time.monotonic() - may_run_at[0] < 1.5assert result_text(result).startswith("Command is still running and is now Watch wch_1.")assert host.status(result.details["job_id"]).state == "running"await host.kill(result.details["job_id"])