Skip to content

Conversation

@cabana8471-arch
Copy link
Contributor

@cabana8471-arch cabana8471-arch commented Jan 25, 2026

Summary

  • Added logging.warning() calls when config files fail to load
  • Users can now diagnose why their settings aren't being applied

Problem

When users configure .autocoder/allowed_commands.yaml or ~/.autocoder/config.yaml, they get no feedback when config fails to load. The functions returned None silently on ANY error:

Error Type Previous Behavior
YAML syntax error Returns None, no warning
Missing version field Returns None, no warning
Invalid structure Returns None, no warning
File permissions Returns None, no warning
Empty file Returns None, no warning
Over 100 commands Returns None, no warning

Users 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 loading
  • load_project_commands() - project-level config loading

Also added .resolve() to project path handling for symlink support.

Example Output

WARNING: Project config at /path/.autocoder/allowed_commands.yaml missing required 'version' field
WARNING: Failed to parse org config at ~/.autocoder/config.yaml: mapping values are not allowed here

Testing

# Test with invalid YAML: .autocoder/allowed_commands.yaml
version: 1
commands:
  - name: test
  - invalid yaml here
  1. Start agent
  2. Should see warning in logs with file path and error details

Fixes #91

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Configuration validation now emits detailed, contextual warnings for invalid or missing entries instead of failing silently.
    • YAML parsing and file I/O errors produce clear warnings with context.
    • Project configuration path resolution improved.
    • Stricter validation and enforced limits for command lists to prevent malformed configs.
  • Tests

    • Added a test to reject empty command names in project configuration.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 25, 2026

📝 Walkthrough

Walkthrough

Adds module-level logging and extensive warning-based validation to org and project config loaders in security.py, replacing silent failures with explicit warnings and using Path.resolve() for project config path resolution.

Changes

Cohort / File(s) Summary
Config validation & logging
security.py
Adds logging import and module-level logger. Enhances _load_org_config() and _load_project_config() with warnings for empty/invalid YAML, non-dict root, missing version, invalid allowed_commands/commands types, per-entry type/name validation (with index context), list limits (100 commands), YAML/I/O exception logging, and pkill_processes normalization/validation. project_dir.resolve() used for project config path. Validation failures return None.
Project config tests
test_security.py
Adds test case in test_project_commands() to verify that empty command names in project YAML cause loading failure (None), ensuring validation of command entries works as expected.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰
Logs now sing where silence lay,
Warnings hop to light the way.
Names and lists checked, each line in sight,
Paths resolved, no mystery tonight.
🥕

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: add diagnostic warnings for config loading failures' accurately summarizes the main change—adding logger.warning calls for configuration validation and parsing failures.
Linked Issues check ✅ Passed The PR successfully addresses issue #91's objectives by adding logger.warning calls for config loading failures, enabling users to distinguish between file absence and validation errors, and implementing empty command name rejection.
Out of Scope Changes check ✅ Passed All changes are within scope: logger.warning calls for validation/parsing failures in load_org_config and load_project_commands, .resolve() for symlink support, and a test for empty command names align directly with issue #91's objectives.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@cabana8471-arch
Copy link
Contributor Author

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Jan 25, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@leonvanzyl
Copy link
Owner

PR Review Summary

Verdict: APPROVE (after resolving conflicts)

Risk Level: LOW


Security Analysis

  • No concerns - all validation logic preserved
  • Only file paths and error types are logged (no secrets exposed)
  • The .resolve() change is safe (already sandboxed upstream)
  • Minor security improvement: empty command names now rejected in project configs

Code Quality

  • Logging level (WARNING) is appropriate and matches codebase patterns
  • Log messages are clear and actionable
  • Exception handling split improves diagnostics

Test Coverage

  • All existing tests pass
  • The behavioral change (empty string validation) aligns with load_org_config()

Action Required

Please resolve the merge conflicts with master before this can be merged.


Optional Improvements

  1. Consider adding a test for empty command name validation in load_project_commands():
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)
  1. Update PR description test count (136 → 162 unit tests)

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>
@cabana8471-arch cabana8471-arch force-pushed the fix/config-loading-diagnostics branch from 33640fc to b8e03de Compare January 26, 2026 19:46
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

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 for pkill_processes validation failures.

The pkill_processes validation returns None silently 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 for pkill_processes validation in project config.

Same issue as in load_org_config(): the pkill_processes validation returns None silently 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

rudiheydra added a commit to rudiheydra/AutoBuildr that referenced this pull request Jan 27, 2026
…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>
rudiheydra added a commit to rudiheydra/AutoBuildr that referenced this pull request Jan 27, 2026
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
cabana8471-arch added a commit to cabana8471-arch/autocoder that referenced this pull request Jan 27, 2026
cabana8471-arch added a commit to cabana8471-arch/autocoder that referenced this pull request Jan 27, 2026
…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>
getworken pushed a commit to getworken/autocoder that referenced this pull request Jan 27, 2026
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>
@cabana8471-arch
Copy link
Contributor Author

Added the suggested test for empty command name validation in project config. Test count updated to 163. Ready for merge! 🚀

cabana8471-arch added a commit to cabana8471-arch/autocoder that referenced this pull request Jan 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: .autocoder/config.yaml and {projectdir}/.autocoder/allowed_commands.yaml have no effect

2 participants