Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: runtime requirements #628

Merged
merged 1 commit into from
Dec 9, 2024
Merged

fix: runtime requirements #628

merged 1 commit into from
Dec 9, 2024

Conversation

JarbasAl
Copy link
Member

@JarbasAl JarbasAl commented Dec 9, 2024

runtime requirements class property was not workign properly due to the class not being passed to the skill loader

all skills were considered to need internet, offline skills were not loading early as intended!

Summary by CodeRabbit

  • New Features

    • Enhanced plugin skill loading process by allowing specification of skill class during loading.
  • Bug Fixes

    • Improved management of skill dependencies and configurations through updated loading methods.

runtime requirements class property was not workign properly due to the class not being passed to the skill loader

all skills were considered to need internet, offline skills were not loading early as intended!
Copy link

coderabbitai bot commented Dec 9, 2024

Walkthrough

The changes in this pull request focus on the SkillManager class within ovos_core/skill_manager.py. The _get_plugin_skill_loader method has been updated to include an additional skill_class parameter, which is now utilized in the load_plugin_skills method. The _load_plugin_skill method has also been modified to ensure the correct assignment of the skill class to the loader instance. These enhancements aim to improve the management of plugin skills without altering the overall control flow of the skill activation and error handling processes.

Changes

File Change Summary
ovos_core/skill_manager.py Updated _get_plugin_skill_loader method to accept a skill_class parameter. Modified load_plugin_skills to pass skill_class to the loader. Adjusted _load_plugin_skill to utilize the updated loader method.

Possibly related PRs

  • fix:usage without skills installed #555: This PR modifies the SkillManager class in ovos_core/skill_manager.py, enhancing the skill loading process, which is related to the changes made in the main PR.

Suggested labels

fix

Suggested reviewers

  • goldyfruit

Poem

🐰 In the meadow where skills do play,
A new class joins the fray today.
With plugins loaded, oh what a sight,
Skills dancing freely, pure delight!
Hopping along, we cheer and sway,
For better management is here to stay! 🌼


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Experiment)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

codecov bot commented Dec 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 72.69%. Comparing base (23f0bab) to head (87e4efa).
Report is 136 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #628      +/-   ##
==========================================
- Coverage   75.33%   72.69%   -2.65%     
==========================================
  Files          15       15              
  Lines        3094     1553    -1541     
==========================================
- Hits         2331     1129    -1202     
+ Misses        763      424     -339     
Flag Coverage Δ
end2end 55.69% <85.71%> (?)
unittests 49.32% <85.71%> (-26.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@github-actions github-actions bot added fix and removed fix labels Dec 9, 2024
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (2)
ovos_core/skill_manager.py (2)

305-306: Fix inconsistent indentation

The indentation uses a mix of spaces and tabs. Maintain consistent indentation throughout the codebase.

-                skill_loader = self._get_plugin_skill_loader(skill_id, init_bus=False,
-                                                             skill_class=plug)
+                skill_loader = self._get_plugin_skill_loader(
+                    skill_id, 
+                    init_bus=False,
+                    skill_class=plug
+                )

Line range hint 331-347: Update docstring to include new parameter

The docstring should document the new skill_class parameter.

     def _get_plugin_skill_loader(self, skill_id, init_bus=True, skill_class=None):
         """Get a plugin skill loader.
 
         Args:
             skill_id (str): ID of the skill.
             init_bus (bool): Whether to initialize the internal skill bus.
+            skill_class: The skill class to be loaded.
 
         Returns:
             PluginSkillLoader: Plugin skill loader instance.
         """
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 88b094d and 87e4efa.

📒 Files selected for processing (1)
  • ovos_core/skill_manager.py (4 hunks)
🔇 Additional comments (2)
ovos_core/skill_manager.py (2)

359-359: LGTM!

The change correctly passes the skill class to the loader, completing the fix for runtime requirements.


Line range hint 305-359: Verify impact on existing skills

The changes to runtime requirements handling might affect how existing skills are loaded. Let's verify that no skills are incorrectly categorized.

✅ Verification successful

Runtime requirements implementation verified as correct

The code changes are properly implemented and the impact on existing skills is well-handled. The implementation:

  • Correctly checks runtime requirements before loading skills
  • Properly handles network/internet dependencies during skill loading
  • Includes appropriate unload behavior when network/internet becomes unavailable
  • Maintains consistent behavior between plugin skills and directory-based skills

The changes are safe and maintain the expected behavior for both new and existing skills.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for skills that might be affected by the runtime requirements change

# Find all skill plugins and their requirements
echo "Checking skill plugins for runtime requirements..."
ast-grep --pattern 'class $SKILL_CLASS {
  $$$
  @property
  def runtime_requirements(self):
    $$$
}'

# Check for any skills reporting internet requirements
echo "Checking for skills with internet requirements..."
rg -l "requires_internet" -g "*.py"

# Check for any skills reporting network requirements
echo "Checking for skills with network requirements..."
rg -l "requires_network" -g "*.py"

Length of output: 557


Script:

#!/bin/bash
# Let's examine the actual implementation of runtime requirements in skill_manager.py
echo "Checking runtime requirements implementation..."
rg "runtime_requirements" -A 10 -B 10 ovos_core/skill_manager.py

# Let's also check for any test files that might validate this behavior
echo "Checking test files for runtime requirements validation..."
fd "test.*\.py" --exec rg "runtime_requirements|requires_internet|requires_network" {}

Length of output: 4869

@JarbasAl JarbasAl merged commit 1051dab into dev Dec 9, 2024
7 of 8 checks passed
@JarbasAl JarbasAl deleted the fix_runtime_reqs branch December 9, 2024 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant