Comparing specs using `==` is incorrect sometimes
Opened this issue · 0 comments
We currently use ==
in to_registry() on many spec classes such as here in ComponentRun.to_registry()
:
agentos/agentos/component_run.py
Lines 120 to 125 in c59e476
This can be wrong because currently some fields in specs can be omitted when their values are None. E.g., the WebRegistry always returns an agent
and environment
field for ComponentRun
specs, even when the value of those attributes is None
.
Essentially, we currently allow any optional spec field to be either omitted from the spec OR included and set to None.
Since {x: None} == {}
returns False in Python (and rightfully so!) we need a smarter way of testing specs for equality.
We should be using a hash of the specs, and in fact the identifier should probably be the hash for all spec types (as it is currently for ArgumentSet
specs). This should be addressed by #253, which will probably be done as part of #250.