Add Binky weekly review approach

This commit is contained in:
tegwick 2026-08-08 21:26:29 +02:00
parent 140d1b0dc7
commit 8e98eada89
8 changed files with 700 additions and 12 deletions

View file

@ -22,6 +22,7 @@ from rein_aharness.taskspec import TaskSpecError
# Approach command names (stable; used in metrics + ops_run.result)
APPROACH_FI_RESEARCH_BRIEF = "fi-research-brief"
APPROACH_BRIEF_DAILY = "brief-daily"
APPROACH_BRIEF_WEEKLY = "brief-weekly"
APPROACH_MAIL_SCAN = "mail-scan"
APPROACH_MAIL_TRIAGE = "mail-triage"
APPROACH_MAIL_PIPELINE = "mail-scan+triage"
@ -52,6 +53,14 @@ APPROACH_RULES: tuple[ApproachRule, ...] = (
),
hint_name=APPROACH_FI_RESEARCH_BRIEF,
),
ApproachRule(
name=APPROACH_BRIEF_WEEKLY,
labels_all=frozenset({"binky", "weekly-review"}),
blob_contains=frozenset(
{"binky-weekly-review", "binky_weekly_review", "weekly founder review"}
),
hint_name=APPROACH_BRIEF_WEEKLY,
),
ApproachRule(
name=APPROACH_BRIEF_DAILY,
labels_any=frozenset({"rhythm", "binky-daily", "daily-brief"}),
@ -113,6 +122,7 @@ def select_approach(run: OpsRun) -> str:
known = {
APPROACH_FI_RESEARCH_BRIEF,
APPROACH_BRIEF_DAILY,
APPROACH_BRIEF_WEEKLY,
APPROACH_MAIL_SCAN,
APPROACH_MAIL_TRIAGE,
APPROACH_MAIL_PIPELINE,
@ -125,11 +135,12 @@ def select_approach(run: OpsRun) -> str:
blob = _match_blob(run)
for rule in APPROACH_RULES:
if rule.labels_all and not rule.labels_all.issubset(labels):
continue
if rule.labels_any and (rule.labels_any & labels):
return rule.name
if rule.blob_contains and any(s in blob for s in rule.blob_contains):
matches_all = bool(rule.labels_all) and rule.labels_all.issubset(labels)
matches_any = bool(rule.labels_any) and bool(rule.labels_any & labels)
matches_blob = bool(rule.blob_contains) and any(
substring in blob for substring in rule.blob_contains
)
if matches_all or matches_any or matches_blob:
return rule.name
return APPROACH_UNMATCHED
@ -182,6 +193,8 @@ def execute_approach(
return _run_fi(target, report_to_hub=report_to_hub, commit=commit)
if name == APPROACH_BRIEF_DAILY:
return _run_brief_daily(target, report_to_hub=report_to_hub, commit=commit)
if name == APPROACH_BRIEF_WEEKLY:
return _run_brief_weekly(target, report_to_hub=report_to_hub, commit=commit)
if name == APPROACH_MAIL_SCAN:
return _run_mail_scan(target, report_to_hub=report_to_hub)
if name == APPROACH_MAIL_TRIAGE:
@ -261,6 +274,33 @@ def _run_brief_daily(
)
def _run_brief_weekly(
target: Path, *, report_to_hub: bool, commit: bool
) -> ApproachResult:
from rein_aharness.brief_weekly import run_brief_weekly
r = run_brief_weekly(
target_repo=target,
report_to_hub=report_to_hub,
commit=commit,
)
return ApproachResult(
ok=r.ok,
approach=APPROACH_BRIEF_WEEKLY,
result={
"date": r.date,
"path": r.path,
"wrote": r.wrote,
"committed": r.committed,
"skipped_existing": r.skipped_existing,
"milestone_moved": r.milestone_moved,
"risk005_state": r.risk005_state,
"head_after": r.head_after,
"target_repo": "binky-control",
},
reason=r.reason,
reopen=not r.ok and not r.skipped_existing,
)
def _run_mail_scan(target: Path, *, report_to_hub: bool) -> ApproachResult:
from rein_aharness.mailscan import run_mail_scan
@ -357,5 +397,3 @@ def _run_agent_session(
reason=r.reason,
reopen=not r.ok,
)