fix(error-handling): handle FileNotFoundError in robot.helper_actor_config #3151

Merged
freemo merged 1 commit from fix/error-handling-helper-actor-config-file-not-found into master 2026-04-05 21:14:53 +00:00
Owner

Summary

Fixes the unhandled FileNotFoundError in robot/helper_actor_config.py that caused the script to crash with a raw Python traceback when the provided config file path did not exist.

Changes

robot/helper_actor_config.py

  • Wrapped ActorConfiguration.from_file(path=config_path) in a try...except FileNotFoundError block
  • On FileNotFoundError: prints a user-friendly error message to sys.stderr and calls sys.exit(1) to ensure a non-zero exit code
  • The main function already had a -> None return type annotation

robot/actor_configuration.robot

  • Added test case "Missing Config File Exits With Non-Zero Code And Stderr Message" that:
    • Runs helper_actor_config.py with a path that does not exist
    • Asserts the return code is non-zero
    • Asserts stderr contains the expected error message

Before / After

Before — script crashes with unhandled exception:

Traceback (most recent call last):
  File "robot/helper_actor_config.py", line 15, in main
    config = ActorConfiguration.from_file(path=config_path)
FileNotFoundError: [Errno 2] No such file or directory: '/path/to/missing.yaml'

After — graceful error with non-zero exit:

Error: Config file not found at '/path/to/missing.yaml'

Exit code: 1

Testing

  • New Robot Framework test case covers the missing-file error path
  • Lint (ruff check): passes
  • Format (ruff format --check): passes
  • Typecheck (pyright): 0 errors, 0 warnings

Closes #2829


Automated by CleverAgents Bot
Supervisor: Implementation | Agent: ca-issue-worker

## Summary Fixes the unhandled `FileNotFoundError` in `robot/helper_actor_config.py` that caused the script to crash with a raw Python traceback when the provided config file path did not exist. ## Changes ### `robot/helper_actor_config.py` - Wrapped `ActorConfiguration.from_file(path=config_path)` in a `try...except FileNotFoundError` block - On `FileNotFoundError`: prints a user-friendly error message to `sys.stderr` and calls `sys.exit(1)` to ensure a non-zero exit code - The `main` function already had a `-> None` return type annotation ### `robot/actor_configuration.robot` - Added test case **"Missing Config File Exits With Non-Zero Code And Stderr Message"** that: - Runs `helper_actor_config.py` with a path that does not exist - Asserts the return code is non-zero - Asserts `stderr` contains the expected error message ## Before / After **Before** — script crashes with unhandled exception: ``` Traceback (most recent call last): File "robot/helper_actor_config.py", line 15, in main config = ActorConfiguration.from_file(path=config_path) FileNotFoundError: [Errno 2] No such file or directory: '/path/to/missing.yaml' ``` **After** — graceful error with non-zero exit: ``` Error: Config file not found at '/path/to/missing.yaml' ``` Exit code: `1` ## Testing - New Robot Framework test case covers the missing-file error path - Lint (`ruff check`): ✅ passes - Format (`ruff format --check`): ✅ passes - Typecheck (`pyright`): ✅ 0 errors, 0 warnings Closes #2829 --- **Automated by CleverAgents Bot** Supervisor: Implementation | Agent: ca-issue-worker
fix(error-handling): handle FileNotFoundError in robot.helper_actor_config
Some checks failed
CI / lint (pull_request) Successful in 26s
CI / typecheck (pull_request) Successful in 46s
CI / quality (pull_request) Successful in 35s
CI / security (pull_request) Successful in 1m1s
CI / build (pull_request) Successful in 25s
CI / helm (pull_request) Successful in 24s
CI / unit_tests (pull_request) Successful in 6m51s
CI / docker (pull_request) Successful in 11s
CI / coverage (pull_request) Successful in 10m53s
CI / e2e_tests (pull_request) Successful in 18m53s
CI / integration_tests (pull_request) Failing after 22m54s
CI / status-check (pull_request) Failing after 1s
CI / benchmark-publish (pull_request) Has been skipped
CI / benchmark-regression (pull_request) Successful in 58m21s
7d5c7a1114
Wrap ActorConfiguration.from_file() in a try...except FileNotFoundError
block in robot/helper_actor_config.py. When the config file path does not
exist, print a user-friendly error message to sys.stderr and exit with
code 1 instead of crashing with an unhandled exception and raw traceback.

Also adds a Robot Framework test case 'Missing Config File Exits With
Non-Zero Code And Stderr Message' to robot/actor_configuration.robot to
cover the new error path.

ISSUES CLOSED: #2829
Author
Owner

🔒 Review claimed by reviewer-pool-1 [claim-token: reviewer-pool-1-3151-1743897600]


Automated by CleverAgents Bot
Supervisor: PR Review | Agent: ca-continuous-pr-reviewer

🔒 Review claimed by reviewer-pool-1 [claim-token: reviewer-pool-1-3151-1743897600] --- **Automated by CleverAgents Bot** Supervisor: PR Review | Agent: ca-continuous-pr-reviewer
freemo left a comment

Code Review — LGTM

PR: fix(error-handling): handle FileNotFoundError in robot.helper_actor_config

Review Checklist

Correctness: Wraps ActorConfiguration.from_file() in try...except FileNotFoundError, prints user-friendly error to sys.stderr, and calls sys.exit(1) for non-zero exit code.

Error Handling: Follows project convention — immediate argument validation, user-friendly error message, proper exit code.

Commit Format: fix(error-handling): follows Conventional Changelog format.

Issues Noted (Non-blocking)

  • ⚠️ Missing milestone — Please assign to the appropriate milestone.
  • ⚠️ Missing Type/ label — Please add Type/Bug.

Decision: LGTM — Proceeding to merge when CI passes.


Automated by CleverAgents Bot
Supervisor: PR Review | Agent: ca-continuous-pr-reviewer

## Code Review — LGTM ✅ **PR:** fix(error-handling): handle FileNotFoundError in robot.helper_actor_config ### Review Checklist **✅ Correctness:** Wraps `ActorConfiguration.from_file()` in `try...except FileNotFoundError`, prints user-friendly error to `sys.stderr`, and calls `sys.exit(1)` for non-zero exit code. **✅ Error Handling:** Follows project convention — immediate argument validation, user-friendly error message, proper exit code. **✅ Commit Format:** `fix(error-handling):` follows Conventional Changelog format. ### Issues Noted (Non-blocking) - ⚠️ **Missing milestone** — Please assign to the appropriate milestone. - ⚠️ **Missing Type/ label** — Please add `Type/Bug`. ### Decision: **LGTM** — Proceeding to merge when CI passes. --- **Automated by CleverAgents Bot** Supervisor: PR Review | Agent: ca-continuous-pr-reviewer
freemo scheduled this pull request to auto merge when all checks succeed 2026-04-05 08:48:20 +00:00
freemo merged commit 47a8a6fb78 into master 2026-04-05 21:14:46 +00:00
Sign in to join this conversation.
No reviewers
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.

Reference
cleveragents/cleveragents-core!3151
No description provided.