Skip to content

Conversation

@liammcalpineduckietown
Copy link
Contributor

@liammcalpineduckietown liammcalpineduckietown commented Dec 1, 2025

This pull request introduces several improvements to how command set configurations are imported and refreshed within the shell, focusing on better module loading, improved error handling, and robustness against failed command set loads. The most important changes include switching to direct file-based module loading to avoid caching issues, ensuring proper refresh of command sets after download, and handling cases where command sets fail to load commands.

Improvements to command set configuration loading:

  • Changed import_commandset_configuration to load configuration modules directly from their file path using importlib.util.spec_from_file_location, assigning each a unique module name to prevent caching issues between different command sets.
  • Populated the path attribute on the default configuration when a custom configuration is not found, ensuring consistency.

Robustness and error handling:

  • In CommandSet.refresh, configuration is now reloaded using the improved importer, and command loading is more robust by defaulting to an empty dictionary if no commands are found.
  • In CommandSet.download, the refresh step is moved outside the try/except block to ensure the command set is always refreshed after a successful clone, regardless of exceptions during cloning.
  • In Shell.load_commands, command sets with no commands (e.g., those that failed to load) are now skipped, preventing errors during command loading.

@liammcalpineduckietown liammcalpineduckietown changed the title fix: enhance command set refresh and configuration loading DTSW-7453-dts-commands-update-fails-at-first-run Dec 1, 2025
@liammcalpineduckietown liammcalpineduckietown merged commit ad99960 into main Dec 2, 2025
4 of 5 checks passed
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.

3 participants