Files
buryan-infra/ops/agents/night_runner.py
T
architect 42ad47296b
lint / hygiene (push) Failing after 18s
lint / hygiene (pull_request) Failing after 17s
standard / check (push) Successful in 8s
standard / check (pull_request) Successful in 12s
[T4/T6/T5] Budget + approvals bans + night DDL/runner + eval harness
2026-11-30 23:44:05 +03:00

37 lines
1.1 KiB
Python
Executable File

#!/usr/bin/env python3
"""Night sprint runner — DRY-RUN ONLY (T6).
Production activation requires: systemd timer, approval_watcher, 3 dry-run nights.
This module never performs write actions or reads secrets.
"""
import json
import os
import sys
def main():
dry = "--dry-run" in sys.argv
if not dry:
print("night_runner: production run disabled until 3 dry-run nights + owner approval")
return 2
journal = os.environ.get("NIGHT_JOURNAL", "/var/lib/hub-agents/night-journal.jsonl")
window = os.environ.get("NIGHT_WINDOW", "weekdays 23:00-04:00 MSK")
budget = os.environ.get("NIGHT_BUDGET_RUB", "0")
rec = {
"mode": "dry-run",
"window": window,
"budget_rub": budget,
"write_actions": 0,
"secret_reads": 0,
"status": "ok",
}
print(json.dumps(rec, ensure_ascii=False))
os.makedirs(os.path.dirname(journal), exist_ok=True)
with open(journal, "a", encoding="utf-8") as f:
f.write(json.dumps(rec, ensure_ascii=False) + "\n")
return 0
if __name__ == "__main__":
raise SystemExit(main())