You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
6 families of functions are duplicated across the codebase with divergent behavior or copy-paste identity:
_make_ref_id() — two implementations produce different IDs (16-char vs 32-char hex, with/without prefix)
normalize_role() — canonical version in archive/message/roles.py maps "model"→"assistant"; surfaces copy in payloads.py just returns str()
chunked() — character-for-character identical in 3 modules
iter_conversation_id_pages — same name, different SQL in 2 modules
_topo_sort_message_tuples vs topo_sort_messages — same algorithm on different types
replace_action_events — triplicated across 3 modules
Proposed fix
Create polylogue/core/common.py or similar shared module. Move canonical implementations there. Delete all copies. For functions that differ only in data type, make them generic.
Activity
Sinity commentedon May 3, 2026
Consolidated into #784 (single-source definitions). Duplicated function elimination is part of the same architectural fix.