From b7242d2206738bd1041d9429f40acd522c25bd25 Mon Sep 17 00:00:00 2001 From: m3taversal Date: Mon, 20 Apr 2026 18:03:34 +0100 Subject: [PATCH] Wire rejection_reason into review records + fix ingestion domain routing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit rejection_reason was always NULL in review_records — now populated with comma-joined issue tags (near_duplicate, frontmatter_schema, etc.) at both rejection call sites. Also fixes stale reviewer_model="gpt-4o" hardcoding to use config.EVAL_DOMAIN_MODEL (currently Gemini Flash). Ingestion branches (ingestion/futardio-*, ingestion/metadao-*) now resolve to internet-finance domain instead of falling through to "general". Co-Authored-By: Claude Opus 4.6 (1M context) --- lib/domains.py | 15 ++++++++++++++- lib/evaluate.py | 4 +++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/lib/domains.py b/lib/domains.py index 0db6f94..bb1979a 100644 --- a/lib/domains.py +++ b/lib/domains.py @@ -37,6 +37,11 @@ _AGENT_PRIMARY_DOMAIN: dict[str, str] = { "leo": "grand-strategy", } +_INGESTION_SOURCE_DOMAIN: dict[str, str] = { + "futardio": "internet-finance", + "metadao": "internet-finance", +} + def agent_for_domain(domain: str | None) -> str: """Get the reviewing agent for a domain. Falls back to Leo.""" @@ -82,6 +87,14 @@ def detect_domain_from_branch(branch: str) -> str | None: """Extract domain from branch name like 'rio/claims-futarchy' → 'internet-finance'. Uses agent prefix → primary domain mapping for pipeline branches. + For ingestion branches, checks the rest of the name for source-type hints. """ prefix = branch.split("/")[0].lower() if "/" in branch else "" - return _AGENT_PRIMARY_DOMAIN.get(prefix) + if prefix in _AGENT_PRIMARY_DOMAIN: + return _AGENT_PRIMARY_DOMAIN[prefix] + if prefix == "ingestion": + rest = branch.split("/", 1)[1].lower() if "/" in branch else "" + for source_key, domain in _INGESTION_SOURCE_DOMAIN.items(): + if source_key in rest: + return domain + return None diff --git a/lib/evaluate.py b/lib/evaluate.py index 0cf09fd..ddb7de5 100644 --- a/lib/evaluate.py +++ b/lib/evaluate.py @@ -261,7 +261,8 @@ async def evaluate_pr(conn, pr_number: int, tier: str = None) -> dict: ) db.record_review( conn, pr_number, "rejected", - domain=domain, agent=agent, reviewer=agent, reviewer_model="gpt-4o", + domain=domain, agent=agent, reviewer=agent, reviewer_model=config.EVAL_DOMAIN_MODEL, + rejection_reason=",".join(domain_issues) if domain_issues else None, notes=(domain_review or "")[:4000], ) @@ -398,6 +399,7 @@ async def evaluate_pr(conn, pr_number: int, tier: str = None) -> dict: conn, pr_number, "approved-with-changes", domain=domain, agent=agent, reviewer="leo", reviewer_model="sonnet" if tier == "STANDARD" else "opus", + rejection_reason=",".join(all_issues) if all_issues else None, notes=(leo_review or domain_review or "")[:4000], ) logger.info(