fix: add diagnostic warnings for config loading failures#100
Conversation
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📝 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. 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. |
33640fc to
b8e03de
Compare
There was a problem hiding this comment.
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
…ForgeAI#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>
…orgeAI#100, AutoForgeAI#108, AutoForgeAI#109, AutoForgeAI#110 PR AutoForgeAI#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 AutoForgeAI#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 AutoForgeAI#108 (SQLite Parallel): - Sort imports alphabetically in feature_mcp.py PR AutoForgeAI#100 (Config Diagnostics): - Add logger.warning for pkill_processes validation failures PR AutoForgeAI#95 (Infrastructure Mock): - Add language tags to fenced code blocks in initializer template 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 AutoForgeAI#112: Security vulnerabilities and race conditions
- PR AutoForgeAI#89: Windows subprocess blocking fix
- PR AutoForgeAI#109: Rate limit handling with exponential backoff
- PR AutoForgeAI#88: MCP server config for ExpandChatSession
- PR AutoForgeAI#100: Diagnostic warnings for config loading
- PR AutoForgeAI#110: Quality gates (quality_gates.py)
- PR AutoForgeAI#113: Structured logging (structured_logging.py)
- PR AutoForgeAI#48: Knowledge files support (API, schemas, prompts)
- PR AutoForgeAI#29: Feature editing/deletion (MCP tools)
- PR AutoForgeAI#45: Chat persistence
- PR AutoForgeAI#52: Refactoring feature guidance
- PR AutoForgeAI#4: Project reset functionality
- PR AutoForgeAI#95: UI polish, health checks, cross-platform fixes
Build now passes: npm run build succeeds with all 2245 modules transformed.
|
Added the suggested test for empty command name validation in project config. Test count updated to 163. Ready for merge! 🚀 |
) 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: AutoForgeAI#91 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>
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>
8abb6cd to
0a46eda
Compare
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 AutoForgeAI#112: Security vulnerabilities and race conditions
- PR AutoForgeAI#89: Windows subprocess blocking fix
- PR AutoForgeAI#109: Rate limit handling with exponential backoff
- PR AutoForgeAI#88: MCP server config for ExpandChatSession
- PR AutoForgeAI#100: Diagnostic warnings for config loading
- PR AutoForgeAI#110: Quality gates (quality_gates.py)
- PR AutoForgeAI#113: Structured logging (structured_logging.py)
- PR AutoForgeAI#48: Knowledge files support (API, schemas, prompts)
- PR AutoForgeAI#29: Feature editing/deletion (MCP tools)
- PR AutoForgeAI#45: Chat persistence
- PR AutoForgeAI#52: Refactoring feature guidance
- PR AutoForgeAI#4: Project reset functionality
- PR AutoForgeAI#95: UI polish, health checks, cross-platform fixes
Build now passes: npm run build succeeds with all 2245 modules transformed.
…orgeAI#100, AutoForgeAI#108, AutoForgeAI#109, AutoForgeAI#110 PR AutoForgeAI#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 AutoForgeAI#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 AutoForgeAI#108 (SQLite Parallel): - Sort imports alphabetically in feature_mcp.py PR AutoForgeAI#100 (Config Diagnostics): - Add logger.warning for pkill_processes validation failures PR AutoForgeAI#95 (Infrastructure Mock): - Add language tags to fenced code blocks in initializer template Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Update the documented test count in CLAUDE.md to reflect the current state after merging PR #100 which added diagnostic warnings for config loading failures. The test suite now includes additional tests for: - Empty command name validation in project configs - Config loading diagnostic warnings Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.