Skip to content

refactor(runtime): extract shared exceptions from watchdog.errors - #84

Open
LicsDaSheng wants to merge 1 commit into
PhyAgentOS-dev:previewfrom
LicsDaSheng:issue-83-runtime-errors
Open

refactor(runtime): extract shared exceptions from watchdog.errors#84
LicsDaSheng wants to merge 1 commit into
PhyAgentOS-dev:previewfrom
LicsDaSheng:issue-83-runtime-errors

Conversation

@LicsDaSheng

Copy link
Copy Markdown
Contributor

Summary

Resolves #83 — the dependency inversion where lower-level runtime modules (Target, Policy, Adapter, Perception, Communication, Perception Plugins) imported shared exception types from PhyAgentOS.runtime.watchdog.errors, the Session execution orchestration layer.

Changes

  1. New neutral base modulePhyAgentOS/runtime/errors.py now hosts the shared exception hierarchy (RuntimeErrorBase, SchemaValidationError, Target*Error, AdapterError, Policy*Error, SessionTimeoutError) plus the error_code_for / terminal_status_for failure mapping helpers, moved verbatim from the watchdog package.
  2. Compatibility layerPhyAgentOS/runtime/watchdog/errors.py becomes a pure re-export of PhyAgentOS.runtime.errors, so existing imports keep working unchanged.
  3. Migrated 37 lower-level modules across targets / policy / adapters / perception / communication / perception plugins / skillruntime / sessions to import from PhyAgentOS.runtime.errors. The watchdog package internals, CLI, agent, scripts, and preflight keep their (correct-direction) dependencies on the orchestration layer.

Testing

  • New TDD test suite tests/runtime/test_runtime_errors.py (22 cases): exception hierarchy, error_code_for mapping incl. most-specific-subclass precedence, terminal_status_for mapping, and identity assertions that watchdog.errors re-exports the same objects.
  • Full suite: 28 passed (22 new + 6 existing test_session_runner_dispatch.py, which itself exercises the compatibility layer).
  • ruff clean (only a pre-existing N806 in lerobot_pi0_server.py remains, unrelated to this change); compileall passes.
  • Note: tests/runtime/test_piper_dual_arm_builtin.py fails collection on preview because it references a module (piper_dual_arm) that does not exist in this branch — pre-existing issue, unrelated to this change.

Closes #83

The exception hierarchy and failure mapping previously lived in
PhyAgentOS.runtime.watchdog.errors, forcing lower-level modules
(Target, Policy, Adapter, Perception, Communication, Perception
Plugins) to depend on the Session orchestration package — a
dependency inversion.

Move the shared types to a neutral PhyAgentOS.runtime.errors module;
watchdog.errors becomes a re-export compatibility layer so existing
imports keep working. Migrate all affected lower-level modules to
import from PhyAgentOS.runtime.errors.

Closes PhyAgentOS-dev#83
@LicsDaSheng
LicsDaSheng force-pushed the issue-83-runtime-errors branch from 77b006e to 4db85a7 Compare August 11, 2026 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inverted dependency: runtime submodules import shared exceptions from PhyAgentOS.runtime.watchdog.errors

1 participant