fix(photon): recover degraded sidecar streams - #50974
Conversation
794b6b9 to
8354568
Compare
8354568 to
bc00e0e
Compare
|
This PR matches a real live failure mode we hit today: the local sidecar process was healthy enough to mask the fact that the upstream Photon stream was degraded/dead. Observed state: But the stream itself was failing repeatedly: Earlier in the same incident we also saw: Best-practice confirmation: |
bc00e0e to
00bce48
Compare
|
For reviewer context, this PR now intentionally overlaps with two related Photon PRs:
What this PR changes:
Relationship to #51105:
Relationship to #51075:
Validation run on this branch:
Live verification:
Happy to split this if maintainers prefer a narrower merge path. The natural split would be:
|
Classify Photon sidecar control failures, surface retryability to the adapter, and queue retryable runtime adapter failures for immediate gateway reconnection. Add sidecar stream-health reporting so a live local sidecar with a degraded upstream Photon stream no longer looks healthy forever. The adapter polls /healthz and promotes degraded upstream stream state into the same retryable fatal path used for sidecar crashes. Regression coverage verifies retryable sidecar errors, sidecar crash recovery, degraded stream health recovery, and gateway reconnect wake-up behavior.
00bce48 to
cc129c9
Compare
|
Coordination update after reviewing the newer related Photon PRs, especially #51161 and #49653. I agree that #51161 looks like the clean stream-recovery landing path if maintainers prefer it. It salvages #51105/#50071 and adds an important follow-up fix this branch should not ignore: Spectrum WARN/INFO stream lines can land on How I see the current split:
I am not trying to supersede the maintainer salvage in #51161. The maintainer-friendly path I expect is:
Happy to split those remaining pieces further if that is easier to review. |
teknium1
left a comment
There was a problem hiding this comment.
Thanks for preserving the residual Photon recovery work and documenting the overlap with #51161.
Problems
- Current main already contains the stream-recovery path from
06cbc3baeand theconsole.logfollow-up from7f1c278db(plugins/platforms/photon/sidecar/index.mjs:171-204,526-559). Those hunks should not be salvaged again. - The PR's
spectrum-ts5.2.0 pin conflicts with current main's v8 pin atplugins/platforms/photon/sidecar/package.json:16, introduced by4345b3e. The v5 patch guard/layout needs a v8-targeted port rather than a downgrade. - The newly adjustable timeout/health settings are environment-backed in the diff, but
AGENTS.md:102-106,620-623requires non-secret behavioral settings to be config.yaml-backed.
Suggested changes
- Preserve and re-target only the still-live behavior: current main still has the 15-second readiness deadline (
plugins/platforms/photon/adapter.py:984-1005), phone-create-before-DM-get resolution (plugins/platforms/photon/sidecar/index.mjs:661-683), and unclassified sidecar reply handling (plugins/platforms/photon/adapter.py:1552-1561). - Keep Spectrum v8 and add config-resolution coverage for any new knobs.
Automated hermes-sweeper review.
| }, | ||
| "dependencies": { | ||
| "spectrum-ts": "3.1.0" | ||
| "spectrum-ts": "5.2.0" |
There was a problem hiding this comment.
Current main is now pinned to spectrum-ts 8.0.0 by 4345b3e. Please port the remaining recovery behavior to the v8 sidecar and retain that dependency rather than restoring this 5.2.0 pin and its incompatible lockfile/patch layout.
| ).lower() not in ("0", "false", "no") | ||
| self._sidecar_health_interval = max( | ||
| 0.0, | ||
| _coerce_float( |
There was a problem hiding this comment.
This introduces a user-facing timeout/threshold through environment variables. AGENTS.md:102-106,620-623 requires non-secret behavioral settings to be config.yaml-backed; bridge to environment only internally if the sidecar requires it.
|
Closing — the healthz stream-health and degraded→fatal→reconnect core of this landed earlier (adapter health monitoring on main), the spectrum 5.2.0 upgrade is obsolete against the 8.0.0 pin, and the structured-error/retry work landed via #73563. The DM get-before-create idea remains a good one — resubmit that narrowly if you're up for it. |
Summary
space.get(any;-;+E164)before falling back to phone-basedspace.create, so established iMessage DMs remain sendable after sidecar restartspectrum-ts@5.2.0and skip the mixed-attachment patch when the newer inbound mapper is presentRelated PRs / Expected Merge Path
console.loginterception fix for Spectrum WARN/INFO stream logs. If fix(photon): recover degraded upstream stream (salvage #51105 + #50071) #51161 lands first, this PR should be rebased and duplicate stream-recovery hunks should be dropped.upstream_connection_droppedsidecar restart behavior, but does not cover the broader/healthzstream-state path, slow Photon startup timeout, DM rehydration, or thespectrum-tsupgrade/patch guard here.spectrum-tsupgrade. This PR incorporates the DM-resolution and retry-classification pieces, but still does not include fix(photon): harden iMessage outbound recovery #51075's HEIC/HEIF image transcoding; that remains separable from the gateway/sidecar liveness issue.After #51161, the intended remaining value of this PR is the live-repro follow-up surface: structured sidecar send classification, adapter-specific Photon startup timeout, DM-space rehydration before phone-based creation, standalone send retry/error clarity, and the
spectrum-ts@5.2.0upgrade/patch guard if those are not already merged elsewhere.Happy to split those remaining pieces further if maintainers prefer a narrower review path.
Validation
./scripts/run_tests.sh tests/plugins/platforms/photon/test_overflow_recovery.py tests/plugins/platforms/photon/test_spectrum_patch.py tests/gateway/test_platform_reconnect.pynode --check plugins/platforms/photon/sidecar/index.mjsnode --check plugins/platforms/photon/sidecar/patch-spectrum-mixed-attachments.mjs/home/tushar/.hermes/hermes-agent/venv/bin/python -m py_compile plugins/platforms/photon/adapter.py gateway/run.pygit diff --check/home/tushar/.hermes/hermes-agent/venv/bin/python scripts/check-windows-footguns.py --diff origin/mainLive Runtime Check
spectrum-ts@5.2.0; gateway restarted and connected with the newer Spectrum runtime/sendcan return a real Spectrum message id; also observed intermittent upstream send drops now surface as classifiedupstream_transientretryable errors