Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions agents/conductors/batch/_orchestrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion config/policy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
5 changes: 4 additions & 1 deletion tests/test_orchestrator_mentions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
3 changes: 3 additions & 0 deletions tests/test_orchestrator_steering.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
Loading