Skip to content

Fix Sagemcom session recovery after manual modem login#286

Merged
itsDNNS merged 1 commit intomainfrom
fix/sagemcom-session-recovery
Mar 24, 2026
Merged

Fix Sagemcom session recovery after manual modem login#286
itsDNNS merged 1 commit intomainfrom
fix/sagemcom-session-recovery

Conversation

@itsDNNS
Copy link
Owner

@itsDNNS itsDNNS commented Mar 24, 2026

Summary

Fixes #285 - DOCSight falls back to "Generic Router Mode" when a user manually logs into the modem web UI.

Root cause: When the modem invalidates DOCSight's session (e.g. another client logs in), it returns HTTP 200 with XMO error codes like XMO_UNKNOWN_PATH_ERR instead of HTTP errors. The driver's _raw_post() only raised a RuntimeError for one specific error code (16777236), silently ignoring all others. This meant:

  • Empty channel data was returned as a valid success
  • _logged_in stayed True, preventing re-authentication
  • The collector recorded every empty poll as successful (no backoff)
  • The UI showed "Generic Router Mode" (DS=0, US=0) until restart

Fix: _raw_post() now raises RuntimeError for any non-success XMO response. The existing re-auth mechanism in get_docsis_data() catches this and automatically re-authenticates + retries.

Test plan

  • 1871 tests pass (full suite)
  • New test: test_docsis_retry_on_xmo_session_error - simulates HTTP 200 + XMO_UNKNOWN_PATH_ERR, verifies re-auth + successful retry
  • New test: test_xmo_error_raises_runtime_error - verifies _raw_post raises for any XMO error
  • Existing test test_docsis_retry_on_failure still passes (HTTP 401 path)

When a user manually logs into the modem web UI, the modem invalidates
DOCSight's session. The modem returns HTTP 200 with XMO error codes
(e.g. XMO_UNKNOWN_PATH_ERR) instead of HTTP errors. Previously, only
error code 16777236 triggered a RuntimeError -- all other XMO errors
were silently ignored, causing the driver to return empty channel data
indefinitely until restart.

Now _raw_post() raises RuntimeError for any non-success XMO response,
which the existing re-auth mechanism in get_docsis_data() catches to
automatically re-authenticate and retry.

Fixes #285
@itsDNNS itsDNNS merged commit d324883 into main Mar 24, 2026
2 checks passed
@itsDNNS itsDNNS deleted the fix/sagemcom-session-recovery branch March 24, 2026 05:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

visit router then Generic Router Mode

1 participant