Add initial implementation to add configuration for healthagent.#57
Open
aditigaur4 wants to merge 2 commits intomainfrom
Open
Add initial implementation to add configuration for healthagent.#57aditigaur4 wants to merge 2 commits intomainfrom
aditigaur4 wants to merge 2 commits intomainfrom
Conversation
Collaborator
aditigaur4
commented
May 5, 2026
- Add pyyaml to dependencies and defaults.yaml for default config
- Add a config module for loading/merging default and user config
- Allow healthmodule to initialize config
- Intialize config and pass it to all healthmodules.
- Install defaults.yaml
- Add health -C cli. show-config option shows the currently loaded config.
- Add pyyaml to dependencies and defaults.yaml for default config - Add a config module for loading/merging default and user config - Allow healthmodule to initialize config - Intialize config and pass it to all healthmodules. - Install defaults.yaml - Add health -C cli. show-config option shows the currently loaded config.
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an initial configuration system to healthagent, including packaged defaults, optional user overrides, and a CLI/API pathway to inspect the effective configuration, while plumbing per-module config dictionaries into all registered health modules.
Changes:
- Add packaged
defaults.yamlplus ahealthagent.configmodule to load defaults and merge/etc/healthagent/config.yamloverrides. - Initialize configuration during daemon startup, use it to enable/disable modules, and pass module-specific config into each
HealthModule. - Extend the
healthclient with--show-configto print the daemon’s effective config.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_config.py | Adds unit tests for deep_merge, load_config, and HealthModule config injection behavior. |
| pyproject.toml | Adds PyYAML dependency and includes defaults.yaml in package data. |
| healthagent/config.py | New config loader + deep merge implementation. |
| healthagent/defaults.yaml | Introduces shipped default configuration (modules list + per-module sections). |
| healthagent/healthagent.py | Loads config at startup, filters enabled modules, passes module config, and serves show_config. |
| healthagent/healthmodule.py | Extends base module constructor to accept/store config. |
| healthagent/gpu.py | Updates constructor signature to accept config and forwards it to base. |
| healthagent/network.py | Updates constructor signature to accept config and forwards it to base. |
| healthagent/async_systemd.py | Updates constructor signature to accept config and forwards it to base. |
| healthagent/kmsg.py | Updates constructor signature to accept config and forwards it to base. |
| healthagent/process.py | Updates constructor signature to accept config and forwards it to base. |
| healthagent/client.py | Adds -C/--show-config and YAML output formatting for effective config. |
| healthagent/install.py | Copies packaged defaults.yaml into /etc/healthagent/ during install. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+205
to
+206
| module_config = cls.config.get(module_name, {}) | ||
| instance_obj = instance(reporter=reporter, config=module_config) |
Comment on lines
+9
to
+14
| # Copy defaults.yaml to /etc/healthagent/ for operator reference | ||
| defaults_src = importlib.resources.files("healthagent").joinpath("defaults.yaml") | ||
| defaults_dst = os.path.join(etc_dir, "defaults.yaml") | ||
| with importlib.resources.as_file(defaults_src) as src_path: | ||
| shutil.copy2(str(src_path), defaults_dst) | ||
| print(f"Copied defaults.yaml to {defaults_dst}") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.