From bedd38e52b9b2af3cdcc439645f588e7a3e32c65 Mon Sep 17 00:00:00 2001 From: Edgar Arakelyan Date: Fri, 20 Nov 2026 14:14:44 -0800 Subject: [PATCH 1/4] fix(agents): the Claude Code and OpenCode changelogs run tar on real time GNU tar's --listed-incremental keeps the time tar starts at as the next capture's baseline and archives only the files whose (real) mtime or ctime is at or after it. The A2A server runs with AGENTENV_REAL_TIME=1, but libfaketime takes the marker out of the server's own environment, so the tar it starts, and the tar Claude Code's post-tool hook starts, ran on the env's clock: with the clock ahead, every capture after the baseline left edits to existing files out; behind it, every capture carried every file under the roots. Each incremental tar now starts with the marker in its environment: Claude Code's baseline (server) and capture (hook), OpenCode's baseline and capture (server). Co-Authored-By: Claude Opus 5.5 --- .../agents/claude-code/tar_changelog.py | 13 ++++++- .../agents/agents/opencode/a2a_server.py | 11 ++++-- tst/unit/agents/claude_code/test_changelog.py | 22 ++++++++++++ .../agents/opencode/test_object_transfer.py | 29 +++++++++++++++ tst/util/recording_tar.py | 35 +++++++++++++++++++ 5 files changed, 107 insertions(+), 3 deletions(-) create mode 100644 tst/util/recording_tar.py diff --git a/src/agent_env/agents/agents/claude-code/tar_changelog.py b/src/agent_env/agents/agents/claude-code/tar_changelog.py index 47a6bddb5..7770ef8ab 100644 --- a/src/agent_env/agents/agents/claude-code/tar_changelog.py +++ b/src/agent_env/agents/agents/claude-code/tar_changelog.py @@ -63,6 +63,10 @@ # tar's exit status when a file changed as it read it: the archive is still whole. TAR_FILE_CHANGED_RC = 1 SIGTERM_EXIT_CODE = 143 +# tar keeps the time it starts at as the next capture's baseline and archives only the files changed since, by their +# real mtimes, so it runs on real time. libfaketime takes the marker out of the environment of the process it's given +# to, so no child inherits it. +REAL_TIME_ENV = dict(os.environ, AGENTENV_REAL_TIME="1") def _read_int(path): @@ -221,6 +225,7 @@ def main(): ["tar", "--ignore-failed-read", "--listed-incremental=" + work, "--exclude=" + changelog_dir, "-czf", local, *members], check=False, stdout=subprocess.DEVNULL, stderr=subprocess.PIPE, pass_fds=(lock.fileno(),), + env=REAL_TIME_ENV, ) archived = True try: @@ -263,6 +268,12 @@ def main(): _DEFAULT_CONFIG_LINE = 'CFG = "/tmp/changelog/config.json"' +def real_time_env(environ: Mapping[str, str]) -> dict[str, str]: + """``environ`` for the changelog's tar, whose start is the next capture's baseline, so on real time: the server is, + but libfaketime took the marker out of the server's environment, so what it starts isn't.""" + return {**environ, "AGENTENV_REAL_TIME": "1"} + + def gnu_tar() -> bool: """Whether this host's tar is GNU tar, which the changelog's incremental archives need.""" try: @@ -461,7 +472,7 @@ def _reset(self, roots: list[str], write_namespace: dict) -> None: subprocess.run( ["tar", "--ignore-failed-read", f"--listed-incremental={self.snar}", f"--exclude={self.directory}", "-cf", "/dev/null", *present], - check=False, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, + check=False, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, env=real_time_env(os.environ), ) async def apply(self, request: ObjectChangelogApplyRequest) -> ObjectChangelogApplyResponse: diff --git a/src/agent_env/agents/agents/opencode/a2a_server.py b/src/agent_env/agents/agents/opencode/a2a_server.py index 5d1190a1c..052d233a7 100644 --- a/src/agent_env/agents/agents/opencode/a2a_server.py +++ b/src/agent_env/agents/agents/opencode/a2a_server.py @@ -517,7 +517,7 @@ async def _capture_changelog(self) -> None: ["tar", "--ignore-failed-read", f"--listed-incremental={pending_snar}", *_changelog_backup_exclusions(), f"--exclude={_CHANGELOG_DIR}", "-czf", str(archive), *roots, str(record)], - check=True, stdout=subprocess.DEVNULL, stderr=subprocess.PIPE, + check=True, stdout=subprocess.DEVNULL, stderr=subprocess.PIPE, env=_real_time_env(), ) await config["uploader"].upload(f"{sequence:06d}.tgz", archive) pending_snar.replace(_CHANGELOG_SNAR) @@ -643,10 +643,17 @@ def _baseline_changelog(roots: list[str]) -> None: ["tar", "--ignore-failed-read", f"--listed-incremental={_CHANGELOG_SNAR}", *_changelog_backup_exclusions(), "-cf", "/dev/null", *present], - check=True, stdout=subprocess.DEVNULL, stderr=subprocess.PIPE, + check=True, stdout=subprocess.DEVNULL, stderr=subprocess.PIPE, env=_real_time_env(), ) +def _real_time_env() -> dict[str, str]: + """This server's environment for the changelog's tar, which keeps the time it starts at as the next capture's + baseline and archives only the files changed since, by their real mtimes, so it runs on real time: the server + does, but libfaketime took the marker out of the server's environment, so what it starts doesn't.""" + return {**os.environ, "AGENTENV_REAL_TIME": "1"} + + def gnu_tar() -> bool: """Whether this host's tar is GNU tar, which the changelog's incremental archives need.""" try: diff --git a/tst/unit/agents/claude_code/test_changelog.py b/tst/unit/agents/claude_code/test_changelog.py index 047fede63..6f59ac6e3 100644 --- a/tst/unit/agents/claude_code/test_changelog.py +++ b/tst/unit/agents/claude_code/test_changelog.py @@ -22,6 +22,7 @@ from tst.unit.agents.claude_code.agent import a2a_server, claude_bridge, tar_changelog from tst.unit.agents.claude_code.support import expiry, extension_methods, read_grant +from tst.util import recording_tar GNU_TAR = shutil.which("tar") is not None and tar_changelog.gnu_tar() needs_gnu_tar = pytest.mark.skipif(not GNU_TAR, reason="the changelog is a GNU incremental tar") @@ -219,6 +220,27 @@ def test_enable_writes_the_script_and_config_baselines_and_installs_the_hook(tmp assert directory.stat().st_mode & 0o777 == 0o700 +def test_the_changelogs_tar_runs_on_real_time(tmp_path, staging, monkeypatch): + """tar keeps the time it starts at as the next capture's baseline and archives only the files changed since, by + their real mtimes: on an env clock ahead of real time it left every later edit out. No process hands its children + the marker, which libfaketime takes out of the environment it's given in, so the server and the hook give tar it.""" + log = recording_tar.install(tmp_path / "bin") + path = f"{tmp_path / 'bin'}{os.pathsep}{os.environ['PATH']}" + monkeypatch.setenv("PATH", path) + monkeypatch.delenv("AGENTENV_REAL_TIME", raising=False) + root = tmp_path / "workspace" + root.mkdir() + changelog, _, _, _ = _changelog(tmp_path, roots=[str(root)]) + + _enable(changelog) + (root / "edited.txt").write_text("after") + result = _capture(changelog, staging.port, path=path) + + assert result.returncode == 0 and "captured seq=0" in result.stderr, result.stderr + runs = recording_tar.incremental_runs(log) + assert [("-cf" in run["args"], run["real_time"]) for run in runs] == [(True, "1"), (False, "1")] + + def test_enable_refuses_an_empty_root_list(tmp_path): log, installed, _, _ = _changelog(tmp_path) diff --git a/tst/unit/agents/opencode/test_object_transfer.py b/tst/unit/agents/opencode/test_object_transfer.py index c2e2eaf3a..8466f5895 100644 --- a/tst/unit/agents/opencode/test_object_transfer.py +++ b/tst/unit/agents/opencode/test_object_transfer.py @@ -15,6 +15,7 @@ from tst.unit.agents.opencode.agent import a2a_server as server from tst.unit.agents.opencode.agent import opencode_kit +from tst.util import recording_tar def _grant(kind): @@ -512,6 +513,34 @@ async def upload(self, _path, _source): assert config["sequence"] == 1 +@pytest.mark.asyncio +async def test_the_changelogs_tar_runs_on_real_time(monkeypatch, tmp_path, oc, folders): + """tar keeps the time it starts at as the next capture's baseline and archives only the files changed since, by + their real mtimes: on an env clock ahead of real time it left every later edit out. The server runs on real time, + but libfaketime takes the marker out of its environment, so tar is given it again.""" + log = recording_tar.install(tmp_path / "bin") + monkeypatch.setenv("PATH", f"{tmp_path / 'bin'}{os.pathsep}{os.environ['PATH']}") + monkeypatch.delenv("AGENTENV_REAL_TIME", raising=False) + uploads = _KeptUploads() + monkeypatch.setattr(server, "NamespaceUploader", lambda _grant: uploads) + namespace = { + "root_path": "captures", "expires_at": _grant("http-put")["expires_at"], + "max_objects": 10, "max_object_bytes": 1 << 20, "max_total_bytes": 1 << 22, + "write": {"kind": "http-post-policy", "url": "https://objects.example.test/upload", + "fields": {"key": "captures/"}, "path_field": "key", "file_field": "file"}, + } + async with oc.client() as client: + enabled = await client.post("/ext/snapshot/changelog", json={"write_namespace": namespace, + "roots": [str(folders)]}) + (folders / "edited.txt").write_text("after") + await oc.agent._capture_changelog() + + assert enabled.status_code == 200, enabled.text + assert list(uploads.objects) == ["000000.tgz"] + runs = recording_tar.incremental_runs(log) + assert [("-cf" in run["args"], run["real_time"]) for run in runs] == [(True, "1"), (False, "1")] + + @pytest.mark.asyncio async def test_snapshot_waits_for_active_workspace_turn(monkeypatch, oc): started = asyncio.Event() diff --git a/tst/util/recording_tar.py b/tst/util/recording_tar.py new file mode 100644 index 000000000..b6e0c7915 --- /dev/null +++ b/tst/util/recording_tar.py @@ -0,0 +1,35 @@ +"""A stand-in for ``tar`` that records each run's arguments and whether it was started on real time (agent-env's +libfaketime marker in its environment), and writes the archive and snapshot files it's named, empty.""" + +from __future__ import annotations + +import json +import sys +from pathlib import Path + +_SCRIPT = """#!{python} +import json, os, sys +args = sys.argv[1:] +with open({log!r}, "a") as log: + log.write(json.dumps({{"real_time": os.environ.get("AGENTENV_REAL_TIME"), "args": args}}) + "\\n") +for arg, value in zip(args, args[1:] + [None]): + named = arg.partition("=")[2] if arg.startswith("--listed-incremental=") else value if arg in ("-cf", "-czf") else None + if named and named not in ("-", "/dev/null"): + open(named, "a").close() +""" + + +def install(directory: Path) -> Path: + """A ``tar`` in ``directory``, to put first on PATH; returns the log it adds a line to per run.""" + directory.mkdir(parents=True, exist_ok=True) + log = directory / "tar-runs.jsonl" + tar = directory / "tar" + tar.write_text(_SCRIPT.format(python=sys.executable, log=str(log))) + tar.chmod(0o755) + return log + + +def incremental_runs(log: Path) -> list[dict]: + """The recorded runs that read or wrote an incremental snapshot.""" + runs = [json.loads(line) for line in log.read_text().splitlines()] if log.exists() else [] + return [run for run in runs if any(arg.startswith("--listed-incremental=") for arg in run["args"])] From 4a41e78426f8faebb8c02411dee51791bc84a636 Mon Sep 17 00:00:00 2001 From: Edgar Arakelyan Date: Fri, 20 Nov 2026 14:17:20 -0800 Subject: [PATCH 2/4] fix(claude-code): the changelog's capture hook runs on real time The post-tool hook is a child of the CLI, which follows the env's clock, and it uploads each increment through a namespace grant whose expiry the protocol's uploader checks against the process's own clock. On an env clock past the grant's expiry (any clock days ahead of real time) the hook refused every upload as grant_expired, so a run captured nothing. The hook's command now starts with AGENTENV_REAL_TIME=1, which the shell the CLI runs it through hands the hook; its tar is given the marker again, as libfaketime takes it out of the hook's own environment. Co-Authored-By: Claude Opus 5.5 --- .../agents/claude-code/tar_changelog.py | 9 +++-- tst/unit/agents/claude_code/test_changelog.py | 33 +++++++++++++++++-- 2 files changed, 37 insertions(+), 5 deletions(-) diff --git a/src/agent_env/agents/agents/claude-code/tar_changelog.py b/src/agent_env/agents/agents/claude-code/tar_changelog.py index 7770ef8ab..92542a350 100644 --- a/src/agent_env/agents/agents/claude-code/tar_changelog.py +++ b/src/agent_env/agents/agents/claude-code/tar_changelog.py @@ -49,8 +49,8 @@ _TAR_VERSION_TIMEOUT_S = 30 _FAILED_INCREMENTS_LOGGED = 5 -# The post-tool hook, run by the agent's own Python, as a child of the CLI after every tool call, so an increment -# includes that tool's writes. It exits 0 on a capture error, so the error never reaches the model. +# The post-tool hook, run by the agent's own Python on real time, as a child of the CLI after every tool call, so an +# increment includes that tool's writes. It exits 0 on a capture error, so the error never reaches the model. CAPTURE_SCRIPT = r'''import asyncio, fcntl, json, os, shutil, signal, subprocess, sys, time from pathlib import Path @@ -266,6 +266,9 @@ def main(): sys.exit(0) ''' _DEFAULT_CONFIG_LINE = 'CFG = "/tmp/changelog/config.json"' +# The hook decides by its own clock whether the grant it uploads with has expired, so it runs on real time, not the +# CLI's: the CLI runs a hook's command through a shell, which hands the hook this assignment. +_REAL_TIME_PREFIX = "AGENTENV_REAL_TIME=1" def real_time_env(environ: Mapping[str, str]) -> dict[str, str]: @@ -424,7 +427,7 @@ def __init__( self.snar = f"{directory}/state.snar" self.config_path = f"{directory}/config.json" self.capture_path = f"{directory}/capture.py" - self.hook_command = f"{shlex.quote(sys.executable)} {shlex.quote(self.capture_path)}" + self.hook_command = f"{_REAL_TIME_PREFIX} {shlex.quote(sys.executable)} {shlex.quote(self.capture_path)}" def capture_script(self) -> str: """``CAPTURE_SCRIPT`` reading this changelog's config.""" diff --git a/tst/unit/agents/claude_code/test_changelog.py b/tst/unit/agents/claude_code/test_changelog.py index 6f59ac6e3..5450bbaa6 100644 --- a/tst/unit/agents/claude_code/test_changelog.py +++ b/tst/unit/agents/claude_code/test_changelog.py @@ -8,6 +8,7 @@ import email.policy import json import os +import shlex import shutil import subprocess import sys @@ -140,8 +141,8 @@ def test_the_hook_waits_long_enough_for_its_turn_and_the_script_reads_its_own_co log, _, _, _ = _changelog(tmp_path) assert tar_changelog.HOOK_TIMEOUT_S == 600 assert f"CFG = {json.dumps(str(tmp_path / 'changelog' / 'config.json'))}" in log.capture_script() - assert log.hook_command.endswith(f"{tmp_path / 'changelog' / 'capture.py'}") - assert log.hook_command.split()[0] == sys.executable + capture = str(tmp_path / "changelog" / "capture.py") + assert shlex.split(log.hook_command) == ["AGENTENV_REAL_TIME=1", sys.executable, capture] def test_the_changelog_directory_is_one_per_port(): @@ -241,6 +242,34 @@ def test_the_changelogs_tar_runs_on_real_time(tmp_path, staging, monkeypatch): assert [("-cf" in run["args"], run["real_time"]) for run in runs] == [(True, "1"), (False, "1")] +def test_the_hook_the_cli_runs_through_a_shell_starts_on_real_time(tmp_path, staging, monkeypatch): + """The hook decides by its own clock whether the grant it uploads with has expired: on an env clock past the + grant's expiry it refused every upload. A sitecustomize on the hook's path records the environment it started in.""" + seen = tmp_path / "hook-started-with.json" + probe = tmp_path / "probe" + probe.mkdir() + (probe / "sitecustomize.py").write_text( + "import json, os, sys\n" + "if sys.argv[0].endswith('capture.py'):\n" + f" open({str(seen)!r}, 'w').write(json.dumps(os.environ.get('AGENTENV_REAL_TIME')))\n") + recording_tar.install(tmp_path / "bin") + monkeypatch.delenv("AGENTENV_REAL_TIME", raising=False) + root = tmp_path / "workspace" + root.mkdir() + changelog, _, _, _ = _changelog(tmp_path, roots=[str(root)]) + _enable(changelog) + + result = subprocess.run( + ["/bin/sh", "-c", changelog.hook_command], input=json.dumps({"tool_name": "Bash", "session_id": "s"}), + capture_output=True, text=True, timeout=120, + env={**os.environ, "A2A_PORT": str(staging.port), "PYTHONPATH": str(probe), + "PATH": f"{tmp_path / 'bin'}{os.pathsep}{os.environ['PATH']}"}, + ) + + assert result.returncode == 0 and "captured seq=0" in result.stderr, result.stderr + assert json.loads(seen.read_text()) == "1" + + def test_enable_refuses_an_empty_root_list(tmp_path): log, installed, _, _ = _changelog(tmp_path) From 033f8620510f7898bc52e1958c5e50ce668ce456 Mon Sep 17 00:00:00 2001 From: Edgar Arakelyan Date: Fri, 20 Nov 2026 14:24:43 -0800 Subject: [PATCH 3/4] refactor(claude-code): the changelog's real-time environment reads this process's, as OpenCode's does Co-Authored-By: Claude Opus 5.5 --- .../agents/agents/claude-code/tar_changelog.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/agent_env/agents/agents/claude-code/tar_changelog.py b/src/agent_env/agents/agents/claude-code/tar_changelog.py index 92542a350..a3708e411 100644 --- a/src/agent_env/agents/agents/claude-code/tar_changelog.py +++ b/src/agent_env/agents/agents/claude-code/tar_changelog.py @@ -271,10 +271,10 @@ def main(): _REAL_TIME_PREFIX = "AGENTENV_REAL_TIME=1" -def real_time_env(environ: Mapping[str, str]) -> dict[str, str]: - """``environ`` for the changelog's tar, whose start is the next capture's baseline, so on real time: the server is, - but libfaketime took the marker out of the server's environment, so what it starts isn't.""" - return {**environ, "AGENTENV_REAL_TIME": "1"} +def _real_time_env() -> dict[str, str]: + """This server's environment for the changelog's tar, whose start is the next capture's baseline, so on real time: + the server is, but libfaketime took the marker out of the server's environment, so what it starts isn't.""" + return {**os.environ, "AGENTENV_REAL_TIME": "1"} def gnu_tar() -> bool: @@ -475,7 +475,7 @@ def _reset(self, roots: list[str], write_namespace: dict) -> None: subprocess.run( ["tar", "--ignore-failed-read", f"--listed-incremental={self.snar}", f"--exclude={self.directory}", "-cf", "/dev/null", *present], - check=False, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, env=real_time_env(os.environ), + check=False, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, env=_real_time_env(), ) async def apply(self, request: ObjectChangelogApplyRequest) -> ObjectChangelogApplyResponse: From 4e5238caadb6eb94e5d3b889a1697daba61798cd Mon Sep 17 00:00:00 2001 From: Edgar Arakelyan Date: Fri, 20 Nov 2026 15:31:26 -0800 Subject: [PATCH 4/4] fix(claude-code): the capture hook starts on real time with or without a shell The hook command was `AGENTENV_REAL_TIME=1 `, which only works because the CLI runs a hook's command through a shell. A CLI that started hooks without one would fail to start every hook, which it treats as non-blocking, and the changelog would capture nothing without a word. `/usr/bin/env AGENTENV_REAL_TIME=1 ` works either way: env, started without the marker, sets it for the interpreter it execs. Every shell checked (sh, bash, dash, zsh) still execs it in place, so the CLI's SIGTERM on a hook's timeout still reaches Python. The hook test now runs the command through a shell and without one. Going back to the bare assignment fails the no-shell case, and dropping the launch fails both. Co-Authored-By: Claude Opus 5.5 --- .../agents/agents/claude-code/tar_changelog.py | 6 +++--- tst/unit/agents/claude_code/test_changelog.py | 11 +++++++---- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/agent_env/agents/agents/claude-code/tar_changelog.py b/src/agent_env/agents/agents/claude-code/tar_changelog.py index a3708e411..b1fc1c18a 100644 --- a/src/agent_env/agents/agents/claude-code/tar_changelog.py +++ b/src/agent_env/agents/agents/claude-code/tar_changelog.py @@ -267,8 +267,8 @@ def main(): ''' _DEFAULT_CONFIG_LINE = 'CFG = "/tmp/changelog/config.json"' # The hook decides by its own clock whether the grant it uploads with has expired, so it runs on real time, not the -# CLI's: the CLI runs a hook's command through a shell, which hands the hook this assignment. -_REAL_TIME_PREFIX = "AGENTENV_REAL_TIME=1" +# CLI's. env, started without the marker, sets it for the interpreter it execs, with or without a shell around it. +_REAL_TIME_LAUNCH = ("/usr/bin/env", "AGENTENV_REAL_TIME=1") def _real_time_env() -> dict[str, str]: @@ -427,7 +427,7 @@ def __init__( self.snar = f"{directory}/state.snar" self.config_path = f"{directory}/config.json" self.capture_path = f"{directory}/capture.py" - self.hook_command = f"{_REAL_TIME_PREFIX} {shlex.quote(sys.executable)} {shlex.quote(self.capture_path)}" + self.hook_command = shlex.join([*_REAL_TIME_LAUNCH, sys.executable, self.capture_path]) def capture_script(self) -> str: """``CAPTURE_SCRIPT`` reading this changelog's config.""" diff --git a/tst/unit/agents/claude_code/test_changelog.py b/tst/unit/agents/claude_code/test_changelog.py index 5450bbaa6..d965f35d8 100644 --- a/tst/unit/agents/claude_code/test_changelog.py +++ b/tst/unit/agents/claude_code/test_changelog.py @@ -142,7 +142,7 @@ def test_the_hook_waits_long_enough_for_its_turn_and_the_script_reads_its_own_co assert tar_changelog.HOOK_TIMEOUT_S == 600 assert f"CFG = {json.dumps(str(tmp_path / 'changelog' / 'config.json'))}" in log.capture_script() capture = str(tmp_path / "changelog" / "capture.py") - assert shlex.split(log.hook_command) == ["AGENTENV_REAL_TIME=1", sys.executable, capture] + assert shlex.split(log.hook_command) == ["/usr/bin/env", "AGENTENV_REAL_TIME=1", sys.executable, capture] def test_the_changelog_directory_is_one_per_port(): @@ -242,9 +242,11 @@ def test_the_changelogs_tar_runs_on_real_time(tmp_path, staging, monkeypatch): assert [("-cf" in run["args"], run["real_time"]) for run in runs] == [(True, "1"), (False, "1")] -def test_the_hook_the_cli_runs_through_a_shell_starts_on_real_time(tmp_path, staging, monkeypatch): +@pytest.mark.parametrize("through_shell", [True, False], ids=["shell", "no-shell"]) +def test_the_hook_starts_on_real_time_with_or_without_a_shell(tmp_path, staging, monkeypatch, through_shell): """The hook decides by its own clock whether the grant it uploads with has expired: on an env clock past the - grant's expiry it refused every upload. A sitecustomize on the hook's path records the environment it started in.""" + grant's expiry it refused every upload. A sitecustomize records the environment the hook started in, through a + shell as the CLI runs it, and without one, where a bare assignment prefix wouldn't start the hook at all.""" seen = tmp_path / "hook-started-with.json" probe = tmp_path / "probe" probe.mkdir() @@ -259,8 +261,9 @@ def test_the_hook_the_cli_runs_through_a_shell_starts_on_real_time(tmp_path, sta changelog, _, _, _ = _changelog(tmp_path, roots=[str(root)]) _enable(changelog) + command = ["/bin/sh", "-c", changelog.hook_command] if through_shell else shlex.split(changelog.hook_command) result = subprocess.run( - ["/bin/sh", "-c", changelog.hook_command], input=json.dumps({"tool_name": "Bash", "session_id": "s"}), + command, input=json.dumps({"tool_name": "Bash", "session_id": "s"}), capture_output=True, text=True, timeout=120, env={**os.environ, "A2A_PORT": str(staging.port), "PYTHONPATH": str(probe), "PATH": f"{tmp_path / 'bin'}{os.pathsep}{os.environ['PATH']}"},