From 72067f98f7873732830a7cd8fc3c9bc1a7a69d63 Mon Sep 17 00:00:00 2001 From: Jammy2211 Date: Fri, 13 Nov 2026 20:59:25 +0000 Subject: [PATCH] config: set shift_watcher.mention_login; tests read a hermetic policy, not the shipped config Co-Authored-By: Claude Opus 5.5 --- agents/conductors/batch/_orchestrator.py | 6 ++++-- config/policy.yaml | 2 +- tests/test_orchestrator_mentions.py | 5 ++++- tests/test_orchestrator_steering.py | 3 +++ 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/agents/conductors/batch/_orchestrator.py b/agents/conductors/batch/_orchestrator.py index 1431c138..419cc177 100644 --- a/agents/conductors/batch/_orchestrator.py +++ b/agents/conductors/batch/_orchestrator.py @@ -1182,13 +1182,15 @@ def retry_post(marker: Path, body_file: Path, poster, now: _dt.datetime) -> dict _LOGIN_RE = re.compile(r"[A-Za-z0-9](?:[A-Za-z0-9-]{0,38})") +POLICY_PATH = Path(__file__).resolve().parents[3] / "config" / "policy.yaml" + + def mention_login() -> str: login = os.environ.get(MENTION_ENV, "").strip().lstrip("@") if not login: try: import yaml - cfg = yaml.safe_load((Path(__file__).resolve().parents[3] / "config" - / "policy.yaml").read_text(encoding="utf-8")) or {} + cfg = yaml.safe_load(POLICY_PATH.read_text(encoding="utf-8")) or {} login = str((cfg.get("shift_watcher") or {}).get("mention_login") or "") login = login.strip().lstrip("@") except Exception: diff --git a/config/policy.yaml b/config/policy.yaml index 7efcd08b..9ddc4028 100644 --- a/config/policy.yaml +++ b/config/policy.yaml @@ -173,4 +173,4 @@ board: # watcher's network surface"). Blank here: the operator sets it, or exports # PYAUTO_SHIFT_MENTION (which wins). Blank everywhere posts without a mention. shift_watcher: - mention_login: "" + mention_login: "Jammy2211" diff --git a/tests/test_orchestrator_mentions.py b/tests/test_orchestrator_mentions.py index ef25fe08..60126c28 100644 --- a/tests/test_orchestrator_mentions.py +++ b/tests/test_orchestrator_mentions.py @@ -130,8 +130,11 @@ def test_a_worker_parked_on_its_issue_is_awaiting_input(tmp_path, monkeypatch): def test_the_login_comes_from_the_environment_or_config_never_the_code(tmp_path, monkeypatch): + blank = tmp_path / "policy.yaml" + blank.write_text("shift_watcher:\n mention_login: \"\"\n", encoding="utf-8") + monkeypatch.setattr(orch, "POLICY_PATH", blank) # hermetic: never the shipped config monkeypatch.delenv(orch.MENTION_ENV, raising=False) - assert orch.mention_login() == "" # config/policy.yaml leaves it blank + assert orch.mention_login() == "" # a blank config leaves it blank monkeypatch.setenv(orch.MENTION_ENV, "@" + LOGIN) assert orch.mention_login() == LOGIN monkeypatch.setenv(orch.MENTION_ENV, "not a login; rm -rf") diff --git a/tests/test_orchestrator_steering.py b/tests/test_orchestrator_steering.py index 99aaacdd..93a2c734 100644 --- a/tests/test_orchestrator_steering.py +++ b/tests/test_orchestrator_steering.py @@ -313,6 +313,9 @@ def test_a_command_is_enacted_and_acknowledged_once(tmp_path, monkeypatch): def test_steering_is_off_without_a_login_and_reads_nothing(tmp_path, monkeypatch): mind, brief, home, slot = _shift(tmp_path, monkeypatch) monkeypatch.delenv(orch.MENTION_ENV) + blank = tmp_path / "policy.yaml" + blank.write_text("shift_watcher:\n mention_login: \"\"\n", encoding="utf-8") + monkeypatch.setattr(orch, "POLICY_PATH", blank) # hermetic: never the shipped config claude, gh = d.FakeClaude(), FakeGitHub() _tick(brief, mind, home, 0, claude, gh) assert gh.calls == ["create"] and "Steering is off" in gh.status()[0]["body"]