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
+15
View File
@@ -5,6 +5,7 @@ import unittest
from unittest.mock import patch
import role_session_router
from role_session_router import python_bytes_have_conflict_markers
from mcp_server import gitea_route_task_session, gitea_resolve_task_capability
_HEALTH_SUBPROCESS_TIMEOUT_SEC = 30
@@ -80,6 +81,20 @@ class TestMCPHealth(unittest.TestCase):
with self.assertRaises(unittest.SkipTest):
_health_test_python()
def test_conflict_marker_helper_ignores_decorative_equals_border(self):
sample = b'banner = """\n===========================================\n"""\n'
self.assertFalse(python_bytes_have_conflict_markers(sample))
def test_conflict_marker_helper_detects_real_markers(self):
sample = (
b"<" * 7 + b" HEAD\n"
b"print('hello')\n"
b"=" * 7 + b"\n"
b"print('world')\n"
b">" * 7 + b" main\n"
)
self.assertTrue(python_bytes_have_conflict_markers(sample))
def test_startup_conflict_detection(self):
# Create a Python file with conflict markers constructed dynamically
with open(self.temp_file, "w") as f: