feat(cli): add copaw health command for system diagnostics#1567
feat(cli): add copaw health command for system diagnostics#1567Zhangfengmo wants to merge 4 commits intoagentscope-ai:mainfrom
Conversation
Add HealthChecker class with 10 system checks: - config files, LLM providers, skills, dependencies - environment tools, disk space, channel credentials - MCP clients, required files, directory permissions Add ConfigValidator for semantic validation of config.json including channel, MCP client, and agent settings checks.
Add `copaw health` command that runs comprehensive health checks and configuration validation with human-readable and JSON output. Integrate health check into `copaw init` post-initialization step so users get immediate feedback on their setup. Options: --verbose / -v Show detailed check information --json Output results in JSON format
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the diagnostic capabilities of the CoPaw CLI by introducing a dedicated health command. It allows users to quickly identify and troubleshoot common setup and configuration issues, ensuring a smoother initial experience and easier maintenance. The new command provides detailed insights into various system components and configurations, offering clear suggestions for resolving any detected problems. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a valuable copaw health command for system diagnostics, which is a great addition for user support and debugging. The implementation is comprehensive, covering a wide range of system checks and configuration validations. My review focuses on improving the efficiency of the health checks by avoiding redundant operations and enhancing code maintainability with better type hinting. The core logic is sound, and these changes will make the new feature more robust and performant.
- Add logger.exception() to all broad except blocks in health.py so full tracebacks are preserved in logs (config_files, providers, channels, mcp_clients checks) - Change check_providers/channels/mcp_clients failure status from DEGRADED to UNHEALTHY for more accurate severity reporting - Narrow check_disk_space to catch OSError only instead of Exception - Add timeout=30 to future.result() in _test_llm_connection to prevent indefinite hang when LLM endpoint is unreachable - Wrap ConfigValidator() construction in try/except to show user-friendly error instead of raw Python traceback - Add if-guard for issue.suggestion in errors display branch - Remove redundant variable assignment in utils.load_config
🔍 Self Code Review — Findings & Fixes AppliedSummaryThree specialized review agents (code-reviewer, silent-failure-hunter, pr-test-analyzer) analyzed this PR. All critical and important issues have been addressed in the latest commit ( Fixes Applied✅ Critical Issues (all resolved)
✅ Important Issues (all resolved)
Known Limitations (out of scope for this PR)
|
Add explicit type annotations to the two private helper functions in health_cmd.py for improved readability and static analysis. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary
Add
copaw healthcommand that performs comprehensive system health checks and configuration validation, helping users quickly diagnose setup issues.Changes
src/copaw/config/health.py—HealthCheckerwith 10 system checks:src/copaw/config/validator.py—ConfigValidatorfor semantic validation ofconfig.json:src/copaw/cli/health_cmd.py— CLI command with human-readable and JSON outputsrc/copaw/cli/main.py— Registerhealthcommandsrc/copaw/cli/init_cmd.py— Run health check automatically aftercopaw initUsage
Example Output
Test Plan
copaw health— basic outputcopaw health --verbose— detailed outputcopaw health --json | python -m json.tool— valid JSON