Skip to content

Fix excessive warnings during auto-profile creation in devcontainer - DTSW-7242#116

Merged
Tuxliri merged 3 commits intomainfrom
copilot/fix-19c35dbf-7f09-40ae-894c-5402e9612f62
Sep 26, 2025
Merged

Fix excessive warnings during auto-profile creation in devcontainer - DTSW-7242#116
Tuxliri merged 3 commits intomainfrom
copilot/fix-19c35dbf-7f09-40ae-894c-5402e9612f62

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Sep 26, 2025

  • Analyze the repository structure and understand the code flow
  • Reproduce the bug with devcontainer environment variables (DTSHELL_PROFILE="ente", DTSHELL_DISTRO="ente")
  • Identify the root cause: update_command_descriptions() is called during profile creation before command repositories are cloned
  • Identify that warnings occur in ShellProfile.__post_init__() when calling update_command_descriptions()
  • Understand that command sets are updated later in DTShell.__init__() after profile creation
  • Create focused tests to validate the fix
  • Implement minimal fix to prevent warning during auto-profile creation
  • Verify the fix works with devcontainer environment variables
  • Test that normal operation still works and no functionality is broken
  • Run code formatting with black to maintain project standardsReverted formatting changes
  • Address feedback: Undo unnecessary formatting changes to reduce code churn
  • Verify all test scenarios work correctly:
    • ✅ Auto-profile creation: No warning (noise reduced)
    • ✅ Directory exists but file missing: Warning shown (as expected)
    • ✅ Normal operation (file exists): No warning (preserved)

Summary

Fixed the excessive warnings during first setup of dts in devcontainer by making update_command_descriptions() more intelligent about when to show warnings. Updated to address reviewer feedback by removing unnecessary formatting changes while preserving the functional fix.

The fix distinguishes between:

  1. Expected case: Command set directory doesn't exist yet during auto-profile creation → Debug log only
  2. Problematic case: Command set directory exists but descriptions file is missing → Warning shown

This eliminates the noisy warning File '/path/to/command_descriptions.yaml' does not exist. during automatic profile creation while preserving diagnostic value for real issues.

Original prompt

Investigate this bug:

First setup of dts in devcontainer produces loads of warnings (environment variables for automatic profile creation are used)
@dts_profile_creation.log


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

- Modify update_command_descriptions() to only warn when command set directory exists but descriptions file is missing
- During auto-profile creation, command set directories don't exist yet, so skip warning and use debug log instead
- Preserves warning behavior for established command sets where missing files indicate real issues
- Reduces noise in devcontainer first setup logs while maintaining useful diagnostics

Co-authored-by: Tuxliri <3532595+Tuxliri@users.noreply.github.com>
Copilot AI changed the title [WIP] Investigate this bug: First setup of dts in devcontainer produces loads of warnings (environment variables for automatic profile creation are used) @dts_profile_creation.log Fix excessive warnings during auto-profile creation in devcontainer Sep 26, 2025
Copilot AI requested a review from Tuxliri September 26, 2025 10:07
Copy link
Copy Markdown
Contributor

@Tuxliri Tuxliri left a comment

Choose a reason for hiding this comment

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

@copilot Undo all the unnecessary formatting changes, they increase code churn.

Copy link
Copy Markdown
Contributor

@Tuxliri Tuxliri left a comment

Choose a reason for hiding this comment

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

@copilot undo formatting changes.

Comment on lines +20 to +35
from .constants import (
DUCKIETOWN_TOKEN_URL,
SHELL_LIB_DIR,
DEFAULT_COMMAND_SET_REPOSITORY,
DEFAULT_PROFILES_DIR,
DB_SECRETS,
DB_SECRETS_DOCKER,
DB_SETTINGS,
DB_USER_COMMAND_SETS_REPOSITORIES,
DB_PROFILES,
KNOWN_DISTRIBUTIONS,
SUGGESTED_DISTRIBUTION,
DB_UPDATES_CHECK,
EMBEDDED_COMMAND_SET_NAME,
Distro,
)
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.

@copilot undo these formatting changes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reverted in commit e4dd4b8. Import formatting is back to original style.

Comment on lines +38 to +47
from .utils import (
safe_pathname,
validator_token,
yellow_bold,
cli_style,
parse_version,
render_version,
indent_block,
DebugInfo,
)
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.

@copilot undo these formatting changes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reverted in commit e4dd4b8. Import formatting is back to original style.

Comment on lines +213 to +216
logger.info(
f"Loading profiles from '{profiles_dir}' as prescribed by the environment "
f"variable DTSHELL_PROFILES."
)
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.

@copilot undo these formatting changes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reverted in commit e4dd4b8. Logger.info formatting is back to original style.

Comment on lines +255 to +258
msg = (
f"Loading commands from '{commands_path}' as instructed by the environment variable "
f"DTSHELL_COMMANDS."
)
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.

@copilot undo these formatting changes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reverted in commit e4dd4b8. Formatting is back to original style.

Comment on lines +317 to +341
logger.warning(
f"\n -- WARNING\n\n"
+ indent_block(
f"Command set '{cs.name}' wants a Duckietown Shell v{render_version(vmin)}"
f" or newer. We are running v{render_version(vnow)}.\n"
f"You will need to upgrade your shell to be able to use this command "
f"set or switch to an older version of this command set.\n"
f"This command set will now be disabled."
)
+ f"\n\n -- WARNING\n"
)
self.command_sets.remove(cs)
# check max
if vmax is not None and vnow > vmax:
logger.warning(f"\n -- WARNING\n\n" +
indent_block(
f"Command set '{cs.name}' only supports Duckietown Shell up to "
f"v{render_version(vmax)}. We are running v{render_version(vnow)}.\n"
f"You will need to downgrade your shell to be able to use this command "
f"set or switch to a newer version of this command set.\n"
f"This command set will now be disabled."
) +
f"\n\n -- WARNING\n")
logger.warning(
f"\n -- WARNING\n\n"
+ indent_block(
f"Command set '{cs.name}' only supports Duckietown Shell up to "
f"v{render_version(vmax)}. We are running v{render_version(vnow)}.\n"
f"You will need to downgrade your shell to be able to use this command "
f"set or switch to a newer version of this command set.\n"
f"This command set will now be disabled."
)
+ f"\n\n -- WARNING\n"
)
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.

@copilot undo these formatting changes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reverted in commit e4dd4b8. All formatting changes in this section have been undone.

Comment on lines +383 to +387
logger.warning(
f"Your profile is set to use the distribution '{self.settings.distro}' but this "
f"is not in the list of known distributions. Known distributions are "
f"{list(KNOWN_DISTRIBUTIONS.keys())}"
)
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.

@copilot undo these formatting changes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reverted in commit e4dd4b8. Formatting is back to original style.

Comment on lines +433 to +435
logger.info(
f"Automatically selecting distribution '{d}' as it matches the profile name"
)
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.

@copilot undo these formatting changes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reverted in commit e4dd4b8. Formatting is back to original style.

- Reverted all black formatting changes from imports and other styling
- Kept only the functional change in update_command_descriptions() method
- Maintains the same fix for excessive warnings during auto-profile creation
- Reduces code churn by avoiding unnecessary style changes

Co-authored-by: Tuxliri <3532595+Tuxliri@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Sep 26, 2025

@copilot undo formatting changes.

Done in commit e4dd4b8. All formatting changes have been undone.

@copilot Undo all the unnecessary formatting changes, they increase code churn.

Addressed in commit e4dd4b8. Reverted all unnecessary formatting changes from black while preserving only the functional fix in update_command_descriptions().

Copilot AI requested a review from Tuxliri September 26, 2025 12:07
@Tuxliri Tuxliri requested review from liammcalpineduckietown and removed request for Tuxliri September 26, 2025 12:35
@Tuxliri Tuxliri changed the title Fix excessive warnings during auto-profile creation in devcontainer Fix excessive warnings during auto-profile creation in devcontainer - DTSW-7242 Sep 26, 2025
@Tuxliri Tuxliri marked this pull request as ready for review September 26, 2025 12:56
@Tuxliri Tuxliri merged commit 875e595 into main Sep 26, 2025
2 of 3 checks passed
@Tuxliri Tuxliri deleted the copilot/fix-19c35dbf-7f09-40ae-894c-5402e9612f62 branch September 26, 2025 12:56
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