fix(core): match module refs by IS-A so a subclass provider resolves - #3408
Merged
Conversation
A module ref declared as a concrete class (`coordinator: ControlCoordinator`) was matched with `cls is spec`. A deployment that swaps in a subclass — to add per-instance ports, say — therefore satisfied nothing: _resolve_single_ref fell through to returning the spec class, get_instance() found no deployed instance of it, and the ref was set to None. Nothing raised at wiring time; the failure surfaced later as an AttributeError on the first call through the ref. Match with issubclass instead, which is what a declared dependency means. This is not hypothetical: the per-instance command-stream change in this branch moves eight manipulator deployments onto ControlCoordinator subclasses, which silently unbound ManipulationModule._control_coordinator (trajectory execution, gripper get/set) in ten blueprints and ArmCommandModule.coordinator (E-STOP) in the two hosted ones. Verified across every blueprint in all_blueprints: twelve non-optional refs went unresolved before this fix and none after, with no ref becoming ambiguous. Only ControlCoordinator and GO2Connection are referenced by concrete class anywhere in the tree; every other ref goes through a *Spec, which already matched structurally and so accepted subclasses. GO2Connection carried the same latent trap for whoever subclassed it next.
mustafab0
requested review from
Dreamsorcerer,
leshy,
paul-nechifor and
spomichter
as code owners
August 8, 2026 23:01
❌ 1 Tests Failed:
View the top 1 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
leshy
approved these changes
Aug 8, 2026
leshy
left a comment
Member
There was a problem hiding this comment.
Approving, but good for @jeff-hykin to look a this and confirm
jeff-hykin
reviewed
Aug 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A module can declare that it depends on another module by naming that module's class. The wiring layer matched that dependency by exact class. If a deployment swapped in a subclass, the match failed and the dependency was quietly set to
nothing at all.
Solution
Match with
issubclass, which is what declaring the dependency means.Only two modules in the tree are depended on by concrete class this way:
ControlCoordinatorandGO2Connection. Every other dependency is declaredthrough a
*Spec, which already matched structurally and so accepted subclasses.That is why this never surfaced before: no deployment had yet subclassed either
one in a blueprint that also contained a module depending on it.
Breaking Changes
None.
How to Test
pytest dimos/core/coordination/test_module_coordinator.py— 48 pass.test_module_ref_direct_accepts_a_subclass_provideris the regressionguard; revert the one-line change and it fails, which is how it was verified.
pytest dimos/core— one unrelated pre-existing failure,test_module_reloading,which fails identically on a clean
maincheckout.EOF
gh pr create --repo dimensionalOS/dimos --base main --head core-module-ref-subclass-match --title "fix(core): match module refs by IS-A so a subclass provider resolves" --body-file /tmp/claude-1001/-home-mustafa-dimos/2e38385f-08b5-4bd8-ac72-4fd29234694d/scratchpad/core-pr.md 2>&1 | tail -3