Skip to content

fix: persist media server port and wait for waku connection status#16

Open
friofry wants to merge 1 commit into
masterfrom
fix/media-server-port
Open

fix: persist media server port and wait for waku connection status#16
friofry wants to merge 1 commit into
masterfrom
fix/media-server-port

Conversation

@friofry

@friofry friofry commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Configure media server bind/advertize options in InitializeApplication, replace removed wakuv2.peerstats with waku.connection.status.change, and add a pytest + GitHub Actions check that port 8081 survives logout/re-init.

refs status-im/status-go#7611

@friofry friofry requested review from Copilot and nickninov and removed request for nickninov July 9, 2026 19:36

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the SDK and CI to keep the media server on a fixed port (8081) across logout/re-initialization cycles, and adjusts messenger startup to wait on an updated Waku connection signal.

Changes:

  • Add an end-to-end pytest that verifies the media server port (8081) persists across Logout -> InitializeApplication -> LoginAccount.
  • Persist media server bind/advertise settings in InitializeApplication payload generation.
  • Add a GitHub Actions workflow job that boots status-backend via Docker Compose and runs the new test.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/test_media_server_port.py Adds an integration test using HTTP + websocket signals to validate media port persistence across logout/re-init.
requirements.txt Adds pytest dependency to support running the new test in CI.
docker-compose.yaml Exposes port 8081 and improves backend healthcheck robustness to support the CI test.
bot/account.py Adds a fixed media_port to initialization payload and updates messenger startup to wait for a new Waku signal.
.github/workflows/ci.yml Adds a CI job that builds/runs the backend and executes the new pytest.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread bot/account.py
Comment on lines 1336 to +1339
self.logger.info("Starting messaging")
self.__call_rpc("messaging", "startMessenger")
self.__signal.get("wakuv2.peerstats")
with self.__signal.expect("waku.connection.status.change", timeout=60):
pass
Comment thread bot/account.py
- `port` - the port to connect to Status Backend. Verify the port in the Docker files.
- `is_secure` - if `http` or `https` should be used
- `backup_folder` - where backup files will be created and stored
- `media_port` - fixed media server port (advertized in localUrl as domain:media_port)
Comment on lines +119 to +126
def observed_port(signals: SignalBuffer, since: int) -> int | None:
signal_port = signals.latest_port("mediaserver.started", since)
if signal_port is not None:
return signal_port
if media_server_health_ok(MEDIA_PORT):
return MEDIA_PORT
return None

Comment on lines +74 to +76
def close(self):
self._stop = True

@friofry friofry force-pushed the fix/media-server-port branch 3 times, most recently from 86769e3 to f4214ed Compare July 9, 2026 20:06
Pass media server bind/advertize options in InitializeApplication and
replace the removed wakuv2.peerstats signal with waku.connection.status.change.
Publish port 8081 in docker-compose and add a pytest + GitHub Actions check
that the media server port survives logout/re-init.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 5 changed files in this pull request and generated 5 comments.

Comment thread bot/account.py
Comment on lines 1336 to +1339
self.logger.info("Starting messaging")
self.__call_rpc("messaging", "startMessenger")
self.__signal.get("wakuv2.peerstats")
with self.__signal.expect("waku.connection.status.change", timeout=60):
pass
Comment thread bot/account.py
- `port` - the port to connect to Status Backend. Verify the port in the Docker files.
- `is_secure` - if `http` or `https` should be used
- `backup_folder` - where backup files will be created and stored
- `media_port` - fixed media server port (advertized in localUrl as domain:media_port)
Comment on lines +121 to +126
def logout(signals: SignalBuffer | None = None) -> None:
since = signals.count("node.stopped") if signals is not None else 0
try:
post_json("Logout")
except requests.RequestException:
return
Comment on lines +211 to +214
key_uid = ensure_account(signals, init_data)
login(key_uid, signals)
port1 = observed_port(signals, since)
assert port1 == MEDIA_PORT, f"first login: expected {MEDIA_PORT}, got {port1}"
Comment on lines +218 to +221
initialize()
login(key_uid, signals)
port2 = observed_port(signals, since)
assert port2 == MEDIA_PORT, f"after re-init: expected {MEDIA_PORT}, got {port2}"
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.

2 participants