fix(actor): Include full file path in actor discovery error messages #10564

Open
opened 2026-04-18 17:18:51 +00:00 by HAL9000 · 0 comments
Owner

Metadata

Commit: Latest commit in current branch
Branch: main

Background and Context

The ActorLoader.discover() method in src/cleveragents/actor/loader.py catches YAML parsing errors and includes error messages in the ValidationError, but the error messages only include the filename (path.name) rather than the full path. This makes it difficult for users to locate and fix problematic YAML files, especially when multiple search roots are configured or when files have the same name in different directories.

Code Evidence

Lines 120-130 in src/cleveragents/actor/loader.py:

try:
    raw = yaml.safe_load(content)
except yaml.YAMLError as exc:
    mark = getattr(exc, "problem_mark", None)
    location = (
        f" at line {mark.line + 1}, column {mark.column + 1}"
        if mark is not None
        else ""
    )
    problem = getattr(exc, "problem", str(exc))
    errors.append(f"Invalid YAML in {path.name}{location}: {problem}")
    #                                  ^^^^^^^^^ Only filename, not full path!
    continue

The error message uses path.name which only includes the filename (e.g., "actor.yaml") rather than the full path (e.g., "/app/actors/my_actor.yaml"). This makes it hard to locate the problematic file.

Environment Verification

This is reproducible by:

  1. Configuring multiple search roots with overlapping filenames
  2. Creating a YAML file with invalid syntax in one of the search roots
  3. Running discover()
  4. The error message will only show the filename, not which search root it came from

Expected Behavior

Error messages should include the full file path (relative to the search root or absolute, whichever is clearer) so users can immediately identify which file needs to be fixed, even when multiple search roots are configured or files have the same name in different directories.

Acceptance Criteria

  • Error messages include full file path, not just filename
  • Error messages are consistent across all error types (YAML parse, schema validation, duplicates)
  • Full path is relative to the search root or absolute, whichever is clearer
  • Error messages remain concise and readable

Subtasks

  • Update YAML parse error messages to include full path
  • Update schema validation error messages to include full path
  • Update duplicate actor error messages to include full path
  • Create test case with multiple search roots and overlapping filenames
  • Verify error messages are clear and helpful

Definition of Done

This issue is complete when:

  • All error messages in discover() include the full file path
  • Error messages are tested with multiple search roots
  • All existing tests pass
  • Code coverage remains >=97%

Automated by CleverAgents Bot
Agent: new-issue-creator

## Metadata **Commit**: Latest commit in current branch **Branch**: main ## Background and Context The `ActorLoader.discover()` method in `src/cleveragents/actor/loader.py` catches YAML parsing errors and includes error messages in the `ValidationError`, but the error messages only include the filename (`path.name`) rather than the full path. This makes it difficult for users to locate and fix problematic YAML files, especially when multiple search roots are configured or when files have the same name in different directories. ## Code Evidence Lines 120-130 in `src/cleveragents/actor/loader.py`: ```python try: raw = yaml.safe_load(content) except yaml.YAMLError as exc: mark = getattr(exc, "problem_mark", None) location = ( f" at line {mark.line + 1}, column {mark.column + 1}" if mark is not None else "" ) problem = getattr(exc, "problem", str(exc)) errors.append(f"Invalid YAML in {path.name}{location}: {problem}") # ^^^^^^^^^ Only filename, not full path! continue ``` The error message uses `path.name` which only includes the filename (e.g., "actor.yaml") rather than the full path (e.g., "/app/actors/my_actor.yaml"). This makes it hard to locate the problematic file. ## Environment Verification This is reproducible by: 1. Configuring multiple search roots with overlapping filenames 2. Creating a YAML file with invalid syntax in one of the search roots 3. Running `discover()` 4. The error message will only show the filename, not which search root it came from ## Expected Behavior Error messages should include the full file path (relative to the search root or absolute, whichever is clearer) so users can immediately identify which file needs to be fixed, even when multiple search roots are configured or files have the same name in different directories. ## Acceptance Criteria - [ ] Error messages include full file path, not just filename - [ ] Error messages are consistent across all error types (YAML parse, schema validation, duplicates) - [ ] Full path is relative to the search root or absolute, whichever is clearer - [ ] Error messages remain concise and readable ## Subtasks - [ ] Update YAML parse error messages to include full path - [ ] Update schema validation error messages to include full path - [ ] Update duplicate actor error messages to include full path - [ ] Create test case with multiple search roots and overlapping filenames - [ ] Verify error messages are clear and helpful ## Definition of Done This issue is complete when: - All error messages in `discover()` include the full file path - Error messages are tested with multiple search roots - All existing tests pass - Code coverage remains >=97% --- **Automated by CleverAgents Bot** Agent: new-issue-creator
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cleveragents/cleveragents-core#10564
No description provided.