Some dependencies don't show up as a step's dependencies when they should
I think this happens when a dependency is not directly in a step's `kwargs`, but is somewhere nested in there.
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 25c101f..3729100 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -19,12 +19,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 - `StepGraph` now prints itself in a readable way.
 - Tango now automatically detects when it's running under a debugger, and disables multicore support accordingly. Many debuggers can't properly follow sub-processes, so this is a convenience for people who love debuggers.
 
-### Fixed
-
-- Fixed bug that mistakenly disallowed fully-qualified names containing `"_"` (underscores) in the config.
-- Some unrelated objects might unexpectedly hash to the same thing. This is now fixed.
-- Fixed bug in `FromParams` where `**kwargs` might be passed down to the constructors of arguments.
-
 ### Changed
 
 - Renamed `click_logger` to `cli_logger`, and we now use [rich](https://github.com/Textualize/rich)'s logging `Handler` as the default handler, which means prettier output, better tracebacks, and you can use rich's markup syntax with the `cli_logger` to easily add style to text.
@@ -32,6 +26,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 - `Executor.execute_step_graph()` now attempts to execute all steps and summarizes success/failures.
 - Upgraded PyTorch version in `tango` Docker image to latest `v1.11.0+cu113`.
 
+### Fixed
+
+- Fixed bug that mistakenly disallowed fully-qualified names containing `"_"` (underscores) in the config.
+- Fixed bug where `TorchTrainStep` working directory would be left in an unrecoverable state if training failed after saving the final model weights.
+- Fixed bug in `FromParams` where `**kwargs` might be passed down to the constructors of arguments.
+- Fixed bug in the way dependencies are tracked between steps
+
 
 ## [v0.6.0](https://github.com/allenai/tango/releases/tag/v0.6.0) - 2022-02-25
 
diff --git a/tango/step.py b/tango/step.py
index 467f074..d75b833 100644
--- a/tango/step.py
+++ b/tango/step.py
@@ -562,7 +562,7 @@ class Step(Registrable, Generic[T]):
                 yield from dependencies_internal(o.kwargs)
             elif isinstance(o, str):
                 return  # Confusingly, str is an Iterable of itself, resulting in infinite recursion.
-            elif isinstance(o, dict):
+            elif isinstance(o, (dict, Params)):
                 yield from dependencies_internal(o.values())
             elif isinstance(o, Iterable):
                 yield from itertools.chain(*(dependencies_internal(i) for i in o))
diff --git a/tango/step_graph.py b/tango/step_graph.py
index d72270c..973946f 100644
--- a/tango/step_graph.py
+++ b/tango/step_graph.py
@@ -1,5 +1,5 @@
 import logging
-from typing import Any, Dict, Iterator, List, Mapping, Set, Type
+from typing import Any, Dict, Iterator, List, Mapping, Set, Type, Union
 
 from tango.common import PathOrStr
 from tango.common.exceptions import ConfigurationError
@@ -139,7 +139,7 @@ class StepGraph(Mapping[str, Step]):
         return StepGraph(step_dict)
 
     @staticmethod
-    def _dict_is_ref(d: dict) -> bool:
+    def _dict_is_ref(d: Union[dict, Params]) -> bool:
         keys = set(d.keys())
         if keys == {"ref"}:
             return True
@@ -153,7 +153,7 @@ class StepGraph(Mapping[str, Step]):
         if isinstance(o, (list, tuple, set)):
             for item in o:
                 dependencies = dependencies | cls._find_step_dependencies(item)
-        elif isinstance(o, dict):
+        elif isinstance(o, (dict, Params)):
             if cls._dict_is_ref(o):
                 dependencies.add(o["ref"])
             else:
@@ -167,7 +167,7 @@ class StepGraph(Mapping[str, Step]):
     def _replace_step_dependencies(cls, o: Any, existing_steps: Mapping[str, Step]) -> Any:
         if isinstance(o, (list, tuple, set)):
             return o.__class__(cls._replace_step_dependencies(i, existing_steps) for i in o)
-        elif isinstance(o, dict):
+        elif isinstance(o, (dict, Params)):
             if cls._dict_is_ref(o):
                 return existing_steps[o["ref"]]
             else:
diff --git a/tests/step_test.py b/tests/step_test.py
index 54920ef..c8ebd47 100644
--- a/tests/step_test.py
+++ b/tests/step_test.py
@@ -4,6 +4,8 @@ from typing import Any, Dict, Mapping, MutableMapping
 import pytest
 
 import test_fixtures.package.steps  # noqa: F401
+from tango import StepGraph
+from tango.common import Params, Registrable
 from tango.common.from_params import FromParams
 from tango.common.testing import TangoTestCase
 from tango.step import Step
@@ -74,3 +76,62 @@ class TestStep(TangoTestCase):
 
         assert explicit.unique_id == implicit.unique_id
         assert explicit.result() == implicit.result()
+
+    def test_steps_in_params(self):
+        class Widget(Registrable):
+            def __init__(self, x: int):
+                self.x = x
+
+        @Widget.register("gizmo")
+        class GizmoWidget(Widget):
+            def __init__(self, x: int):
+                super().__init__(x * x)
+
+        @Step.register("consumer")
+        class WidgetConsumerStep(Step):
+            def run(self, widget: Widget):  # type: ignore
+                return widget.x
+
+        @Step.register("producer")
+        class WidgetProducerStep(Step):
+            def run(self, x: int) -> Widget:  # type: ignore
+                return GizmoWidget(x)
+
+        config = {
+            "widget_producer": Params({"type": "producer", "x": 4}),
+            "widget_consumer": Params(
+                {"type": "consumer", "widget": {"type": "ref", "ref": "widget_producer"}}
+            ),
+        }
+
+        sg = StepGraph.from_params(config)
+        assert len(sg["widget_consumer"].dependencies) > 0
+
+        class WidgetHolder(Registrable):
+            def __init__(self, widget: Widget):
+                self.widget = widget
+
+        @WidgetHolder.register("gizmo")
+        class GizmoWidgetHolder(WidgetHolder):
+            def __init__(self, gizmo: GizmoWidget):
+                super().__init__(gizmo)
+
+        @Step.register("holder_consumer")
+        class WidgetHolderConsumerStep(Step):
+            def run(self, widget_holder: WidgetHolder) -> int:  # type: ignore
+                return widget_holder.widget.x
+
+        config = {
+            "widget_producer": Params({"type": "producer", "x": 4}),
+            "holder_consumer": Params(
+                {
+                    "type": "holder_consumer",
+                    "widget_holder": {
+                        "type": "gizmo",
+                        "gizmo": {"type": "ref", "ref": "widget_producer"},
+                    },
+                }
+            ),
+        }
+        sg = StepGraph.from_params(config)
+        assert len(sg["holder_consumer"].dependencies) > 0
['tango/step.py', 'tests/step_test.py', 'tango/step_graph.py', 'CHANGELOG.md']