Skip to content

The agent that grows with you

fix(photon): stop advertising fenced code-block support on iMessage

Semir Kabirccfb68688eaf
diff --git a/plugins/platforms/photon/adapter.py b/plugins/platforms/photon/adapter.py
index ed74e0f349b..39a41e6c2ef 100644
--- a/plugins/platforms/photon/adapter.py
+++ b/plugins/platforms/photon/adapter.py
@@ -527,7 +527,9 @@ class PhotonAdapter(BasePlatformAdapter):
self._probe_timeout = _setting("probe_timeout_seconds", "PHOTON_PROBE_TIMEOUT_SECONDS", 10.0, float)
self._probe_max_failures = _setting("probe_max_failures", "PHOTON_PROBE_MAX_FAILURES", 3, int)
self._probe_enabled = self._probe_interval > 0
- self.supports_code_blocks = _markdown_enabled() # markdown on => fences pass through
+ # Never advertise fences: a URL-bearing message goes out as raw text (literal ```), and the
+ # markdown path renders a fence as inline Unicode monospace, not a block.
+ self.supports_code_blocks = False
self._sidecar_proc: Optional[subprocess.Popen] = None
self._http_client: Optional["httpx.AsyncClient"] = None
self._respawn_lock: Optional[asyncio.Lock] = None
diff --git a/tests/plugins/platforms/photon/test_markdown.py b/tests/plugins/platforms/photon/test_markdown.py
index 5fd688aeb71..50e0b7041ff 100644
--- a/tests/plugins/platforms/photon/test_markdown.py
+++ b/tests/plugins/platforms/photon/test_markdown.py
@@ -43,9 +43,16 @@ def test_format_message_passthrough_by_default(
assert adapter.format_message(_MD) == _MD
-def test_supports_code_blocks_mirrors_env(monkeypatch: pytest.MonkeyPatch) -> None:
+def test_supports_code_blocks_never_enabled(
+ monkeypatch: pytest.MonkeyPatch,
+) -> None:
+ """Fenced code blocks are not renderable on iMessage: URL-bearing
+ messages fall back to raw text (literal fences), and the markdown path
+ renders a fence as inline monospace, not a block. The adapter therefore
+ never advertises code-block support — the gateway emits its compact
+ one-line tool preview instead (see test_code_block_capability.py)."""
monkeypatch.delenv("PHOTON_MARKDOWN", raising=False)
- assert _make_adapter(monkeypatch).supports_code_blocks is True
+ assert _make_adapter(monkeypatch).supports_code_blocks is False
monkeypatch.setenv("PHOTON_MARKDOWN", "false")
assert _make_adapter(monkeypatch).supports_code_blocks is False