Add transport config to blueprints#2499
Conversation
❌ 2 Tests Failed:
View the full list of 2 ❄️ flaky test(s)
To view more test analytics, go to the Test Analytics Dashboard |
Greptile SummaryThis PR moves WebRTC transport configuration into the standard blueprint config schema, so credentials and transport settings can be supplied via
Confidence Score: 3/5The core config-routing wiring is structurally sound, but two transports silently accept raw-string values for typed fields, and the hard removal of legacy env vars will break existing deployments without warning. Both with_config_overrides implementations use model_copy(update=...) without re-validation. CLI flags and env vars arrive as strings, so fields like ordered: bool and heartbeat_hz: float end up holding raw strings that raise TypeError when used. Additionally, every deployment using the old TELEOP_API_KEY / CF_TELEOP_APP_ID env var family will hit a RuntimeError at startup with no deprecation grace period. dimos/core/transport.py — both with_config_overrides implementations need model_validate instead of model_copy; dimos/protocol/pubsub/impl/webrtc/providers/broker.py and cloudflare.py for the breaking env-var removal. Important Files Changed
|
| def with_config_overrides(self, overrides: Mapping[str, Any]) -> Self: | ||
| new_config = self._config.model_copy(update=dict(overrides)) | ||
| return type(self)(self.topic, self._msg_type, config=new_config) |
There was a problem hiding this comment.
model_copy bypasses type coercion for CLI/env overrides
model_copy(update=...) in Pydantic v2 does not run validators by default, so non-string fields receive raw strings from the CLI or env. For example, setting TRANSPORTS__BROKER__ORDERED=false stores the string "false" — which is truthy — into ordered: bool, and TRANSPORTS__BROKER__HEARTBEAT_HZ=2.0 stores "2.0" into heartbeat_hz: float, which raises TypeError the first time arithmetic is done on it. The fix is to re-validate after the merge, e.g. type(self._config).model_validate({**self._config.model_dump(), **overrides}).
| ) | ||
| return lambda: None | ||
|
|
There was a problem hiding this comment.
Same
model_copy validation gap on WebRTCVideoTransport
The WebRTCVideoTransport.with_config_overrides implementation has the same issue: self._config.model_copy(update=dict(overrides)) won't coerce string values coming from the CLI/env into the declared field types (e.g., ordered: bool, max_retransmits: int | None). It should use model_validate to re-run coercion, consistent with whatever fix is applied to WebRTCTransport.
This merges into #2048. Moves transport config to be part of the general blueprint config.