Skip to content

fix(photon): persist sidecar runtime record so cron/standalone sends work - #73564

Merged
teknium1 merged 3 commits into
mainfrom
photon/cron-standalone-send
Jul 29, 2026
Merged

fix(photon): persist sidecar runtime record so cron/standalone sends work#73564
teknium1 merged 3 commits into
mainfrom
photon/cron-standalone-send

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

Cron jobs and hermes send can now deliver to Photon without the gateway process's in-memory state: the adapter persists a {port, token, pid} runtime record (0600, atomic) after the sidecar passes /healthz, and _standalone_send falls back to it when PHOTON_SIDECAR_TOKEN isn't in the env — previously standalone sends structurally could not succeed because the token only ever existed in gateway memory.

Changes

  • plugins/platforms/photon/adapter.py: _write/_read/_delete_runtime_record helpers (profile-safe via get_hermes_home(), atomic mkstemp+replace, Windows-guarded chmod); record written after healthz 200; deleted in _stop_sidecar, connect early-return, readiness-timeout, and died-before-ready paths; _standalone_send validates recorded pid liveness (via gateway.status._pid_exists) before use, clean "gateway appears to be down" error on stale records.
  • tools/send_message_tool.py: photon:any;-;+phone target-resolution fix (the issue's secondary bug).
  • Docs (website/docs/user-guide/messaging/photon.md, plugin README): standalone/cron sends need the gateway running; shared/free-tier lines cannot initiate conversations with new targets (Photon-side policy — Photon: shared/free-tier lines cannot send outbound cron deliveries (Target not allowed) #51897).
  • Regression tests: record write/perms/cleanup, standalone fallback consumption, stale-record error path.

Validation

Result
Photon suite passed, 0 failed
E2E (real file I/O, temp HERMES_HOME) record 0600 + read-back exact + dead-pid detection + idempotent delete — ALL PASSED
Stale-base gate 0 behind

Fixes #69960.

Infographic

photon cron delivery

@alt-glitch alt-glitch added type/bug Something isn't working comp/plugins Plugin system and bundled plugins comp/tools Tool registry, model_tools, toolsets P3 Low — cosmetic, nice to have sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages labels Jul 28, 2026
@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

૮ >ﻌ< ა ci review

ran on 1b5de78

all good!

teknium1 added 3 commits July 28, 2026 13:33
…work

The sidecar auth token is generated at spawn (secrets.token_hex) and
existed only in the gateway process memory + sidecar child env, so
_standalone_send from cron subprocesses, hermes send, or the dashboard
structurally could not authenticate (#69960).

The adapter now writes <hermes-home>/runtime/photon-sidecar.json
({port, token, pid}, 0600, atomic tempfile+os.replace) once the sidecar
passes its /healthz readiness check, and deletes it in _stop_sidecar,
on every startup-failure path, and at disconnect so a stale record
never outlives a dead sidecar. _standalone_send falls back to the
record when PHOTON_SIDECAR_TOKEN is unset, validating the recorded pid
is alive first; a stale record yields a clear 'gateway appears to be
down' error. Docs note the gateway-must-be-running requirement and the
Photon-side shared-line initiation policy (#51897).
'photon:any;-;+1555...' targets matched no parser pattern, so
_handle_send bounced them off the channel directory and failed
resolution even though the adapter accepts the GUID verbatim (the
react handler already passed them through). Recognize the DM chat
GUID shape (mirrors the adapter's _DM_CHAT_GUID_RE) in
_parse_target_ref for photon only.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/plugins Plugin system and bundled plugins comp/tools Tool registry, model_tools, toolsets P3 Low — cosmetic, nice to have sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Cron jobs cannot deliver to Photon — sidecar/token unavailable in cron subprocess (distinct from #51897)

2 participants