From efa5b9ce73ec61344b4079e2f05e08319bc80d7d Mon Sep 17 00:00:00 2001 From: Om <99085886+om051105@users.noreply.github.com> Date: Tue, 6 Jan 2026 20:37:13 +0530 Subject: [PATCH 1/2] feat: implement config validation logic --- taskweaver/utils/app_utils.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/taskweaver/utils/app_utils.py b/taskweaver/utils/app_utils.py index 718e0738f..a450afbe7 100644 --- a/taskweaver/utils/app_utils.py +++ b/taskweaver/utils/app_utils.py @@ -1,3 +1,4 @@ +import json from os import listdir, path from typing import Optional, Tuple @@ -13,7 +14,11 @@ def validate_app_config(workspace: str) -> bool: config_path = path.join(workspace, "taskweaver_config.json") if not path.exists(config_path): return False - # TODO: read, parse and validate config + try: + with open(config_path, "r", encoding="utf-8") as f: + json.load(f) + except json.JSONDecodeError: + return False return True def is_dir_valid(dir: str) -> bool: From e5ff7c0fa9a9bdbbe42297c5dcf3963fbc90df93 Mon Sep 17 00:00:00 2001 From: Om <99085886+om051105@users.noreply.github.com> Date: Tue, 6 Jan 2026 20:40:13 +0530 Subject: [PATCH 2/2] feat: improve config validation to ensure dict type --- taskweaver/utils/app_utils.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/taskweaver/utils/app_utils.py b/taskweaver/utils/app_utils.py index a450afbe7..3ec190892 100644 --- a/taskweaver/utils/app_utils.py +++ b/taskweaver/utils/app_utils.py @@ -16,8 +16,11 @@ def validate_app_config(workspace: str) -> bool: return False try: with open(config_path, "r", encoding="utf-8") as f: - json.load(f) - except json.JSONDecodeError: + data = json.load(f) + # Config must be a dictionary (key-value pairs) + if not isinstance(data, dict): + return False + except (json.JSONDecodeError, OSError): return False return True