mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-20 15:33:54 +00:00
fix(photon): intercept console.log so 'stream interrupted' bursts escalate
spectrum-ts routes stream telemetry through @photon-ai/otel's createLogger,
which sends severity>=ERROR to console.error and WARN/INFO to console.log.
The two lines the health monitor keys off land on different channels:
log.error("stream persistently failing") -> console.error (caught), but
log.warn("stream interrupted; reconnecting") -> console.log (was missed).
The original interception patched console.error only, so the recovering->
degraded escalation counter never saw the interrupt bursts that are the
primary silent-inbound symptom. Verified live against spectrum-ts 3.1.0 +
@photon-ai/otel: 3 real log.warn('stream interrupted') calls now escalate
to degraded -> process.exit(75) -> adapter reconnect.
Adds a shared classifyStreamLog() fed by both console.error and console.log,
plus a regression test asserting both channels are intercepted.
This commit is contained in:
parent
b60260c61a
commit
7f1c278db8
2 changed files with 44 additions and 8 deletions
|
|
@ -26,6 +26,23 @@ def test_sidecar_healthz_reports_stream_health() -> None:
|
|||
assert "process.exit(75);" in index
|
||||
|
||||
|
||||
def test_sidecar_intercepts_both_console_channels() -> None:
|
||||
"""spectrum-ts routes its stream telemetry through @photon-ai/otel, which
|
||||
sends severity >= ERROR to console.error and WARN/INFO to console.log.
|
||||
The two lines the health monitor keys off land on *different* channels:
|
||||
`log.error("stream persistently failing")` -> console.error, but
|
||||
`log.warn("stream interrupted; reconnecting")` -> console.log. Patching
|
||||
only console.error would miss every interrupt burst (the primary silent-
|
||||
inbound symptom), so both channels must be intercepted.
|
||||
"""
|
||||
index = Path("plugins/platforms/photon/sidecar/index.mjs").read_text(encoding="utf-8")
|
||||
assert "function classifyStreamLog(" in index
|
||||
assert "console.error = (...args) =>" in index
|
||||
assert "console.log = (...args) =>" in index
|
||||
# Both wrappers must feed the shared classifier.
|
||||
assert index.count("classifyStreamLog(text)") >= 2
|
||||
|
||||
|
||||
def test_sidecar_labels_catchup_internal_errors_as_upstream_photon() -> None:
|
||||
"""Photon cloud stream failures should not look like local auth problems."""
|
||||
index = Path("plugins/platforms/photon/sidecar/index.mjs").read_text(encoding="utf-8")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue