Skip to content

fix: prevent additional_mounts accumulating across multiple run() calls#159

Open
amitkuma-1234 wants to merge 1 commit into
microsoft:mainfrom
amitkuma-1234:fix/issue-115-additional-mounts
Open

fix: prevent additional_mounts accumulating across multiple run() calls#159
amitkuma-1234 wants to merge 1 commit into
microsoft:mainfrom
amitkuma-1234:fix/issue-115-additional-mounts

Conversation

@amitkuma-1234

Copy link
Copy Markdown

Problem

When bot.run() is called multiple times, additional_mounts
accumulate in self.mounted list and are never cleared.
This causes duplicate mounts on subsequent run() calls.

Fixes #115

Fix

Added a check in _mount_additional() to only append
a mount if it doesn't already exist in self.mounted.

Testing

Call bot.run() multiple times and verify self.mounted
does not contain duplicate entries.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 aims to prevent additional_mounts from accumulating duplicate entries in self.mounted when MicroBot.run() is called multiple times, avoiding repeated mounts/copies on subsequent runs.

Changes:

  • Add a guard in _mount_additional() to only append/copy a mount if it is not already present in self.mounted.

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

Comment thread src/microbots/MicroBot.py
Comment on lines +316 to +320
def _mount_additional(self, mount: Mount):
if mount.mount_type != MountType.COPY:
logger.error(
"%s Only COPY mount type is supported for additional mounts for now",
LogLevelEmoji.ERROR,
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.

additional_mounts accumulate in self.mounted across multiple run() calls

2 participants