-
Notifications
You must be signed in to change notification settings - Fork 309
fix: add diagnostic warnings for config loading failures #100
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
base: master
Are you sure you want to change the base?
fix: add diagnostic warnings for config loading failures #100
Conversation
📝 WalkthroughWalkthroughAdds module-level logging and extensive warning-based validation to org and project config loaders in Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
PR Review SummaryVerdict: APPROVE (after resolving conflicts) Risk Level: LOW Security Analysis
Code Quality
Test Coverage
Action RequiredPlease resolve the merge conflicts with master before this can be merged. Optional Improvements
def test_empty_command_name_rejected(self):
config_path = self.project_dir / ".autocoder" / "allowed_commands.yaml"
config_path.write_text('version: 1\ncommands:\n - name: ""\n')
result = load_project_commands(self.project_dir)
self.assertIsNone(result)
Overall this is a quality improvement that adds valuable diagnostic information for users debugging config loading issues. |
When config files have errors, users had no way to know why their settings weren't being applied. Added logging.warning() calls to diagnose: - Empty config files - Missing 'version' field - Invalid structure (not a dict) - Invalid command entries - Exceeding 100 command limit - YAML parse errors - File read errors Also added .resolve() to project path to handle symlinks correctly. Fixes: leonvanzyl#91 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
33640fc to
b8e03de
Compare
There was a problem hiding this 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
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
security.py (2)
492-506: Missing diagnostic warnings forpkill_processesvalidation failures.The
pkill_processesvalidation returnsNonesilently on failures (non-list type, non-string entries, invalid process names), which is inconsistent with other validation in this function that logs warnings. Per the PR objective of providing visibility into config loading failures, these should also log warnings.Proposed fix to add missing warnings
# Validate pkill_processes if present if "pkill_processes" in config: processes = config["pkill_processes"] if not isinstance(processes, list): + logger.warning(f"Org config at {config_path}: 'pkill_processes' must be a list") return None # Normalize and validate each process name against safe pattern normalized = [] - for proc in processes: + for i, proc in enumerate(processes): if not isinstance(proc, str): + logger.warning(f"Org config at {config_path}: pkill_processes[{i}] must be a string") return None proc = proc.strip() # Block empty strings and regex metacharacters if not proc or not VALID_PROCESS_NAME_PATTERN.fullmatch(proc): + logger.warning(f"Org config at {config_path}: pkill_processes[{i}] has invalid value '{proc}'") return None normalized.append(proc) config["pkill_processes"] = normalized
574-588: Missing diagnostic warnings forpkill_processesvalidation in project config.Same issue as in
load_org_config(): thepkill_processesvalidation returnsNonesilently without logging warnings, inconsistent with other validation in this function.Proposed fix to add missing warnings
# Validate pkill_processes if present if "pkill_processes" in config: processes = config["pkill_processes"] if not isinstance(processes, list): + logger.warning(f"Project config at {config_path}: 'pkill_processes' must be a list") return None # Normalize and validate each process name against safe pattern normalized = [] - for proc in processes: + for i, proc in enumerate(processes): if not isinstance(proc, str): + logger.warning(f"Project config at {config_path}: pkill_processes[{i}] must be a string") return None proc = proc.strip() # Block empty strings and regex metacharacters if not proc or not VALID_PROCESS_NAME_PATTERN.fullmatch(proc): + logger.warning(f"Project config at {config_path}: pkill_processes[{i}] has invalid value '{proc}'") return None normalized.append(proc) config["pkill_processes"] = normalized
…vanzyl#100) - Added repair_orphaned_dependencies(session) to api/dependency_resolver.py - Function removes references to non-existent feature IDs - Gets set of all valid feature IDs from database - Filters dependencies to only valid IDs for each feature - Updates all affected features in a single database transaction - Returns dict of {feature_id: [removed_orphan_ids]} for logging - Added comprehensive test suite (21 tests) in test_repair_orphaned_dependencies.py - Added verification script (5 verification steps) in verify_feature_100.py - All tests passing: 21/21 - Verified with unit tests and verification script Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…nzyl#100, leonvanzyl#108, leonvanzyl#109, leonvanzyl#110 PR leonvanzyl#110 (Quality Gates): - Move quality checks before DB session to avoid holding locks - Return error instead of None for missing configured custom script - Use contextlib.closing for SQLite connections in progress.py PR leonvanzyl#109 (Rate Limit): - Extract rate limit logic to shared rate_limit_utils.py module - Remove duplicated code from agent.py and test_agent.py PR leonvanzyl#108 (SQLite Parallel): - Sort imports alphabetically in feature_mcp.py PR leonvanzyl#100 (Config Diagnostics): - Add logger.warning for pkill_processes validation failures PR leonvanzyl#95 (Infrastructure Mock): - Add language tags to fenced code blocks in initializer template Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Per CodeRabbit feedback, add logger.warning calls when pkill_processes validation fails in both load_org_config and load_project_commands. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
SUMMARY:
Fixed TypeScript build error in ProjectSetupRequired.tsx where startAgent
was being called with a boolean instead of an options object.
DETAILS:
- The startAgent API function signature was updated (in previous PR merges)
to accept an options object: { yoloMode?, parallelMode?, maxConcurrency?, testingAgentRatio? }
- ProjectSetupRequired.tsx was still calling it with the old signature:
startAgent(projectName, yoloMode) - passing boolean directly
- Changed to: startAgent(projectName, { yoloMode }) - wrapping in options object
This was the only remaining build error after merging 13+ PRs from upstream:
- PR leonvanzyl#112: Security vulnerabilities and race conditions
- PR leonvanzyl#89: Windows subprocess blocking fix
- PR leonvanzyl#109: Rate limit handling with exponential backoff
- PR leonvanzyl#88: MCP server config for ExpandChatSession
- PR leonvanzyl#100: Diagnostic warnings for config loading
- PR leonvanzyl#110: Quality gates (quality_gates.py)
- PR leonvanzyl#113: Structured logging (structured_logging.py)
- PR leonvanzyl#48: Knowledge files support (API, schemas, prompts)
- PR leonvanzyl#29: Feature editing/deletion (MCP tools)
- PR leonvanzyl#45: Chat persistence
- PR leonvanzyl#52: Refactoring feature guidance
- PR leonvanzyl#4: Project reset functionality
- PR leonvanzyl#95: UI polish, health checks, cross-platform fixes
Build now passes: npm run build succeeds with all 2245 modules transformed.
Adds a test case to verify that empty command names are rejected in project-level allowed_commands.yaml, matching the behavior already tested for org-level config. Updates test count to 163. Addresses review feedback from leonvanzyl. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
Added the suggested test for empty command name validation in project config. Test count updated to 163. Ready for merge! 🚀 |
Summary
logging.warning()calls when config files fail to loadProblem
When users configure
.autocoder/allowed_commands.yamlor~/.autocoder/config.yaml, they get no feedback when config fails to load. The functions returnedNonesilently on ANY error:None, no warningversionfieldNone, no warningNone, no warningNone, no warningNone, no warningNone, no warningUsers couldn't distinguish between "file not found" (expected) and "file has errors" (unexpected).
Fix
Added
logger.warning()calls for each validation failure in:load_org_config()- org-level config loadingload_project_commands()- project-level config loadingAlso added
.resolve()to project path handling for symlink support.Example Output
Testing
Fixes #91
🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Tests
✏️ Tip: You can customize this high-level summary in your review settings.