Files
cleveragents-core/robot/helper_actor_config.py
T
freemo 7d5c7a1114
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
fix(error-handling): handle FileNotFoundError in robot.helper_actor_config
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
2026-04-05 06:55:19 +00:00

34 lines
824 B
Python

from __future__ import annotations
import json
import sys
from pathlib import Path
from cleveragents.actor.config import ActorConfiguration
def main() -> None:
if len(sys.argv) < 2:
raise SystemExit("config path required")
config_path = Path(sys.argv[1])
try:
config = ActorConfiguration.from_file(path=config_path)
except FileNotFoundError:
print(f"Error: Config file not found at '{config_path}'", file=sys.stderr)
sys.exit(1)
payload = {
"provider": config.provider,
"model": config.model,
"unsafe": config.unsafe,
"graph_keys": sorted(config.graph_descriptor.keys())
if config.graph_descriptor
else [],
"options": config.options,
}
print(json.dumps(payload))
if __name__ == "__main__":
main()