Repository navigation
Resolve a registry name to its own class, never a subclass that inherits it - #213
Merged
Merged
Conversation
yichao-liang
force-pushed
the
env-name-registered-class
branch
from
October 9, 2026 07:04
d7bcb44 to
c819144
Compare
…its it
create_new_env, create_approach and the other name registries built the
first concrete subclass whose get_name() matched, in the order of
get_all_subclasses, which is a set: its order follows class hashes and
differs from process to process. Every test shard imports the whole
suite at collection, and test modules subclass real envs, approaches and
STRIPS learners without renaming them (_ExposedBoilEnv in
test_skill_factories_integration, _MockNSRTReinforcementLearningApproach,
...), so in some shard processes create_new_env("pybullet_boil",
do_cache=False) built the test's _ExposedBoilEnv, which registers itself
in the env cache on construction. When a later call in the same test
built the real class instead, get_or_create_env returned the disposed
test env, and test_preflight_audit's second pass failed with "Not
connected to physics server".
utils.get_registered_subclass resolves a name to the most general
concrete class that claims it and raises when unrelated classes claim
one name. Every registry that scanned get_all_subclasses by name uses it.
yichao-liang
force-pushed
the
env-name-registered-class
branch
from
October 9, 2026 08:04
c819144 to
1632449
Compare
This was referenced Oct 9, 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.
Why
A local CI replay of the from-assets belief branch failed one test in shard 3, a test that passes on its own and touches nothing the branch changed:
create_new_env,create_approachand the other name registries built the first concrete subclass whoseget_name()matched, in the order ofutils.get_all_subclasses.That function returns a set, so its order follows class hashes and changes from process to process.
Every shard imports the whole suite at collection, and several test modules subclass a real class without renaming it.
Importing every test module gives 12 such names:
pybullet_boil(two_ExposedBoilEnvs),pybullet_coffee,pybullet_fan,pybullet_grow,pybullet_blocks,pybullet_cover,tools,pybullet_balloons_residual_model;nsrt_rl,gnn_metacontroller(test mocks);backchaining(a test mock);dummy, claimed by two unrelated test classes.So in some processes
create_new_env("pybullet_boil", do_cache=False)builttest_skill_factories_integration._ExposedBoilEnv, which writes itself into the env cache on construction.In the failing test, the first pass cached a test env that the run then disposed.
The second pass built the real class, which does not touch the cache, so
get_or_create_envreturned the disposed env.What changes
utils.get_registered_subclass(base, name)resolves a name to the most general concrete subclass that claims it.It raises
ValueErrorwhen unrelated classes claim the same name, and returns None for an unknown name.get_all_subclassesby name uses it:Each registry keeps its own error for an unknown name.
RealSceneGeometryMixin's docstring no longer gives shadowingpybullet_dominoas its reason to stay out ofBaseEnv, since an intermediate class can no longer shadow it.The package itself has no shared names, so no production lookup changes.
Evidence
A probe imports
test_skill_factories_integrationthe way a shard's collection does, then callscreate_new_env("pybullet_boil", do_cache=False)in 8 fresh processes.On master, 5 of the 8 built
_ExposedBoilEnvand wrote it into the env cache.On this branch all 8 build
PyBulletBoilEnvand leave the cache alone.Tests
test_get_registered_subclasscovers an inherited name with the subclass listed first, an abstract named class with a concrete child, an unknown name and two unrelated claimants.test_env_creation_ignores_subclasses_that_inherit_the_namelists an instrumentedCoverEnvsubclass first and checks thatcreate_new_env("cover")still buildsCoverEnv. Both fail on master.static-type-checkingfails only with the two tenacity 9.2.1 errors that Keep mypy passing on tenacity 9.2's typed retry decorator #212 fixes; this branch needs a rebase after Keep mypy passing on tenacity 9.2's typed retry decorator #212 merges.🤖 Generated with Claude Code