fix(issue-45): the shim bootstrap starts MAM servers with restore-on-restart off

The headless bootstrap regenerates the server config on every start and hands
it to the server as HERDR_CONFIG_PATH. Without a file the server still starts,
with a warning. mam_sandbox unsets HERDR_CONFIG_PATH/XDG_CONFIG_HOME so the
file lands in the sandbox HOME.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
GodopuandClaude Opus 5.5 committed 2026-10-04 10:32:35 +00:00
1 parent a640b0f072
commit ed73f67a4f
3 files changed
+41 -1

No files matched your search

+5
View File
@@ -236,6 +236,11 @@ def mam_sandbox(tmp_path, monkeypatch, request):
monkeypatch.delenv("HERDR_SESSION_NAME", raising=False)
monkeypatch.delenv("HERDR_SERVER_NAME", raising=False)
monkeypatch.delenv("HERDR_WORKSPACE_ID", raising=False)
# Issue #45: the shim bootstrap writes a herdr server config next to the
# user's; with these unset that is $HOME/.config/herdr, inside the sandbox.
# Every pane of a MAM server inherits HERDR_CONFIG_PATH.
monkeypatch.delenv("HERDR_CONFIG_PATH", raising=False)
monkeypatch.delenv("XDG_CONFIG_HOME", raising=False)
import sys
monkeypatch.setenv("AGENT_PYTHON_BIN", sys.executable)
+21
View File
@@ -150,6 +150,27 @@ def test_bootstrap_strips_agent_runtime_markers(mam_sandbox):
assert key in server_env
def test_bootstrap_hands_the_server_a_no_restore_config(mam_sandbox):
"""Issue #45: the server starts with HERDR_CONFIG_PATH = the user's herdr
config plus [session] resume_agents_on_restore = false (that herdr obeys it
is test_issue45_restore.py, on a real server)."""
import tomllib
env = _install_fake_herdr(mam_sandbox)
user_cfg = mam_sandbox / ".config" / "herdr" / "config.toml"
user_cfg.parent.mkdir(parents=True)
user_cfg.write_text("[ui]\nconfirm_close = false\n")
res = _run_through_shim(mam_sandbox, env, "issue45-probe")
assert res.returncode == 0, res.stderr
assert "restore-on-restart stays enabled" not in res.stderr, res.stderr
server_env = json.loads(Path(env["FAKE_HERDR_ENV_DUMP"]).read_text())
assert server_env.get("HERDR_CONFIG_PATH") == str(user_cfg.parent / "mam-server-config.toml")
assert "MAM_SERVER_CFG" not in server_env
cfg = tomllib.loads(Path(server_env["HERDR_CONFIG_PATH"]).read_text())
assert cfg == {"ui": {"confirm_close": False}, "session": {"resume_agents_on_restore": False}}
def test_no_autostart_skips_bootstrap_but_still_routes_the_call(mam_sandbox):
env = _install_fake_herdr(mam_sandbox)
env["MAM_NO_AUTOSTART"] = "1"