Revert "Module config adjustments (#1413)"#1417
Conversation
This reverts commit 6e948f7.
Greptile SummaryThis PR reverts commit Key changes restored by this revert:
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant B as Blueprint / deploy()
participant MC as ModuleCoordinator
participant WM as WorkerManager
participant W as Worker (subprocess)
participant M as Module.__init__
B->>MC: deploy(GO2Connection, ip) or<br/>deploy_parallel([(Module, args, kwargs)])
MC->>WM: deploy(module_class, *args, **kwargs)
WM->>W: deploy_module(module_class, args=(ip,), kwargs={})
Note over W: _worker_loop receives msg<br/>{"type":"deploy_module", "args":(ip,), "kwargs":{}}
W->>M: module_class(*args, **kwargs)<br/>→ GO2Connection(ip)
M-->>W: instance
W-->>WM: module_id
WM-->>MC: RPCClient(actor, module_class)
MC-->>B: ModuleProxy
Note over B,MC: For Blueprint._deploy_all_modules:<br/>inspect.signature checks for "cfg" param<br/>→ injects global_config only if declared
Last reviewed commit: 9d8ee8f |
|
|
||
| if req_type == "deploy_module": | ||
| module_class = request["module_class"] | ||
| request["global_config"] | ||
| args = request.get("args", ()) | ||
| kwargs = request.get("kwargs", {}) | ||
| module_id = request["module_id"] | ||
| instance = module_class(global_config, **kwargs) | ||
| instance = module_class(*args, **kwargs) | ||
| instances[module_id] = instance |
There was a problem hiding this comment.
Silent no-op expression fixed by this revert
The original PR #1413 introduced a subtle bug where request["global_config"] was used as a bare expression statement (its value was never assigned or used):
# Original (buggy) code from #1413:
module_class = request["module_class"]
request["global_config"] # ← value read but never stored/used
kwargs = request.get("kwargs", {})
instance = module_class(global_config, **kwargs)This revert correctly replaces it with the args tuple approach. Just noting this for posterity — the fix is correct in the reverted code.
| class MockB1ConnectionModule(B1ConnectionModule): | ||
| """Test connection module that prints commands instead of sending UDP.""" | ||
|
|
||
| def __init__(self, global_config: GlobalConfig = global_config, **kwargs: Any) -> None: # type: ignore[no-untyped-def] | ||
| def __init__(self, ip: str = "127.0.0.1", port: int = 9090, *args, **kwargs) -> None: # type: ignore[no-untyped-def] |
There was a problem hiding this comment.
*args after keyword params may cause unexpected ordering
The call site:
super().__init__(ip, port, test_mode=True, *args, **kwargs) # type: ignore[misc]*args is unpacked after a keyword argument (test_mode=True), which is valid in Python 3.5+ (PEP 448). However, the # type: ignore[misc] acknowledges mypy flags this. If *args ever contains values (e.g., if the caller passes extra positional args), they would be appended as extra positional arguments after test_mode, potentially landing in the parent's *args but with confusing ordering. Since B1ConnectionModule.__init__ only ever receives ip and port as positional args from deploy call sites, this is low-risk in practice, but the mixing of positional and keyword ordering is a footgun to document.
Additional Comments (2)
sig = inspect.signature(blueprint.module.__init__)
if "cfg" in sig.parameters:
kwargs["cfg"] = global_configThis will silently skip passing
For example,
Any access to Consider either re-introducing the generic TypeVar on |
The Module config adjustments (dimensionalOS#1413) were reverted upstream (dimensionalOS#1417). WavefrontFrontierExplorer has no Config dataclass, so self.config.* would crash at runtime. Use direct instance attributes instead. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Reapply "Module config adjustments (#1413)" (#1417) This reverts commit 3df8857. * Fixes * Move global_config * Why did this not commit? * Default * Fix * Fix * Fix * Docs * tentative fix for timeout error * Fix * Use create_autospec * TemporalMemory fix * Forbid extra * Fix --------- Co-authored-by: Sam Bull <Sam.B@snowfalltravel.com> Co-authored-by: Paul Nechifor <paul@nechifor.net>
This reverts commit 6e948f7.
Problem
unitree-go2 blueprint is broken
Solution
revret module config adjustments
Breaking Changes
None
How to Test
dimos --simulation run unitree-go2