fix(mcp): stop infra_stop false positive on decorative equals banners

Line-anchor conflict-marker detection in check_mid_merge and MCP startup
so mcp_discoverability.py RELOAD_INSTRUCTIONS banners no longer block
reviewer capability resolution. Share python_bytes_have_conflict_markers
between mcp_server startup scan and role_session_router mid-merge checks.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
This commit is contained in:
2026-07-06 13:58:45 -04:00
co-authored by Claude Opus 4.8
parent 0716157fa5
commit a3fb079869
5 changed files with 78 additions and 31 deletions
+4 -9
View File
@@ -6,16 +6,12 @@ Runs over stdio. All tools authenticate via macOS keychain (git credential fill)
import os
import sys
from role_session_router import python_bytes_have_conflict_markers
# Startup health check: scan all python files in the Gitea-Tools directory for unresolved conflict markers.
def check_conflict_markers():
dir_path = os.path.dirname(os.path.abspath(__file__))
# Construct conflict patterns dynamically so the loader does not match itself
conflict_patterns = [
b"<" * 7 + b" ",
b"=" * 7 + b"\n",
b"=" * 7 + b"\r\n",
b">" * 7 + b" "
]
for root, dirs, files in os.walk(dir_path):
if any(p in root for p in ("venv", ".git", ".pytest_cache", "branches")):
continue
@@ -24,8 +20,7 @@ def check_conflict_markers():
file_path = os.path.join(root, file)
try:
with open(file_path, "rb") as f:
content = f.read()
if any(pattern in content for pattern in conflict_patterns):
if python_bytes_have_conflict_markers(f.read()):
rel_path = os.path.relpath(file_path, dir_path)
print(
f"infra_stop: Unresolved merge conflict detected in {rel_path}. "