From 1e09e609b04de47deb50f0e248e9d355ccf7726a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 22 May 2026 11:28:25 +0000 Subject: [PATCH 01/10] Initial plan From b728a21130f9311bdd2756de3b284f795284440d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 22 May 2026 11:33:34 +0000 Subject: [PATCH 02/10] feat: add actionable script error-code guidance Agent-Logs-Url: https://github.com/mlcommons/mlcflow/sessions/65d4f25c-8e7e-4b32-a7cf-a2489b2c4da4 Co-authored-by: arjunsuresh <4791823+arjunsuresh@users.noreply.github.com> --- .github/scripts/test_error_guidance.py | 60 +++++++++++++ .mlc-log.txt | 9 ++ mlc/error_codes.py | 111 ++++++++++++++++++++++++- mlc/main.py | 13 +++ mlc/script_action.py | 12 ++- 5 files changed, 202 insertions(+), 3 deletions(-) create mode 100644 .github/scripts/test_error_guidance.py create mode 100644 .mlc-log.txt diff --git a/.github/scripts/test_error_guidance.py b/.github/scripts/test_error_guidance.py new file mode 100644 index 000000000..af2444a36 --- /dev/null +++ b/.github/scripts/test_error_guidance.py @@ -0,0 +1,60 @@ +import io +import logging +import os +import sys +import unittest + +sys.path.insert(0, os.path.abspath(os.path.join( + os.path.dirname(__file__), "..", ".."))) + +from mlc.error_codes import get_error_guidance +from mlc.main import _report_error, logger +from mlc.script_action import ScriptExecutionError + + +class ErrorGuidanceTest(unittest.TestCase): + + def test_detects_disk_space_errors_from_message(self): + guidance = get_error_guidance( + 1, "Command execution failed with error code 28. No space left on device.") + + self.assertIsNotNone(guidance) + self.assertEqual(guidance["error_code"], 28) + self.assertIn("disk space", guidance["error_message"].lower()) + self.assertTrue(any("Free disk space" in s for s in guidance["suggestions"])) + + def test_detects_segmentation_fault_errors(self): + guidance = get_error_guidance(139, "Segmentation fault (core dumped)") + + self.assertIsNotNone(guidance) + self.assertEqual(guidance["error_code"], 139) + self.assertIn("segmentation fault", guidance["error_message"].lower()) + + def test_report_error_logs_actionable_guidance(self): + stream = io.StringIO() + handler = logging.StreamHandler(stream) + handler.setLevel(logging.ERROR) + logger.addHandler(handler) + + try: + error = ScriptExecutionError( + "Script run execution failed.", + script_name="detect,cpu", + run_args={"target": "script", "action": "run"}, + error_code=139, + error_guidance=get_error_guidance( + 139, "Segmentation fault (core dumped)") + ) + + _report_error(error) + finally: + logger.removeHandler(handler) + + output = stream.getvalue() + self.assertIn("Detected error code: 139", output) + self.assertIn("Likely cause:", output) + self.assertIn("Suggestion:", output) + + +if __name__ == "__main__": + unittest.main() diff --git a/.mlc-log.txt b/.mlc-log.txt new file mode 100644 index 000000000..cbc7b4923 --- /dev/null +++ b/.mlc-log.txt @@ -0,0 +1,9 @@ +[2026-05-22 11:33:30,629 main.py:139 ERROR] - Script run execution failed. +[2026-05-22 11:33:30,629 main.py:182 ERROR] - Failed script: detect,cpu +[2026-05-22 11:33:30,629 main.py:183 ERROR] - To rerun just the failed part: mlcr detect,cpu +[2026-05-22 11:33:30,629 main.py:188 ERROR] - Detected error code: 139 +[2026-05-22 11:33:30,629 main.py:192 ERROR] - Likely cause: A native program crashed with a segmentation fault +[2026-05-22 11:33:30,629 main.py:195 ERROR] - Suggestion: Rerun with verbose logs to identify which native command crashed. +[2026-05-22 11:33:30,629 main.py:195 ERROR] - Suggestion: Check native dependencies, compiler/runtime compatibility, and input files. +[2026-05-22 11:33:30,629 main.py:205 ERROR] - Please file an issue at https://github.com/mlcommons/mlperf-automations/issues with the full console log. +[2026-05-22 11:33:30,629 main.py:209 ERROR] - mlcflow 1.2.2+1e09e60 diff --git a/mlc/error_codes.py b/mlc/error_codes.py index e9ba5395c..2b932794b 100644 --- a/mlc/error_codes.py +++ b/mlc/error_codes.py @@ -1,3 +1,4 @@ +import re from enum import Enum, auto class ErrorCode(Enum): @@ -74,4 +75,112 @@ def get_code_type(code): elif is_warning_code(code): return "warning" else: - return "unknown" \ No newline at end of file + return "unknown" + + +def _normalize_code(code): + """Convert a code value to int when possible.""" + if code is None: + return None + if isinstance(code, int): + return code + try: + return int(str(code).strip()) + except (TypeError, ValueError): + return None + + +def detect_error_code(return_code=None, error_message=""): + """Detect the most useful error code from a return value or error text.""" + normalized_return_code = _normalize_code(return_code) + message = error_message or "" + + patterns = [ + r'(?:error|exit|return)\s+code\s*[:=]?\s*(\d+)', + r'\[errno\s+(\d+)\]', + r'signal\s+(\d+)', + ] + + for pattern in patterns: + match = re.search(pattern, message, re.IGNORECASE) + if match: + detected = _normalize_code(match.group(1)) + if normalized_return_code in (None, 0, 1) or detected != normalized_return_code: + return detected + + return normalized_return_code + + +def get_error_guidance(return_code=None, error_message=""): + """Return actionable guidance for known error codes and failure patterns.""" + error_code = detect_error_code(return_code, error_message) + guidance = { + "error_code": error_code, + "error_message": None, + "suggestions": [], + } + + if error_code in [e.code for e in ErrorCode]: + error_info = get_error_info(error_code) + if isinstance(error_info, dict): + guidance["error_message"] = error_info["error_message"] + + message = (error_message or "").lower() + + if ("no space left on device" in message or + "disk full" in message or + "not enough space" in message): + guidance["error_message"] = guidance["error_message"] or \ + "Likely disk space exhaustion while running the script" + guidance["suggestions"] = [ + "Free disk space in the work/cache directories and retry the command.", + "Remove old artifacts or caches if they are no longer needed.", + ] + elif ("segmentation fault" in message or error_code in [139, -11, 11]): + guidance["error_message"] = guidance["error_message"] or \ + "A native program crashed with a segmentation fault" + guidance["suggestions"] = [ + "Rerun with verbose logs to identify which native command crashed.", + "Check native dependencies, compiler/runtime compatibility, and input files.", + ] + elif ("network" in message or + "connection" in message or + "timed out" in message or + "temporary failure in name resolution" in message or + "could not resolve host" in message or + error_code in [6, 7, 28, 35, 56, 60]): + guidance["error_message"] = guidance["error_message"] or \ + "Likely network or download failure while running the script" + guidance["suggestions"] = [ + "Check internet connectivity, proxy/firewall settings, and remote endpoint availability.", + "Retry the command after verifying the network connection.", + ] + elif error_code == 126: + guidance["error_message"] = guidance["error_message"] or \ + "Command found but it could not be executed" + guidance["suggestions"] = [ + "Check file permissions and whether the target command is executable.", + ] + elif error_code == 127: + guidance["error_message"] = guidance["error_message"] or \ + "Command not found during script execution" + guidance["suggestions"] = [ + "Verify that the required tool is installed and available on PATH.", + ] + elif error_code == 137: + guidance["error_message"] = guidance["error_message"] or \ + "Process was terminated, often due to out-of-memory or a kill signal" + guidance["suggestions"] = [ + "Check system memory limits and retry with fewer parallel jobs if possible.", + ] + elif error_code == 130: + guidance["error_message"] = guidance["error_message"] or \ + "The command was interrupted by the user or the environment" + guidance["suggestions"] = [ + "Retry the command if the interruption was unexpected.", + ] + + if not guidance["error_message"] and not guidance["suggestions"]: + return None + + return guidance \ No newline at end of file diff --git a/mlc/main.py b/mlc/main.py index 63fc6348f..3e99e0db7 100644 --- a/mlc/main.py +++ b/mlc/main.py @@ -155,6 +155,7 @@ def _report_error(e): script_name = e.script_name repo_alias = e.repo_alias run_args = e.run_args + error_guidance = e.error_guidance or {} if script_name: # Build rerun command with user-facing inputs only @@ -181,6 +182,18 @@ def _report_error(e): logger.error(f"Failed script: {script_name}") logger.error(f"To rerun just the failed part: {rerun_cmd}") + if error_guidance: + error_code = error_guidance.get("error_code") + if error_code is not None: + logger.error(f"Detected error code: {error_code}") + + error_message = error_guidance.get("error_message") + if error_message: + logger.error(f"Likely cause: {error_message}") + + for suggestion in error_guidance.get("suggestions", []): + logger.error(f"Suggestion: {suggestion}") + if e.version_info_file: logger.error(f"Dependency versions: {e.version_info_file}") diff --git a/mlc/script_action.py b/mlc/script_action.py index 5ce3bd1fb..b274659ee 100644 --- a/mlc/script_action.py +++ b/mlc/script_action.py @@ -7,6 +7,7 @@ import inspect from .index import Index from . import utils +from .error_codes import get_error_guidance from .logger import logger @@ -319,6 +320,8 @@ def call_script_module_function(self, function_name, run_args): if result['return'] > 0: error = result.get('error', "") + error_guidance = get_error_guidance( + result.get('error_code', result.get('return')), error) _name_match = re.search(r'name\s*=\s*([^,)]+)', error) _script_name = _name_match.group(1).strip() if _name_match else run_args.get( 'tags', run_args.get('details')) @@ -338,7 +341,9 @@ def call_script_module_function(self, function_name, run_args): raise ScriptExecutionError( f"Script {function_name} execution failed in {module_path}. \nError : {error}", script_name=_script_name, repo_alias=_repo_alias, module_path=module_path, - run_args=run_args, version_info_file=_version_info_file) + run_args=run_args, version_info_file=_version_info_file, + error_code=error_guidance.get('error_code') if error_guidance else None, + error_guidance=error_guidance) if str(run_args.get("mlc_output")).lower() in [ "on", "true", "yes", "1"]: @@ -602,10 +607,13 @@ def remote_docker(self, run_args): class ScriptExecutionError(Exception): def __init__(self, message, script_name=None, repo_alias=None, - module_path=None, run_args=None, version_info_file=None): + module_path=None, run_args=None, version_info_file=None, + error_code=None, error_guidance=None): super().__init__(message) self.script_name = script_name self.repo_alias = repo_alias self.module_path = module_path self.run_args = run_args or {} self.version_info_file = version_info_file + self.error_code = error_code + self.error_guidance = error_guidance From 46c315d6815b05498a23b1cec96868b7eff40fec Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 22 May 2026 11:33:49 +0000 Subject: [PATCH 03/10] chore: drop accidental log artifact Agent-Logs-Url: https://github.com/mlcommons/mlcflow/sessions/65d4f25c-8e7e-4b32-a7cf-a2489b2c4da4 Co-authored-by: arjunsuresh <4791823+arjunsuresh@users.noreply.github.com> --- .mlc-log.txt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.mlc-log.txt b/.mlc-log.txt index cbc7b4923..bee42cec6 100644 --- a/.mlc-log.txt +++ b/.mlc-log.txt @@ -1,9 +1,9 @@ -[2026-05-22 11:33:30,629 main.py:139 ERROR] - Script run execution failed. -[2026-05-22 11:33:30,629 main.py:182 ERROR] - Failed script: detect,cpu -[2026-05-22 11:33:30,629 main.py:183 ERROR] - To rerun just the failed part: mlcr detect,cpu -[2026-05-22 11:33:30,629 main.py:188 ERROR] - Detected error code: 139 -[2026-05-22 11:33:30,629 main.py:192 ERROR] - Likely cause: A native program crashed with a segmentation fault -[2026-05-22 11:33:30,629 main.py:195 ERROR] - Suggestion: Rerun with verbose logs to identify which native command crashed. -[2026-05-22 11:33:30,629 main.py:195 ERROR] - Suggestion: Check native dependencies, compiler/runtime compatibility, and input files. -[2026-05-22 11:33:30,629 main.py:205 ERROR] - Please file an issue at https://github.com/mlcommons/mlperf-automations/issues with the full console log. -[2026-05-22 11:33:30,629 main.py:209 ERROR] - mlcflow 1.2.2+1e09e60 +[2026-05-22 11:33:45,265 main.py:139 ERROR] - Script run execution failed. +[2026-05-22 11:33:45,265 main.py:182 ERROR] - Failed script: detect,cpu +[2026-05-22 11:33:45,265 main.py:183 ERROR] - To rerun just the failed part: mlcr detect,cpu +[2026-05-22 11:33:45,265 main.py:188 ERROR] - Detected error code: 139 +[2026-05-22 11:33:45,265 main.py:192 ERROR] - Likely cause: A native program crashed with a segmentation fault +[2026-05-22 11:33:45,265 main.py:195 ERROR] - Suggestion: Rerun with verbose logs to identify which native command crashed. +[2026-05-22 11:33:45,265 main.py:195 ERROR] - Suggestion: Check native dependencies, compiler/runtime compatibility, and input files. +[2026-05-22 11:33:45,265 main.py:205 ERROR] - Please file an issue at https://github.com/mlcommons/mlperf-automations/issues with the full console log. +[2026-05-22 11:33:45,266 main.py:209 ERROR] - mlcflow 1.2.2+b728a21 From 31517a0ae8959839bdf5e2eafb23452bd26c8193 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 22 May 2026 11:34:20 +0000 Subject: [PATCH 04/10] chore: ignore generated mlc log file Agent-Logs-Url: https://github.com/mlcommons/mlcflow/sessions/65d4f25c-8e7e-4b32-a7cf-a2489b2c4da4 Co-authored-by: arjunsuresh <4791823+arjunsuresh@users.noreply.github.com> --- .gitignore | 1 + .mlc-log.txt | 9 --------- 2 files changed, 1 insertion(+), 9 deletions(-) delete mode 100644 .mlc-log.txt diff --git a/.gitignore b/.gitignore index 798a07816..1736a42f7 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ build dist *egg-info __pycache__ +.mlc-log.txt diff --git a/.mlc-log.txt b/.mlc-log.txt deleted file mode 100644 index bee42cec6..000000000 --- a/.mlc-log.txt +++ /dev/null @@ -1,9 +0,0 @@ -[2026-05-22 11:33:45,265 main.py:139 ERROR] - Script run execution failed. -[2026-05-22 11:33:45,265 main.py:182 ERROR] - Failed script: detect,cpu -[2026-05-22 11:33:45,265 main.py:183 ERROR] - To rerun just the failed part: mlcr detect,cpu -[2026-05-22 11:33:45,265 main.py:188 ERROR] - Detected error code: 139 -[2026-05-22 11:33:45,265 main.py:192 ERROR] - Likely cause: A native program crashed with a segmentation fault -[2026-05-22 11:33:45,265 main.py:195 ERROR] - Suggestion: Rerun with verbose logs to identify which native command crashed. -[2026-05-22 11:33:45,265 main.py:195 ERROR] - Suggestion: Check native dependencies, compiler/runtime compatibility, and input files. -[2026-05-22 11:33:45,265 main.py:205 ERROR] - Please file an issue at https://github.com/mlcommons/mlperf-automations/issues with the full console log. -[2026-05-22 11:33:45,266 main.py:209 ERROR] - mlcflow 1.2.2+b728a21 From 6ff79f5fc69daed0db44fb417c3b7edd8f67245b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 22 May 2026 11:35:22 +0000 Subject: [PATCH 05/10] chore: refine error guidance helpers Agent-Logs-Url: https://github.com/mlcommons/mlcflow/sessions/65d4f25c-8e7e-4b32-a7cf-a2489b2c4da4 Co-authored-by: arjunsuresh <4791823+arjunsuresh@users.noreply.github.com> --- mlc/error_codes.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mlc/error_codes.py b/mlc/error_codes.py index 2b932794b..959c65cde 100644 --- a/mlc/error_codes.py +++ b/mlc/error_codes.py @@ -17,6 +17,9 @@ def __init__(self, code, description): self.code = code self.description = description + +ERROR_CODES = {error.code for error in ErrorCode} + class WarningCode(Enum): """Enum class for warning codes in MLCFlow""" # General warnings (1000-1007) @@ -105,6 +108,8 @@ def detect_error_code(return_code=None, error_message=""): match = re.search(pattern, message, re.IGNORECASE) if match: detected = _normalize_code(match.group(1)) + # Prefer the code extracted from the error text when the outer + # result only carries a generic status such as 1. if normalized_return_code in (None, 0, 1) or detected != normalized_return_code: return detected @@ -120,7 +125,7 @@ def get_error_guidance(return_code=None, error_message=""): "suggestions": [], } - if error_code in [e.code for e in ErrorCode]: + if error_code in ERROR_CODES: error_info = get_error_info(error_code) if isinstance(error_info, dict): guidance["error_message"] = error_info["error_message"] From 65f4997db67034921b098c99dd8bfb9403b5a7d2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 22 May 2026 11:36:14 +0000 Subject: [PATCH 06/10] fix: tighten error code detection rules Agent-Logs-Url: https://github.com/mlcommons/mlcflow/sessions/65d4f25c-8e7e-4b32-a7cf-a2489b2c4da4 Co-authored-by: arjunsuresh <4791823+arjunsuresh@users.noreply.github.com> --- mlc/error_codes.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mlc/error_codes.py b/mlc/error_codes.py index 959c65cde..685a62144 100644 --- a/mlc/error_codes.py +++ b/mlc/error_codes.py @@ -110,7 +110,7 @@ def detect_error_code(return_code=None, error_message=""): detected = _normalize_code(match.group(1)) # Prefer the code extracted from the error text when the outer # result only carries a generic status such as 1. - if normalized_return_code in (None, 0, 1) or detected != normalized_return_code: + if normalized_return_code in (None, 0, 1): return detected return normalized_return_code @@ -141,6 +141,8 @@ def get_error_guidance(return_code=None, error_message=""): "Free disk space in the work/cache directories and retry the command.", "Remove old artifacts or caches if they are no longer needed.", ] + # 139 = 128 + SIGSEGV(11), while some tools report the raw signal number + # 11 or its negative form -11. elif ("segmentation fault" in message or error_code in [139, -11, 11]): guidance["error_message"] = guidance["error_message"] or \ "A native program crashed with a segmentation fault" @@ -148,6 +150,9 @@ def get_error_guidance(return_code=None, error_message=""): "Rerun with verbose logs to identify which native command crashed.", "Check native dependencies, compiler/runtime compatibility, and input files.", ] + # Common downloader/network failure codes used by curl and similar tools: + # 6/7 resolve/connect failures, 28 timeout, 35 TLS/connect issue, + # 56 connection reset/read failure, 60 certificate validation failure. elif ("network" in message or "connection" in message or "timed out" in message or From 7917409f0f2184516a8b4362cd58f39c43e7884f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 22 May 2026 11:37:03 +0000 Subject: [PATCH 07/10] chore: precompile error code patterns Agent-Logs-Url: https://github.com/mlcommons/mlcflow/sessions/65d4f25c-8e7e-4b32-a7cf-a2489b2c4da4 Co-authored-by: arjunsuresh <4791823+arjunsuresh@users.noreply.github.com> --- mlc/error_codes.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/mlc/error_codes.py b/mlc/error_codes.py index 685a62144..4f31efceb 100644 --- a/mlc/error_codes.py +++ b/mlc/error_codes.py @@ -19,6 +19,11 @@ def __init__(self, code, description): ERROR_CODES = {error.code for error in ErrorCode} +ERROR_CODE_PATTERNS = [ + re.compile(r'(?:error|exit|return)\s+code\s*[:=]?\s*(\d+)', re.IGNORECASE), + re.compile(r'\[errno\s+(\d+)\]', re.IGNORECASE), + re.compile(r'signal\s+(\d+)', re.IGNORECASE), +] class WarningCode(Enum): """Enum class for warning codes in MLCFlow""" @@ -98,14 +103,8 @@ def detect_error_code(return_code=None, error_message=""): normalized_return_code = _normalize_code(return_code) message = error_message or "" - patterns = [ - r'(?:error|exit|return)\s+code\s*[:=]?\s*(\d+)', - r'\[errno\s+(\d+)\]', - r'signal\s+(\d+)', - ] - - for pattern in patterns: - match = re.search(pattern, message, re.IGNORECASE) + for pattern in ERROR_CODE_PATTERNS: + match = pattern.search(message) if match: detected = _normalize_code(match.group(1)) # Prefer the code extracted from the error text when the outer From 61ac17e99b82e9310a98b70abdb74bc79b4c3f5f Mon Sep 17 00:00:00 2001 From: mlc-automations <3246381+mlc-automations@users.noreply.github.com> Date: Fri, 22 May 2026 11:46:13 +0000 Subject: [PATCH 08/10] [Automated Commit] Format Codebase --- mlc/error_codes.py | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/mlc/error_codes.py b/mlc/error_codes.py index 4f31efceb..b6f43199e 100644 --- a/mlc/error_codes.py +++ b/mlc/error_codes.py @@ -1,18 +1,21 @@ import re from enum import Enum, auto + class ErrorCode(Enum): """Enum class for error codes in MLCFlow""" # General errors (2000-2007) - AUTOMATION_SCRIPT_NOT_FOUND = (2000, "The specified automation script was not found") + AUTOMATION_SCRIPT_NOT_FOUND = ( + 2000, "The specified automation script was not found") PATH_DOES_NOT_EXIST = (2001, "Provided path does not exists") FILE_NOT_FOUND = (2002, "Required file was not found") PERMISSION_DENIED = (2003, "Insufficient permission to execute the script") IO_Error = (2004, "File I/O operation failed") AUTOMATION_CUSTOM_ERROR = (2005, "Custom error triggered by the script") - UNSUPPORTED_OS = (2006, "The Operating System is not supported by the script") + UNSUPPORTED_OS = ( + 2006, "The Operating System is not supported by the script") MISSING_ENV_VARIABLE = (2007, "Required environment variables are missing") - + def __init__(self, code, description): self.code = code self.description = description @@ -25,35 +28,44 @@ def __init__(self, code, description): re.compile(r'signal\s+(\d+)', re.IGNORECASE), ] + class WarningCode(Enum): """Enum class for warning codes in MLCFlow""" # General warnings (1000-1007) IO_WARNING = (1000, "File I/O operation warning") - AUTOMATION_SCRIPT_NOT_TESTED = (1001, "the script is not tested on the current operatinig system or is in a development state") - AUTOMATION_SCRIPT_SKIPPED = (1002, "The script has been skipped during execution") + AUTOMATION_SCRIPT_NOT_TESTED = ( + 1001, + "the script is not tested on the current operatinig system or is in a development state") + AUTOMATION_SCRIPT_SKIPPED = ( + 1002, "The script has been skipped during execution") AUTOMATION_CUSTOM_ERROR = (1003, "Custom warning triggered by the script") NON_INTERACTIVE_ENV = (1004, "Non interactive environment detected") ELEVATED_PERMISSION_NEEDED = (1005, "Elevated permission needed") EMPTY_TARGET = (1006, "The specified target is empty") - + def __init__(self, code, description): self.code = code self.description = description + def get_error_info(error_code): """Get the error message for a given error code""" try: - return {"error_code": ErrorCode(error_code).code, "error_message": ErrorCode(error_code).description} + return {"error_code": ErrorCode( + error_code).code, "error_message": ErrorCode(error_code).description} except ValueError: return f"Unknown error code: {error_code}" + def get_warning_info(warning_code): """Get the warning message for a given warning code""" try: - return {"warning_code": WarningCode(warning_code).code, "warning_message": WarningCode(warning_code).description} + return {"warning_code": WarningCode( + warning_code).code, "warning_message": WarningCode(warning_code).description} except ValueError: return f"Unknown warning code: {warning_code}" + def is_warning_code(code): """Check if a given code is a warning code""" try: @@ -65,6 +77,7 @@ def is_warning_code(code): except ValueError: return False + def is_error_code(code): """Check if a given code is an error code""" try: @@ -76,6 +89,7 @@ def is_error_code(code): except ValueError: return False + def get_code_type(code): """Get the type of a code (error or warning)""" if is_error_code(code): @@ -192,4 +206,4 @@ def get_error_guidance(return_code=None, error_message=""): if not guidance["error_message"] and not guidance["suggestions"]: return None - return guidance \ No newline at end of file + return guidance From 11733b8b1e951c0b34583f25ce955718414422a9 Mon Sep 17 00:00:00 2001 From: mlc-automations <3246381+mlc-automations@users.noreply.github.com> Date: Fri, 22 May 2026 13:37:44 +0000 Subject: [PATCH 09/10] [Automated Commit] Format Codebase --- mlc/script_action.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mlc/script_action.py b/mlc/script_action.py index e7868dde8..bee4d9f00 100644 --- a/mlc/script_action.py +++ b/mlc/script_action.py @@ -342,7 +342,8 @@ def call_script_module_function(self, function_name, run_args): f"Script {function_name} execution failed in {module_path}. \nError : {error}", script_name=_script_name, repo_alias=_repo_alias, module_path=module_path, run_args=run_args, version_info_file=_version_info_file, - error_code=error_guidance.get('error_code') if error_guidance else None, + error_code=error_guidance.get( + 'error_code') if error_guidance else None, error_guidance=error_guidance) if str(run_args.get("mlc_output")).lower() in [ From bfd555a67b579a0a3a535572b3a0ee59306591cf Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 22 May 2026 15:18:24 +0000 Subject: [PATCH 10/10] ci: run error guidance test in core actions workflow Agent-Logs-Url: https://github.com/mlcommons/mlcflow/sessions/1631b761-e890-491f-8cb0-2fa4749c7327 Co-authored-by: arjunsuresh <4791823+arjunsuresh@users.noreply.github.com> --- .github/workflows/test-mlc-core-actions.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/test-mlc-core-actions.yaml b/.github/workflows/test-mlc-core-actions.yaml index 40b4917b9..7392b4196 100644 --- a/.github/workflows/test-mlc-core-actions.yaml +++ b/.github/workflows/test-mlc-core-actions.yaml @@ -103,6 +103,10 @@ jobs: - name: Test 3b - pull repo --force handling run: | python .github/scripts/test_repo_pull_force.py + + - name: Test 3c - error guidance handling + run: | + python .github/scripts/test_error_guidance.py - name: Test 4 - list repo - List the existing repositories run: |