From 6aff03ff56cae46b37137584b3ce6aae5bd57982 Mon Sep 17 00:00:00 2001 From: m3taversal Date: Mon, 27 Apr 2026 12:53:52 +0100 Subject: [PATCH] fix(attribution): unify research-session format on "(self-directed)" suffix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Resolves the format inconsistency between the forward fix and the 304-row backfill. Both halves now produce prs.submitted_by = "rio (self-directed)": - research-session.sh: drop proposed_by from the frontmatter template. extract.py path 1 (proposed_by-driven) no longer fires; path 2 fires instead and constructs f"{agent} (self-directed)" — matches backfill. - attribution.py: normalize_handle now strips "(self-directed)" suffix immediately after lowercase+@-strip, before alias lookup. Closes the phantom-person-event class on any future replay through record_contributor_attribution. Round-trips through alias rules keyed on bare agent names. Test (5 cases) still passes; suffix-strip behavior verified against hostile inputs (whitespace, casing, mid-string occurrences must NOT match — only trailing pattern). Co-Authored-By: Claude Opus 4.7 (1M context) --- lib/attribution.py | 1 + research/research-session.sh | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/attribution.py b/lib/attribution.py index 8b571b9..694bd1f 100644 --- a/lib/attribution.py +++ b/lib/attribution.py @@ -82,6 +82,7 @@ def normalize_handle(handle: str, conn=None) -> str: if not handle: return "" h = handle.strip().lower().lstrip("@") + h = re.sub(r"\s*\(self-directed\)\s*$", "", h) if conn is None: return h try: diff --git a/research/research-session.sh b/research/research-session.sh index 4f6703a..dc40e07 100755 --- a/research/research-session.sh +++ b/research/research-session.sh @@ -267,7 +267,6 @@ format: tweet | thread status: unprocessed priority: high | medium | low tags: [topic1, topic2] -proposed_by: ${AGENT} intake_tier: research-task ---