[AAASM-5056] 🐛 (sdk): Export PolicyViolationError & OpTerminatedError#301
Conversation
Both classes exist in agent_assembly.exceptions and are documented across several docs pages as top-level imports, but were absent from the __init__ lazy-export tables, so `from agent_assembly import PolicyViolationError` (and OpTerminatedError) raised ImportError. Wire them through the lazy-export machinery exactly like the sibling ToolExecutionBlockedError export. Refs AAASM-5056 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…r exports Regression test for AAASM-5056: asserts both classes import from the package top level, appear in __all__, and resolve to the same objects as in agent_assembly.exceptions. Refs AAASM-5056 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
🔎 Claude Code review — evidence for maintainerThis is evidence only — not an approval, and not self-merged. Posting local verification so a Pioneer-team reviewer can make the merge decision. Scope — 2 files, +21 lines, no deletions:
Before → after (the reported defect): Local verification (all green):
Side effects: none. Both classes already existed in Jira: https://lightning-dust-mite.atlassian.net/browse/AAASM-5056 |
| @@ -1,5 +1,7 @@ | |||
| from __future__ import annotations | |||
|
|
|||
| import agent_assembly | |||
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
✅ Claude Code review — READY (maintainer evidence)
Verdict: scope-complete, MERGEABLE. Evidence only — not an approval, not self-merged. |



Description
agent_assembly.exceptions.PolicyViolationErrorandOpTerminatedErrorare documented across several docs pages as top-level imports, but they were never wired intoagent_assembly/__init__.py's lazy-export tables (_LAZY_EXPORTS/_ALWAYS_EXPORTED/__all__). As a result the documented import raisedImportErrorat runtime:Both classes already exist in
agent_assembly.exceptions— only the package-level re-export was missing. This is the same defect class as AAASM-4987.Fix: wire both symbols through the existing lazy-export machinery exactly like the sibling
ToolExecutionBlockedErrorexport — added to_LAZY_EXPORTS(mapping toagent_assembly.exceptions),_ALWAYS_EXPORTED(which feeds__all__), and theTYPE_CHECKINGre-export block. No behavior change beyond making the documented import resolve.After the fix:
Type of Change
Breaking Changes
Related Issues
Testing
Added a regression test in
test/unit/test_exceptions.pyasserting both classes import from the package top level, appear in__all__, and resolve to the same objects as inagent_assembly.exceptions.uv run pytest→ 1208 passed, 15 skippeduv run ruff check .cleanuv run mypy --ignore-missing-imports(as CI runs it) → No issues foundChecklist
🤖 Generated with Claude Code