fix(attribution): unify research-session format on "(self-directed)" suffix
Some checks are pending
CI / lint-and-test (pull_request) Waiting to run

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) <noreply@anthropic.com>
This commit is contained in:
m3taversal 2026-04-27 12:53:52 +01:00
parent 319e03e2c6
commit 6aff03ff56
2 changed files with 1 additions and 1 deletions

View file

@ -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:

View file

@ -267,7 +267,6 @@ format: tweet | thread
status: unprocessed
priority: high | medium | low
tags: [topic1, topic2]
proposed_by: ${AGENT}
intake_tier: research-task
---