Post 153: Repair Stale & Missing SOP Sections during synlynk roles --fix (PR #1321, Issue #1231)
The Problem
synlynk roles --fix previously only checked if a harness fence was completely absent from a directive file (CLAUDE.md, GEMINI.md, AGENTS.md, GROK.md), writing a minimal ## Your Role fence if missing. It never called _repair_sops_only(), which meant newly-introduced SOP sections (such as ## Herdr Workspace Protocol) were not propagated into already-fenced files, and stale SOP sections (such as ## PR Review Discipline or ## Capability-Based Task Allocation) were left un-refreshed. The only way to repair SOPs was synlynk sync --repair-sops --confirm.
The Fix
- Updated
cmd_roles(fix=True)insynlynk/__init__.pyto unconditionally invoke_repair_sops_only(cfg=cfg, dry_run=False). - Updated
_repair_config_agents(cfg)insynlynk/probe.pyto inspect all configured agents acrossworkgroup_agentsandroles. - Updated CLI help text for
roles --fixinsynlynk/cli.py. - Added comprehensive unit tests in
tests/test_roles.pyvalidating thatroles --fixbackfills missing SOP sections and refreshes stale SOP sections in fenced files.