Skip to content

Move ErrorMessage to microsoft-agents-activity to resolve circular dependency#240

Merged
cleemullins merged 2 commits intomainfrom
copilot/move-error-message-file
Nov 12, 2025
Merged

Move ErrorMessage to microsoft-agents-activity to resolve circular dependency#240
cleemullins merged 2 commits intomainfrom
copilot/move-error-message-file

Conversation

Copy link
Contributor

Copilot AI commented Nov 12, 2025

microsoft-agents-hosting-core depends on microsoft-agents-activity, but ErrorMessage was located in hosting-core and imported by activity, creating a circular dependency.

Changes

  • Moved error_message.py from microsoft-agents-hosting-core to microsoft-agents-activity
  • Updated imports across 6 packages (authentication-msal, copilotstudio-client, storage-blob, storage-cosmos, hosting-teams, hosting-core)
  • Maintained backward compatibility via re-export in hosting-core's __init__.py

Import paths

# Canonical (recommended)
from microsoft_agents.activity.errors import ErrorMessage

# Backward compatible (still works)
from microsoft_agents.hosting.core.errors import ErrorMessage

Both imports resolve to the same class. No breaking changes.

Original prompt

This section details on the original issue you should resolve

<issue_title>Move ErrorMessage to microsoft-agents-activity</issue_title>
<issue_description>Move the ErrorMessage from to microsoft-agents-activity.

The current ErrorMessage file is found here:
https://github.com/microsoft/Agents-for-python/blob/10efb95e18529aaa3a1927e10add95f93683658a/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/errors/error_message.py

This should be moved to the location:
https://github.com/microsoft/Agents-for-python/tree/10efb95e18529aaa3a1927e10add95f93683658a/libraries/microsoft-agents-activity/microsoft_agents/activity/errors

The existing location is causing circular dependency issues across other packages.

Analyze where this is used, and update all necessary imports and tests.

</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

- Moved error_message.py from microsoft-agents-hosting-core to microsoft-agents-activity
- Updated all package imports to use new location (microsoft_agents.activity.errors)
- Maintained backward compatibility via re-export in hosting-core
- Verified all existing tests pass
- Resolved circular dependency (hosting-core no longer depends on activity for ErrorMessage)

Co-authored-by: cleemullins <1165321+cleemullins@users.noreply.github.com>
Copilot AI changed the title [WIP] Move ErrorMessage to microsoft-agents-activity Move ErrorMessage to microsoft-agents-activity to resolve circular dependency Nov 12, 2025
Copilot AI requested a review from cleemullins November 12, 2025 20:16
@cleemullins cleemullins marked this pull request as ready for review November 12, 2025 20:20
@cleemullins cleemullins requested a review from a team as a code owner November 12, 2025 20:20
Copilot AI review requested due to automatic review settings November 12, 2025 20:20
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR successfully resolves a circular dependency issue by moving the ErrorMessage class from microsoft-agents-hosting-core to microsoft-agents-activity, where it logically belongs as a lower-level dependency.

Key Changes:

  • Relocated error_message.py from hosting-core to the activity package
  • Updated imports across 6 packages to use the new canonical location
  • Maintained backward compatibility by re-exporting ErrorMessage from hosting-core's __init__.py

Reviewed Changes

Copilot reviewed 14 out of 15 changed files in this pull request and generated no comments.

Show a summary per file
File Description
libraries/microsoft-agents-activity/microsoft_agents/activity/errors/error_message.py New location for ErrorMessage class implementation
libraries/microsoft-agents-activity/microsoft_agents/activity/errors/__init__.py Updated to import ErrorMessage locally and export it
libraries/microsoft-agents-activity/microsoft_agents/activity/errors/error_resources.py Changed to use local import of ErrorMessage
libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/errors/__init__.py Re-exports ErrorMessage from activity package for backward compatibility
libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/errors/error_resources.py Updated to import ErrorMessage from activity package
libraries/microsoft-agents-authentication-msal/microsoft_agents/authentication/msal/errors/__init__.py Updated import path to canonical location
libraries/microsoft-agents-authentication-msal/microsoft_agents/authentication/msal/errors/error_resources.py Updated import path to canonical location
libraries/microsoft-agents-copilotstudio-client/microsoft_agents/copilotstudio/client/errors/__init__.py Updated import path to canonical location
libraries/microsoft-agents-copilotstudio-client/microsoft_agents/copilotstudio/client/errors/error_resources.py Updated import path to canonical location
libraries/microsoft-agents-storage-blob/microsoft_agents/storage/blob/errors/__init__.py Updated import path to canonical location
libraries/microsoft-agents-storage-blob/microsoft_agents/storage/blob/errors/error_resources.py Updated import path to canonical location
libraries/microsoft-agents-storage-cosmos/microsoft_agents/storage/cosmos/errors/__init__.py Updated import path to canonical location
libraries/microsoft-agents-storage-cosmos/microsoft_agents/storage/cosmos/errors/error_resources.py Updated import path to canonical location
libraries/microsoft-agents-hosting-teams/microsoft_agents/hosting/teams/errors/__init__.py Updated import path to canonical location
libraries/microsoft-agents-hosting-teams/microsoft_agents/hosting/teams/errors/error_resources.py Updated import path to canonical location

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@cleemullins cleemullins merged commit d75d0cf into main Nov 12, 2025
16 checks passed
@cleemullins cleemullins deleted the copilot/move-error-message-file branch November 12, 2025 20:36
Copilot AI mentioned this pull request Dec 2, 2025
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.

Move ErrorMessage to microsoft-agents-activity

3 participants

Comments