hermes-agent/tests/plugins/platforms/photon
Frowtek a90a2b3c3c fix(photon): inspect port listeners off the gateway event loop
`_reap_stale_sidecar` is `async`, but it identified the processes holding
the sidecar port with two blocking helpers called inline:

* `_find_listener_pids` -> `subprocess.run(["lsof", ...], timeout=5.0)`
* `_pid_is_sidecar` -> `subprocess.run(["ps", ...], timeout=5.0)`, once
  per candidate pid

so the inspection can hold the shared gateway loop for 5 + 5·N seconds
while nothing else on it is serviced. It only runs once the /healthz probe
finds something already listening — the orphaned-sidecar recovery path —
and `_reap_stale_sidecar` is awaited from `_start_sidecar`, which runs on
every reconnect (`connect(is_reconnect=True)`). The stall therefore lands
on a live gateway that is still serving every other platform, right when a
crashed sidecar has already left an orphan behind.

Move the whole inspection to one `asyncio.to_thread` hop (one hop rather
than N+1 round trips). The reaping semantics are untouched: SIGTERM for
verified orphans, SIGKILL escalation, and both foreign-listener
RuntimeErrors behave exactly as before.

Same off-the-loop class as the inbound-image decision (#66688) and the
cron-fire verifier.

Adds a regression test asserting both the lsof lookup and the per-pid ps
check execute on a worker thread rather than the loop thread.
2026-07-28 21:45:52 -07:00
..
test_auth.py test(photon): allow auth.lock sentinel in temp-file leak assertions 2026-07-28 18:20:06 -07:00
test_check_requirements_risks.py fix(photon): unify sidecar-deps check, harden log unlink and truncation 2026-07-28 18:20:06 -07:00
test_fatal_notify_self_cancel.py fix(photon): dispatch fatal-error notification from a detached task 2026-07-28 21:45:52 -07:00
test_inbound.py fix(photon): ignore iMessage media placeholders 2026-07-28 18:17:52 -07:00
test_markdown.py feat(photon): upgrade to spectrum-ts 3.0.0 (pinned) with markdown + reactions 2026-06-12 01:07:38 -07:00
test_mention_gating.py feat(photon): gRPC-native iMessage channel (no webhook) 2026-06-08 21:03:58 -07:00
test_npm_error_log_regression.py fix(photon): unify sidecar-deps check, harden log unlink and truncation 2026-07-28 18:20:06 -07:00
test_outbound_media.py feat(photon): wire outbound media via spectrum-ts attachment() (#42397) 2026-06-08 15:29:16 -07:00
test_overflow_recovery.py fix(photon): stop sidecar-crash fatal handler from cancelling its own supervisor task 2026-07-28 21:45:52 -07:00
test_reactions.py fix(photon): correlate tapbacks to bot message context 2026-06-27 00:51:34 -07:00
test_runtime_record.py fix(photon): un-shadow the U+FFFC deferred-wait handler; fix stale sidecar-deps fixture 2026-07-28 21:28:25 -07:00
test_setup_access.py test(photon): stub token validation in setup tests to avoid network 2026-07-28 18:20:06 -07:00
test_sidecar_deps_stale.py fix(photon): auto-reinstall stale sidecar deps before start 2026-07-05 17:38:32 -07:00
test_sidecar_lifecycle.py fix(photon): inspect port listeners off the gateway event loop 2026-07-28 21:45:52 -07:00
test_spectrum_patch.py fix(photon): keep sidecar alive if spectrum patch fails 2026-07-28 21:45:52 -07:00
test_streaming.py fix(photon): mark adapter as not supporting message editing to suppress streaming cursor 2026-07-28 18:17:52 -07:00