leo: warn on NULL source_path in _terminate_pr (Ganymede nit)

If source_path is NULL, the source requeue silently matches nothing.
Log a warning so we catch orphaned terminations in monitoring.

Pentagon-Agent: Leo <294C3CA1-0205-4668-82FA-B984D54F48AD>
This commit is contained in:
m3taversal 2026-03-13 17:17:30 +00:00
parent e7c902bac8
commit f4dc6b39ce

View file

@ -151,12 +151,14 @@ async def _terminate_pr(conn, pr_number: int, reason: str):
)
# Tag source for re-extraction with feedback
conn.execute(
cursor = conn.execute(
"""UPDATE sources SET status = 'needs_reextraction',
updated_at = datetime('now')
WHERE path = (SELECT source_path FROM prs WHERE number = ?)""",
(pr_number,),
)
if cursor.rowcount == 0:
logger.warning("PR #%d: no source_path linked — source not requeued for re-extraction", pr_number)
db.audit(conn, "evaluate", "pr_terminated", json.dumps({
"pr": pr_number, "reason": reason,