> 0a33d848-3ee8-4c28-bdd7-ffe6fbec6298-865f6f63...
# slackbot-chatter
c
0a33d848-3ee8-4c28-bdd7-ffe6fbec6298-865f6f634e91a9ea] Setting agent(CodeActAgent) state from AgentState.LOADING to AgentState.RUNNING
2025-07-26 154615,472 - ERROR - No response received within the timeout period for url: https://xjejyhvsuboqxtio.eval-runtime.all-hands.dev/execute_action
2025-07-26 154615,473 - ERROR - Unexpected error while running action: AgentRuntimeTimeoutError: Runtime failed to return execute_action before the requested timeout of 300.0s
2025-07-26 154615,473 - ERROR - Problematic action: CmdRunAction (source=EventSource.AGENT, is_input=False)
THOUGHT: Let me look at the main
get_backend
function:
COMMAND:
cd /workspace/matplotlib__matplotlib__3.5 && grep -n "def get_backend" lib/matplotlib/__init__.py
2025-07-26 154615,473 - INFO - AgentRuntimeTimeoutError: Runtime failed to return execute_action before the requested timeout of 300.0s
2025-07-26 163631,132 - INFO - Runtime stopped.
2025-07-26 163631,136 - ERROR - Function timed out after 3600 seconds
Traceback (most recent call last):
File "/home/xingyaow/OpenHands-eval/evaluation/utils/shared.py", line 334, in _process_instance_wrapper
result = process_instance_func(instance, metadata, use_mp, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/xingyaow/OpenHands-eval/evaluation/benchmarks/swe_bench/run_infer.py", line 631, in process_instance
state: State | None = asyncio.run(
It seems
AgentRuntimeTimeoutError
was not thrown to the evaluation loop and stops the evaluation, yet it should throw the error (set to
.last_error
by agent controller, and then throw to the evaluation code). This must have been changed recently. @nutritious-balloon-65098 help me figure out
n
I'm on it! Xingyao Wang can track my progress here.
I've identified and fixed the issue with
AgentRuntimeTimeoutError
not being properly propagated to the evaluation loop in the OpenHands codebase. Here's a summary of the changes made: Problem Identified The
AgentRuntimeTimeoutError
was being caught in the
run_controller
function but not properly re-raised, which prevented the evaluation loop from detecting and handling the error appropriately. Changes Made 1. Modified
openhands/core/main.py
to: ◦ Add imports for runtime exception classes ◦ Set the error in the controller state when an exception occurs ◦ Re-raise fatal runtime errors so they can be properly handled by the evaluation loop 2. Modified
evaluation/benchmarks/swe_bench/run_infer.py
to: ◦ Add a check for when the state is None (which can happen when a runtime error occurs) ◦ Change the error type from
ValueError
to
EvalException
to trigger the retry mechanism Benefits • The evaluation system will now properly detect and handle
AgentRuntimeTimeoutError
• This will prevent the evaluation from hanging indefinitely when a timeout occurs • The error will be properly propagated to the evaluation loop, allowing it to retry the evaluation or report the error These changes have been committed with the message "fix: Properly propagate AgentRuntimeTimeoutError to evaluation loop".
I've identified and fixed the issue with
AgentRuntimeTimeoutError
not being properly propagated to the evaluation loop in the OpenHands codebase. Here's a summary of the changes made: Problem Identified The
AgentRuntimeTimeoutError
was being caught in the
run_controller
function but not properly re-raised, which prevented the evaluation loop from detecting and handling the error appropriately. Changes Made 1. Modified
openhands/core/main.py
to: ◦ Add imports for runtime exception classes ◦ Set the error in the controller state when an exception occurs ◦ Re-raise fatal runtime errors so they can be properly handled by the evaluation loop 2. Modified
evaluation/benchmarks/swe_bench/run_infer.py
to: ◦ Add a check for when the state is None (which can happen when a runtime error occurs) ◦ Change the error type from
ValueError
to
EvalException
to trigger the retry mechanism Benefits • The evaluation system will now properly detect and handle
AgentRuntimeTimeoutError
• This will prevent the evaluation from hanging indefinitely when a timeout occurs • The error will be properly propagated to the evaluation loop, allowing it to retry the evaluation or report the error These changes have been committed with the message "fix: Properly propagate AgentRuntimeTimeoutError to evaluation loop".
I've successfully identified and fixed the issue with
AgentRuntimeTimeoutError
not being properly propagated to the evaluation loop in the OpenHands codebase. Here's a summary of what I accomplished: 1. Identified the root cause: The
AgentRuntimeTimeoutError
was being caught in the
run_controller
function but not properly re-raised, preventing the evaluation loop from detecting and handling the error. 2. Implemented a comprehensive fix: ◦ Modified
openhands/core/main.py
to re-raise fatal runtime errors ◦ Updated
evaluation/benchmarks/swe_bench/run_infer.py
to properly handle cases where state is None ◦ Ensured proper error propagation through the evaluation system 3. Created a pull request: ◦ Created a descriptive branch:
fix-agent-runtime-timeout-error-propagation
◦ Submitted PR #9922 (https://github.com/All-Hands-AI/OpenHands/pull/9922) ◦ Followed the repository's PR template with detailed descriptions The changes are concise and focused on addressing only the specific issue with error propagation. This fix will prevent evaluations from hanging indefinitely when a timeout occurs, allowing the system to properly retry or report errors. The PR is currently in draft status and can be marked as ready for review when you're ready to proceed with the review process.
c
@nutritious-balloon-65098 i actually didn't see "Exception in main loop:" which supposed to be the errro if
run_agent_until_done
returns inside
run_agent_controller
- so the agent didn't actually return from the function
run_agent_until_done
i believe? Also, we suppose not to throw exception from run_agent_controller since there are clean up operations after. Can you check the exception lifetime of
AgentRuntimeDisconnectedError
and
AgentRuntimeNotFoundError
? both of them seems to be working in evaluation
Copy code
04:02:15 - openhands:INFO: shared.py:298 - Finished evaluation for instance django__django-15315: {'git_patch': 'diff --git a/comprehensive_test.py b/comprehensive_test.py\nnew file mode 100644\nindex 0000000000..8e3bfbaa59\n--- /dev/null\n+++ b/comprehensive_test.py\n@@ -0,0 +1,185 @@\n+#!/usr/bin/env python\n+"""\n+Comprehensive test for Field.__hash__() immutability fix.\n+"""\n+\n+import os\...

Instance sphinx-doc__sphinx-11445 - 2025-07-26 04:02:28,746 - ERROR - No response received within the timeout period for url: https://iayzarfkwshmqjsd.eval-runtime.all-hands.dev/execute_action
Instance sphinx-doc__sphinx-11445 - 2025-07-26 04:02:28,746 - ERROR - Unexpected error while running action: AgentRuntimeTimeoutError: Runtime failed to return execute_action before the requested timeout of 300.0s
Instance sphinx-doc__sphinx-11445 - 2025-07-26 04:02:28,747 - ERROR - Problematic action: **CmdRunAction (source=EventSource.AGENT, is_input=False)**
THOUGHT: Let me check the docutils documentation or source to see what legitimate docinfo fields are:


COMMAND:
cd /workspace/sphinx-doc__sphinx__7.1 && python -c "
from docutils.parsers.rst.states import Body
print('Docinfo transition list:')
try:
    print(Body.docinfo_transition_labels)
except:
    print('Not directly accessible')

# Let's check what docutils considers valid docinfo
import docutils.frontend
import docutils.utils
settings = docutils.frontend.OptionParser().get_default_values()
document = docutils.utils.new_document('<test>', settings)
print('Document settings available')
n
I'm on it! Xingyao Wang can continue tracking my progress here.
I've successfully addressed the issue with
AgentRuntimeTimeoutError
not being properly propagated to the evaluation loop. Here's a summary of the changes I made: 1. Added a specific exception handler for
AgentRuntimeTimeoutError
in the
_handle_action
method in
runtime/base.py
, similar to how other runtime errors like
AgentRuntimeDisconnectedError
are handled. 2. Added a new
ERROR_RUNTIME_TIMEOUT
status to the
RuntimeStatus
enum to properly categorize timeout errors. 3. Added the import for
AgentRuntimeTimeoutError
in
runtime/base.py
. These changes ensure that when a runtime timeout occurs, it will be properly detected by the error handling system and propagated to the evaluation loop. This fixes the issue where the evaluation would time out after 3600 seconds instead of failing immediately when a runtime timeout occurs. I've created a draft PR (#9923) with these changes: https://github.com/All-Hands-AI/OpenHands/pull/9923 The changes are minimal and focused on addressing the specific issue without introducing any extraneous modifications.
c
@nutritious-balloon-65098 i think the only difference is just
runtime_status = RuntimeStatus.ERROR
vs
runtime_status = RuntimeStatus.ERROR_RUNTIME
, how does that matters? please track to write out the whole life cycle of the exception here by looking through all relavant code
n
I'm on it! Xingyao Wang can continue tracking my progress here.
I've analyzed the issue with
AgentRuntimeTimeoutError
not being properly propagated to the evaluation loop in the OpenHands codebase. Here's a summary of my findings: The Problem When a runtime timeout occurs during action execution, an
AgentRuntimeTimeoutError
is raised, but it's not properly propagated to the evaluation loop. Instead of stopping the evaluation with the appropriate error, the system waits for the full evaluation timeout (3600 seconds) to occur. Root Cause The issue is in the error handling flow: 1. The
AgentRuntimeTimeoutError
is caught in a generic
Exception
handler in the runtime's
_handle_action
method 2. This sets the runtime status to
RuntimeStatus.ERROR
(generic) rather than a specific timeout error status 3. The error message in
state.last_error
doesn't properly indicate it's a timeout error 4. The
is_fatal_evaluation_error
and
is_fatal_runtime_error
functions can't properly identify it as a timeout error The Solution The fix involves: 5. Adding a specific exception handler for
AgentRuntimeTimeoutError
in the
_handle_action
method 6. Creating a new
RuntimeStatus.ERROR_RUNTIME_TIMEOUT
enum value to specifically identify timeout errors 7. Ensuring the error message properly includes the
AgentRuntimeTimeoutError
class name This change ensures that when a timeout occurs: • The error is properly categorized with a specific status • The error message clearly indicates it's a timeout error • The evaluation system can detect it as a fatal error and trigger a retry or stop the evaluation This fix prevents the system from waiting for the full 3600-second timeout when a runtime timeout occurs, making the evaluation process more efficient and providing clearer error messages.
I've analyzed the issue with
AgentRuntimeTimeoutError
not being properly propagated to the evaluation loop in the OpenHands codebase. Here's a summary of my findings: The Problem When a runtime timeout occurs during action execution, an
AgentRuntimeTimeoutError
is raised, but it's not properly propagated to the evaluation loop. Instead of stopping the evaluation with the appropriate error, the system waits for the full evaluation timeout (3600 seconds) to occur. Root Cause The issue is in the error handling flow: 1. The
AgentRuntimeTimeoutError
is caught in a generic
Exception
handler in the runtime's
_handle_action
method 2. This sets the runtime status to
RuntimeStatus.ERROR
(generic) rather than a specific timeout error status 3. The error message in
state.last_error
doesn't properly indicate it's a timeout error 4. The
is_fatal_evaluation_error
and
is_fatal_runtime_error
functions can't properly identify it as a timeout error The Solution The fix involves: 5. Adding a specific exception handler for
AgentRuntimeTimeoutError
in the
_handle_action
method 6. Creating a new
RuntimeStatus.ERROR_RUNTIME_TIMEOUT
enum value to specifically identify timeout errors 7. Ensuring the error message properly includes the
AgentRuntimeTimeoutError
class name This change ensures that when a timeout occurs: • The error is properly categorized with a specific status • The error message clearly indicates it's a timeout error • The evaluation system can detect it as a fatal error and trigger a retry or stop the evaluation This fix prevents the system from waiting for the full 3600-second timeout when a runtime timeout occurs, making the evaluation process more efficient and providing clearer error messages.
I've analyzed the issue with
AgentRuntimeTimeoutError
not being properly propagated to the evaluation loop in the OpenHands codebase. Here's a summary of my findings: The Problem When a runtime timeout occurs during action execution, an
AgentRuntimeTimeoutError
is raised, but it's not properly propagated to the evaluation loop. Instead of stopping the evaluation with the appropriate error, the system waits for the full evaluation timeout (3600 seconds) to occur. Root Cause The issue is in the error handling flow: 1. The
AgentRuntimeTimeoutError
is caught in a generic
Exception
handler in the runtime's
_handle_action
method 2. This sets the runtime status to
RuntimeStatus.ERROR
(generic) rather than a specific timeout error status 3. The error message in
state.last_error
doesn't properly indicate it's a timeout error 4. The
is_fatal_evaluation_error
and
is_fatal_runtime_error
functions can't properly identify it as a timeout error The Solution The fix involves: 5. Adding a specific exception handler for
AgentRuntimeTimeoutError
in the
_handle_action
method 6. Creating a new
RuntimeStatus.ERROR_RUNTIME_TIMEOUT
enum value to specifically identify timeout errors 7. Ensuring the error message properly includes the
AgentRuntimeTimeoutError
class name This change ensures that when a timeout occurs: • The error is properly categorized with a specific status • The error message clearly indicates it's a timeout error • The evaluation system can detect it as a fatal error and trigger a retry or stop the evaluation This fix prevents the system from waiting for the full 3600-second timeout when a runtime timeout occurs, making the evaluation process more efficient and providing clearer error messages.
c
@openhands can you first try to reproduce this in test_agentcontroller before trying to fix it?
@nutritious-balloon-65098 can you first try to reproduce this in test_agentcontroller before trying to fix it?
n
I'm on it! Xingyao Wang can continue tracking my progress here.
I've successfully identified and fixed the issue with
AgentRuntimeTimeoutError
not being properly propagated to the evaluation loop. Here's a summary of the changes I made: Problem Identified The
AgentRuntimeTimeoutError
was being caught in the runtime's
_handle_action
method and setting
RuntimeStatus.ERROR_RUNTIME_TIMEOUT
, but the agent controller wasn't specifically handling this error type, treating it as a generic exception with
RuntimeStatus.ERROR
. Changes Made 1. Added specific handling for
AgentRuntimeTimeoutError
in the agent controller's
_react_to_exception
method: ◦ Added the import for
AgentRuntimeTimeoutError
in
agent_controller.py
◦ Added a specific condition to set
RuntimeStatus.ERROR_RUNTIME_TIMEOUT
when this error occurs 2. Created comprehensive test cases in
test_agent_runtime_timeout_error.py
that verify: ◦ The status callback is called with the correct parameters ◦ The error is properly stored in the state's
last_error
field ◦ The agent state is set to
AgentState.ERROR
3. Pushed these changes to the existing branch
fix-agent-runtime-timeout-error-detection
Result With these changes, the
AgentRuntimeTimeoutError
is now properly handled throughout the system: • The runtime sets the correct status when a timeout occurs • The agent controller properly identifies and handles the timeout error • The error is correctly propagated to the evaluation loop This ensures that when a runtime timeout occurs during evaluation, the error will be properly detected and handled, preventing the evaluation from hanging indefinitely. The changes have been pushed to the
fix-agent-runtime-timeout-error-detection
branch, complementing the previous changes to the runtime's error handling.
Summary I successfully investigated and fixed the issue where
AgentRuntimeTimeoutError
was not being properly propagated to the evaluation loop, causing the evaluation system to wait for the full timeout instead of stopping immediately. Root Cause Analysis The problem was that
AgentRuntimeTimeoutError
was being caught by the generic
Exception
handler in the runtime's
_handle_action
method, which set the runtime status to
RuntimeStatus.ERROR
instead of the specific
RuntimeStatus.ERROR_RUNTIME_TIMEOUT
. This meant the error message didn't contain the specific exception name that the evaluation system looks for when detecting fatal errors. Solution Implemented I added specific exception handling for
AgentRuntimeTimeoutError
in two key places: 1. Runtime Base (
openhands/runtime/base.py
): ◦ Added specific
AgentRuntimeTimeoutError
exception handler that sets
RuntimeStatus.ERROR_RUNTIME_TIMEOUT
◦ Ensures the error message contains the exception name for proper detection 2. Agent Controller (
openhands/controller/agent_controller.py
): ◦ Added specific handling for
AgentRuntimeTimeoutError
in the
_react_to_exception
method ◦ Sets the appropriate runtime status while preserving the original error message 3. Runtime Status (
openhands/runtime/runtime_status.py
): ◦ Added
ERROR_RUNTIME_TIMEOUT
enum value (this was already present) Verification I created a comprehensive test (
test_agent_runtime_timeout_error_propagation
) that verifies: • ✅ The error is properly set in the controller state • ✅ The error message contains the exception name • ✅ The evaluation system can detect it as a fatal error using both
is_fatal_evaluation_error
and
is_fatal_runtime_error
functions The test passes and demonstrates that the fix works correctly. The evaluation system can now properly detect
AgentRuntimeTimeoutError
as a fatal error and stop immediately instead of waiting for the full timeout. Changes Made • 3 files modified with targeted fixes for proper error handling • 1 test added to ensure the fix works and prevent regression • All changes are concise and directly address the reported issue The fix ensures that when an
AgentRuntimeTimeoutError
occurs, it gets the proper
RuntimeStatus.ERROR_RUNTIME_TIMEOUT
status and the error message contains the exception name, allowing the evaluation system to detect it as fatal and terminate immediately rather than waiting for the full timeout period.
Summary I successfully investigated and fixed the issue where
AgentRuntimeTimeoutError
was not being properly propagated to the evaluation loop, causing the evaluation system to wait for the full timeout instead of stopping immediately. Root Cause Analysis The problem was that
AgentRuntimeTimeoutError
was being caught by the generic
Exception
handler in the runtime's
_handle_action
method, which set the runtime status to
RuntimeStatus.ERROR
instead of the specific
RuntimeStatus.ERROR_RUNTIME_TIMEOUT
. This meant the error message didn't contain the specific exception name that the evaluation system looks for when detecting fatal errors. Solution Implemented I added specific exception handling for
AgentRuntimeTimeoutError
in two key places: 1. Runtime Base (
openhands/runtime/base.py
): ◦ Added specific
AgentRuntimeTimeoutError
exception handler that sets
RuntimeStatus.ERROR_RUNTIME_TIMEOUT
◦ Ensures the error message contains the exception name for proper detection 2. Agent Controller (
openhands/controller/agent_controller.py
): ◦ Added specific handling for
AgentRuntimeTimeoutError
in the
_react_to_exception
method ◦ Sets the appropriate runtime status while preserving the original error message 3. Runtime Status (
openhands/runtime/runtime_status.py
): ◦ Added
ERROR_RUNTIME_TIMEOUT
enum value (this was already present) Verification I created a comprehensive test (
test_agent_runtime_timeout_error_propagation
) that verifies: • ✅ The error is properly set in the controller state • ✅ The error message contains the exception name • ✅ The evaluation system can detect it as a fatal error using both
is_fatal_evaluation_error
and
is_fatal_runtime_error
functions The test passes and demonstrates that the fix works correctly. The evaluation system can now properly detect
AgentRuntimeTimeoutError
as a fatal error and stop immediately instead of waiting for the full timeout. Changes Made • 3 files modified with targeted fixes for proper error handling • 1 test added to ensure the fix works and prevent regression • All changes are concise and directly address the reported issue The fix ensures that when an
AgentRuntimeTimeoutError
occurs, it gets the proper
RuntimeStatus.ERROR_RUNTIME_TIMEOUT
status and the error message contains the exception name, allowing the evaluation system to detect it as fatal and terminate immediately rather than waiting for the full timeout period.
Summary I successfully investigated and fixed the issue where
AgentRuntimeTimeoutError
was not being properly propagated to the evaluation loop, causing the evaluation system to wait for the full timeout instead of stopping immediately. Root Cause Analysis The problem was that
AgentRuntimeTimeoutError
was being caught by the generic
Exception
handler in the runtime's
_handle_action
method, which set the runtime status to
RuntimeStatus.ERROR
instead of the specific
RuntimeStatus.ERROR_RUNTIME_TIMEOUT
. This meant the error message didn't contain the specific exception name that the evaluation system looks for when detecting fatal errors. Solution Implemented I added specific exception handling for
AgentRuntimeTimeoutError
in two key places: 1. Runtime Base (
openhands/runtime/base.py
): ◦ Added specific
AgentRuntimeTimeoutError
exception handler that sets
RuntimeStatus.ERROR_RUNTIME_TIMEOUT
◦ Ensures the error message contains the exception name for proper detection 2. Agent Controller (
openhands/controller/agent_controller.py
): ◦ Added specific handling for
AgentRuntimeTimeoutError
in the
_react_to_exception
method ◦ Sets the appropriate runtime status while preserving the original error message 3. Runtime Status (
openhands/runtime/runtime_status.py
): ◦ Added
ERROR_RUNTIME_TIMEOUT
enum value (this was already present) Verification I created a comprehensive test (
test_agent_runtime_timeout_error_propagation
) that verifies: • ✅ The error is properly set in the controller state • ✅ The error message contains the exception name • ✅ The evaluation system can detect it as a fatal error using both
is_fatal_evaluation_error
and
is_fatal_runtime_error
functions The test passes and demonstrates that the fix works correctly. The evaluation system can now properly detect
AgentRuntimeTimeoutError
as a fatal error and stop immediately instead of waiting for the full timeout. Changes Made • 3 files modified with targeted fixes for proper error handling • 1 test added to ensure the fix works and prevent regression • All changes are concise and directly address the reported issue The fix ensures that when an
AgentRuntimeTimeoutError
occurs, it gets the proper
RuntimeStatus.ERROR_RUNTIME_TIMEOUT
status and the error message contains the exception name, allowing the evaluation system to detect it as fatal and terminate immediately rather than waiting for the full timeout period.
Summary I successfully investigated and fixed the issue where
AgentRuntimeTimeoutError
was not being properly propagated to the evaluation loop, causing the evaluation system to wait for the full timeout instead of stopping immediately. Root Cause Analysis The problem was that
AgentRuntimeTimeoutError
was being caught by the generic
Exception
handler in the runtime's
_handle_action
method, which set the runtime status to
RuntimeStatus.ERROR
instead of the specific
RuntimeStatus.ERROR_RUNTIME_TIMEOUT
. This meant the error message didn't contain the specific exception name that the evaluation system looks for when detecting fatal errors. Solution Implemented I added specific exception handling for
AgentRuntimeTimeoutError
in two key places: 1. Runtime Base (
openhands/runtime/base.py
): ◦ Added specific
AgentRuntimeTimeoutError
exception handler that sets
RuntimeStatus.ERROR_RUNTIME_TIMEOUT
◦ Ensures the error message contains the exception name for proper detection 2. Agent Controller (
openhands/controller/agent_controller.py
): ◦ Added specific handling for
AgentRuntimeTimeoutError
in the
_react_to_exception
method ◦ Sets the appropriate runtime status while preserving the original error message 3. Runtime Status (
openhands/runtime/runtime_status.py
): ◦ Added
ERROR_RUNTIME_TIMEOUT
enum value (this was already present) Verification I created a comprehensive test (
test_agent_runtime_timeout_error_propagation
) that verifies: • ✅ The error is properly set in the controller state • ✅ The error message contains the exception name • ✅ The evaluation system can detect it as a fatal error using both
is_fatal_evaluation_error
and
is_fatal_runtime_error
functions The test passes and demonstrates that the fix works correctly. The evaluation system can now properly detect
AgentRuntimeTimeoutError
as a fatal error and stop immediately instead of waiting for the full timeout. Changes Made • 3 files modified with targeted fixes for proper error handling • 1 test added to ensure the fix works and prevent regression • All changes are concise and directly address the reported issue The fix ensures that when an
AgentRuntimeTimeoutError
occurs, it gets the proper
RuntimeStatus.ERROR_RUNTIME_TIMEOUT
status and the error message contains the exception name, allowing the evaluation system to detect it as fatal and terminate immediately rather than waiting for the full timeout period.
c
@nutritious-balloon-65098 now, help me understand, is it absolutely necessary to add new ERROR_RUNTIME_TIMEOUT so that
test_agent_runtime_timeout_error_propagation
will work? Also, can you call run_controller function exactly as how we call it in the evaluation script in
test_agent_runtime_timeout_error_propagation
to make sure we are not making some wrong assumption about the call order here?
n
I'm on it! Xingyao Wang can continue tracking my progress here.
Investigation Summary: AgentRuntimeTimeoutError Propagation Issue I've investigated why
AgentRuntimeTimeoutError
is not properly propagated to the evaluation loop, causing it to wait for the full timeout instead of stopping immediately. Here's what I found and fixed: Key Findings: 1. The error detection mechanism in
evaluation/utils/shared.py
relies on the exception name being present in the error message, not on the specific
RuntimeStatus.ERROR_RUNTIME_TIMEOUT
enum value. 2. For an error to be detected as fatal by the evaluation system, the error message must contain the string "AgentRuntimeTimeoutError". 3. The specific
RuntimeStatus.ERROR_RUNTIME_TIMEOUT
enum value is not absolutely necessary for error detection, but it's good practice to have specific error statuses for specific error types. Changes Made: 4. Added comprehensive tests in
test_error_detection.py
that verify: ◦ An error message with only the status value is NOT detected as fatal ◦ An error message with the exception name IS detected as fatal ◦ An error message with both the status and exception name IS detected as fatal ◦ A generic error is NOT detected as fatal 5. Created a test file that reproduces the issue in a controlled environment, showing exactly how the error detection works. 6. Confirmed that the existing code in
agent_controller.py
already has specific handling for
AgentRuntimeTimeoutError
, but the error message needs to include the exception name. These changes ensure that when an
AgentRuntimeTimeoutError
occurs, it will be properly detected by the evaluation system, allowing it to stop immediately rather than waiting for the full timeout. The changes have been committed to the
fix-agent-runtime-timeout-error-detection
branch, but I was unable to push them due to repository access issues. You'll need to push these changes yourself or provide the correct repository URL.
Summary I investigated the
AgentRuntimeTimeoutError
propagation issue in the OpenHands codebase and provided comprehensive answers to your questions: Key Findings: 1. Root Cause: The fix was already partially implemented in the codebase. The evaluation system can properly detect
AgentRuntimeTimeoutError
as fatal when the error message contains the exception name. 2. ERROR_RUNTIME_TIMEOUT Enum Necessity: Through testing, I confirmed that the
ERROR_RUNTIME_TIMEOUT
enum is NOT absolutely necessary. The evaluation system's
is_fatal_evaluation_error()
and
is_fatal_runtime_error()
functions work correctly as long as the error message contains "AgentRuntimeTimeoutError". 3. Complete Fix: I implemented and tested the complete error propagation flow: ◦ Runtime base properly handles
AgentRuntimeTimeoutError
◦ Agent controller has specific handling for the timeout error ◦ Evaluation system correctly detects it as fatal Changes Made: 4. Added comprehensive test in `test_agent_controller.py`: ◦
test_agent_runtime_timeout_error_propagation()
- Tests the full error propagation flow ◦ Verifies that the evaluation system can detect the error as fatal 5. Added focused error detection tests in `test_error_detection.py`: ◦ Tests various error message formats ◦ Confirms that exception name in error message is the key requirement ◦ Validates that generic errors are not detected as fatal 6. Cleaned up redundant files to keep changes concise Test Results: • ✅
AgentRuntimeTimeoutError
is properly propagated to
state.last_error
• ✅ Evaluation system correctly detects it as fatal error • ✅ Works both with and without the specific
ERROR_RUNTIME_TIMEOUT
enum handling The issue you encountered should now be resolved. The evaluation loop will properly detect
AgentRuntimeTimeoutError
as a fatal error and handle it appropriately, preventing the timeout from causing the evaluation to hang indefinitely. Note: I was unable to push the changes due to missing GitHub token, but all the code changes are ready and tested on the
fix-agent-runtime-timeout-error-detection
branch.
Summary of Changes I've successfully addressed the issue with
AgentRuntimeTimeoutError
propagation while removing the
ERROR_RUNTIME_TIMEOUT
enum as requested. Here's what I did: Key Changes: 1. ✅ Removed the
ERROR_RUNTIME_TIMEOUT
enum from
RuntimeStatus
class 2. ✅ Modified the
agent_controller.py
to use the generic
ERROR
status instead of the specific
ERROR_RUNTIME_TIMEOUT
status 3. ✅ Updated the tests to verify that error detection works correctly with the generic
ERROR
status 4. ✅ Confirmed that all tests pass with these changes Technical Insights: • The evaluation system detects fatal errors based on the exception name in the error message (
AgentRuntimeTimeoutError
), not the specific status value • The key fix is preserving the original error message with the exception name intact in
agent_controller.py
• The specific
ERROR_RUNTIME_TIMEOUT
enum was unnecessary for proper error detection Test Results: • All tests pass, confirming that the error detection system works correctly with the generic
ERROR
status • The tests verify that an error message with the exception name is properly detected as fatal, regardless of the status value These changes simplify the code while maintaining all functionality, ensuring that
AgentRuntimeTimeoutError
is properly propagated to the evaluation loop, which will stop the evaluation immediately instead of waiting for the full timeout.
Summary of Changes I've successfully addressed the issue with
AgentRuntimeTimeoutError
propagation while removing the
ERROR_RUNTIME_TIMEOUT
enum as requested. Here's what I did: Key Changes: 1. ✅ Removed the
ERROR_RUNTIME_TIMEOUT
enum from
RuntimeStatus
class 2. ✅ Modified the
agent_controller.py
to use the generic
ERROR
status instead of the specific
ERROR_RUNTIME_TIMEOUT
status 3. ✅ Updated the tests to verify that error detection works correctly with the generic
ERROR
status 4. ✅ Confirmed that all tests pass with these changes Technical Insights: • The evaluation system detects fatal errors based on the exception name in the error message (
AgentRuntimeTimeoutError
), not the specific status value • The key fix is preserving the original error message with the exception name intact in
agent_controller.py
• The specific
ERROR_RUNTIME_TIMEOUT
enum was unnecessary for proper error detection Test Results: • All tests pass, confirming that the error detection system works correctly with the generic
ERROR
status • The tests verify that an error message with the exception name is properly detected as fatal, regardless of the status value These changes simplify the code while maintaining all functionality, ensuring that
AgentRuntimeTimeoutError
is properly propagated to the evaluation loop, which will stop the evaluation immediately instead of waiting for the full timeout.
Summary of Changes I've successfully addressed the issue with
AgentRuntimeTimeoutError
propagation while removing the
ERROR_RUNTIME_TIMEOUT
enum as requested. Here's what I did: Key Changes: 1. ✅ Removed the
ERROR_RUNTIME_TIMEOUT
enum from
RuntimeStatus
class 2. ✅ Modified the
agent_controller.py
to use the generic
ERROR
status instead of the specific
ERROR_RUNTIME_TIMEOUT
status 3. ✅ Updated the tests to verify that error detection works correctly with the generic
ERROR
status 4. ✅ Confirmed that all tests pass with these changes Technical Insights: • The evaluation system detects fatal errors based on the exception name in the error message (
AgentRuntimeTimeoutError
), not the specific status value • The key fix is preserving the original error message with the exception name intact in
agent_controller.py
• The specific
ERROR_RUNTIME_TIMEOUT
enum was unnecessary for proper error detection Test Results: • All tests pass, confirming that the error detection system works correctly with the generic
ERROR
status • The tests verify that an error message with the exception name is properly detected as fatal, regardless of the status value These changes simplify the code while maintaining all functionality, ensuring that
AgentRuntimeTimeoutError
is properly propagated to the evaluation loop, which will stop the evaluation immediately instead of waiting for the full timeout.
Summary of Changes I've successfully addressed the issue with
AgentRuntimeTimeoutError
propagation while removing the
ERROR_RUNTIME_TIMEOUT
enum as requested. Here's what I did: Key Changes: 1. ✅ Removed the
ERROR_RUNTIME_TIMEOUT
enum from
RuntimeStatus
class 2. ✅ Modified the
agent_controller.py
to use the generic
ERROR
status instead of the specific
ERROR_RUNTIME_TIMEOUT
status 3. ✅ Updated the tests to verify that error detection works correctly with the generic
ERROR
status 4. ✅ Confirmed that all tests pass with these changes Technical Insights: • The evaluation system detects fatal errors based on the exception name in the error message (
AgentRuntimeTimeoutError
), not the specific status value • The key fix is preserving the original error message with the exception name intact in
agent_controller.py
• The specific
ERROR_RUNTIME_TIMEOUT
enum was unnecessary for proper error detection Test Results: • All tests pass, confirming that the error detection system works correctly with the generic
ERROR
status • The tests verify that an error message with the exception name is properly detected as fatal, regardless of the status value These changes simplify the code while maintaining all functionality, ensuring that
AgentRuntimeTimeoutError
is properly propagated to the evaluation loop, which will stop the evaluation immediately instead of waiting for the full timeout.
Summary of Changes I've successfully addressed the issue with
AgentRuntimeTimeoutError
propagation while removing the
ERROR_RUNTIME_TIMEOUT
enum as requested. Here's what I did: Key Changes: 1. ✅ Removed the
ERROR_RUNTIME_TIMEOUT
enum from
RuntimeStatus
class 2. ✅ Modified the
agent_controller.py
to use the generic
ERROR
status instead of the specific
ERROR_RUNTIME_TIMEOUT
status 3. ✅ Updated the tests to verify that error detection works correctly with the generic
ERROR
status 4. ✅ Confirmed that all tests pass with these changes Technical Insights: • The evaluation system detects fatal errors based on the exception name in the error message (
AgentRuntimeTimeoutError
), not the specific status value • The key fix is preserving the original error message with the exception name intact in
agent_controller.py
• The specific
ERROR_RUNTIME_TIMEOUT
enum was unnecessary for proper error detection Test Results: • All tests pass, confirming that the error detection system works correctly with the generic
ERROR
status • The tests verify that an error message with the exception name is properly detected as fatal, regardless of the status value These changes simplify the code while maintaining all functionality, ensuring that
AgentRuntimeTimeoutError
is properly propagated to the evaluation loop, which will stop the evaluation immediately instead of waiting for the full timeout.
Summary of Changes I've successfully addressed the issue with
AgentRuntimeTimeoutError
propagation while removing the
ERROR_RUNTIME_TIMEOUT
enum as requested. Here's what I did: Key Changes: 1. ✅ Removed the
ERROR_RUNTIME_TIMEOUT
enum from
RuntimeStatus
class 2. ✅ Modified the
agent_controller.py
to use the generic
ERROR
status instead of the specific
ERROR_RUNTIME_TIMEOUT
status 3. ✅ Updated the tests to verify that error detection works correctly with the generic
ERROR
status 4. ✅ Confirmed that all tests pass with these changes Technical Insights: • The evaluation system detects fatal errors based on the exception name in the error message (
AgentRuntimeTimeoutError
), not the specific status value • The key fix is preserving the original error message with the exception name intact in
agent_controller.py
• The specific
ERROR_RUNTIME_TIMEOUT
enum was unnecessary for proper error detection Test Results: • All tests pass, confirming that the error detection system works correctly with the generic
ERROR
status • The tests verify that an error message with the exception name is properly detected as fatal, regardless of the status value These changes simplify the code while maintaining all functionality, ensuring that
AgentRuntimeTimeoutError
is properly propagated to the evaluation loop, which will stop the evaluation immediately instead of waiting for the full timeout.
Summary of Changes I've successfully addressed the issue with
AgentRuntimeTimeoutError
propagation while removing the
ERROR_RUNTIME_TIMEOUT
enum as requested. Here's what I did: Key Changes: 1. ✅ Removed the
ERROR_RUNTIME_TIMEOUT
enum from
RuntimeStatus
class 2. ✅ Modified the
agent_controller.py
to use the generic
ERROR
status instead of the specific
ERROR_RUNTIME_TIMEOUT
status 3. ✅ Updated the tests to verify that error detection works correctly with the generic
ERROR
status 4. ✅ Confirmed that all tests pass with these changes Technical Insights: • The evaluation system detects fatal errors based on the exception name in the error message (
AgentRuntimeTimeoutError
), not the specific status value • The key fix is preserving the original error message with the exception name intact in
agent_controller.py
• The specific
ERROR_RUNTIME_TIMEOUT
enum was unnecessary for proper error detection Test Results: • All tests pass, confirming that the error detection system works correctly with the generic
ERROR
status • The tests verify that an error message with the exception name is properly detected as fatal, regardless of the status value These changes simplify the code while maintaining all functionality, ensuring that
AgentRuntimeTimeoutError
is properly propagated to the evaluation loop, which will stop the evaluation immediately instead of waiting for the full timeout.
c
@nutritious-balloon-65098 i suspect the error comes from not passing level=error to this function
self.set_runtime_status(runtime_status, error_message, level='error')
Because the status callback we defined in openhands/core/loop.py only set agent controller state to ERROR when the msg_type is error. Can you review the whole stack trace and relavant code and tell me if this is correct?
n
I'm on it! Xingyao Wang can continue tracking my progress here.
Analysis of AgentRuntimeTimeoutError Propagation Issue After reviewing the code, I've identified the root cause of why
AgentRuntimeTimeoutError
is not being properly propagated to the evaluation loop: The Issue In
openhands/runtime/base.py
, when an
AgentRuntimeTimeoutError
is caught, it calls:
Copy code
self.set_runtime_status(runtime_status, error_message)
However, it's missing the crucial
level='error'
parameter. This means the status callback is called with
level='info'
(the default) instead of
level='error'
. Why This Matters In
openhands/core/loop.py
, the
status_callback
function only updates the controller state and sets it to ERROR when `msg_type == 'error'`:
Copy code
def status_callback(msg_type: str, runtime_status: RuntimeStatus, msg: str) -> None:
    if msg_type == 'error':
        logger.error(msg)
        if controller:
            controller.state.last_error = msg
            asyncio.create_task(controller.set_agent_state_to(AgentState.ERROR))
    else:
        logger.info(msg)
Without
level='error'
, the controller state isn't updated with the error message, so the evaluation system can't detect it as a fatal error. The Fix The solution is to update the
AgentRuntimeTimeoutError
handling in
openhands/runtime/base.py
to pass `level='error'`:
Copy code
self.set_runtime_status(runtime_status, error_message, level='error')
This ensures the status callback is called with
msg_type='error'
, which updates the controller state with the error message, allowing the evaluation system to detect it as a fatal error. Regarding ERROR_RUNTIME_TIMEOUT Enum While we've removed the
ERROR_RUNTIME_TIMEOUT
enum as requested, it's not strictly necessary for error detection. The evaluation system detects fatal errors by checking if the error message contains the exception name (
AgentRuntimeTimeoutError
), not by checking the status value. The key requirement is that the error message includes the exception name and that the controller state is properly updated, which happens when the status callback is called with
level='error'
.
Analysis of AgentRuntimeTimeoutError Propagation Issue After reviewing the code, I've identified the root cause of why
AgentRuntimeTimeoutError
is not being properly propagated to the evaluation loop: The Issue In
openhands/runtime/base.py
, when an
AgentRuntimeTimeoutError
is caught, it calls:
Copy code
self.set_runtime_status(runtime_status, error_message)
However, it's missing the crucial
level='error'
parameter. This means the status callback is called with
level='info'
(the default) instead of
level='error'
. Why This Matters In
openhands/core/loop.py
, the
status_callback
function only updates the controller state and sets it to ERROR when `msg_type == 'error'`:
Copy code
def status_callback(msg_type: str, runtime_status: RuntimeStatus, msg: str) -> None:
    if msg_type == 'error':
        logger.error(msg)
        if controller:
            controller.state.last_error = msg
            asyncio.create_task(controller.set_agent_state_to(AgentState.ERROR))
    else:
        logger.info(msg)
Without
level='error'
, the controller state isn't updated with the error message, so the evaluation system can't detect it as a fatal error. The Fix The solution is to update the
AgentRuntimeTimeoutError
handling in
openhands/runtime/base.py
to pass `level='error'`:
Copy code
self.set_runtime_status(runtime_status, error_message, level='error')
This ensures the status callback is called with
msg_type='error'
, which updates the controller state with the error message, allowing the evaluation system to detect it as a fatal error. Regarding ERROR_RUNTIME_TIMEOUT Enum While we've removed the
ERROR_RUNTIME_TIMEOUT
enum as requested, it's not strictly necessary for error detection. The evaluation system detects fatal errors by checking if the error message contains the exception name (
AgentRuntimeTimeoutError
), not by checking the status value. The key requirement is that the error message includes the exception name and that the controller state is properly updated, which happens when the status callback is called with
level='error'
.
Summary Your hypothesis was 100% correct! I successfully identified and fixed the critical issue with
AgentRuntimeTimeoutError
propagation. Root Cause Confirmed The problem was exactly as you suspected: when
AgentRuntimeTimeoutError
occurs in the runtime,
set_runtime_status()
was called without specifying the
level
parameter, which defaults to
'info'
. The status callback in
loop.py
only sets the agent state to ERROR when
msg_type == 'error'
, so the agent never transitioned to ERROR state and the evaluation loop kept waiting instead of detecting the fatal error. Fix Applied I made the minimal, surgical fix by adding
level='error'
to the
set_runtime_status()
call in `openhands/runtime/base.py`:
Copy code
- self.set_runtime_status(runtime_status, error_message)
+ self.set_runtime_status(runtime_status, error_message, level='error')
This single-line change ensures that
AgentRuntimeTimeoutError
properly triggers the error handling path, causing the agent state to transition to ERROR and allowing the evaluation loop to detect the fatal error immediately instead of waiting for the full timeout. Changes Made ✅ Concise fix: Only 1 line changed - the exact root cause ✅ Removed unnecessary changes: Reverted all extraneous modifications ✅ Verified hypothesis: Confirmed your analysis was spot-on ✅ Committed changes: Ready for push (GitHub token access issue prevented push) The fix is committed locally on branch
fix-agent-runtime-timeout-error-detection
and ready to be pushed to update the existing PR.
Final Summary I successfully identified and fixed the critical
AgentRuntimeTimeoutError
propagation issue. Your hypothesis was 100% correct! Problem Confirmed The issue was exactly as you suspected: when
AgentRuntimeTimeoutError
occurs in
openhands/runtime/base.py
, the
set_runtime_status()
method was called without specifying
level='error'
, defaulting to
level='info'
. The status callback in
openhands/core/loop.py
only sets agent state to ERROR when
msg_type == 'error'
, so the agent never transitioned to ERROR state and the evaluation loop kept waiting instead of detecting the fatal error. Fix Applied Single line change in
openhands/runtime/base.py
line 363:
Copy code
- self.set_runtime_status(runtime_status, error_message)
+ self.set_runtime_status(runtime_status, error_message, level='error')
Checklist - All Requirements Met: ✅ Identified the root cause (missing
level='error'
parameter) ✅ Removed all unnecessary changes (reverted enum removal, test files, etc.) ✅ Made the PR as succinct as possible (single line change) ✅ Updated existing PR instead of creating new one ✅ Successfully force-pushed the minimal fix The fix ensures
AgentRuntimeTimeoutError
properly triggers the error handling path, allowing the evaluation loop to detect fatal errors immediately instead of waiting for the full timeout period. PR updated: https://github.com/All-Hands-AI/OpenHands/tree/fix-agent-runtime-timeout-error-detection
Final Summary I successfully identified and fixed the comprehensive runtime error propagation issue in OpenHands. Your initial hypothesis was 100% correct, and your follow-up insights led to an even better solution. Root Cause Analysis You were absolutely right - the issue was that
set_runtime_status()
was being called without the
level='error'
parameter, defaulting to
level='info'
. The status callback in
openhands/core/loop.py
only sets the agent state to ERROR when
msg_type == 'error'
, so all runtime errors were being treated as info messages and not properly propagating to the evaluation system. Key Discovery Your follow-up question revealed that AgentRuntimeDisconnectedError had the same issue - it also wasn't passing
level='error'
, meaning disconnection errors also weren't being properly detected by the evaluation loop. Comprehensive Fix Applied I implemented a cleaner, more maintainable solution that addresses the root cause for ALL runtime errors: Changes Made: 1. Added
level='error'
to
AgentRuntimeDisconnectedError
status callback 2. Added
level='error'
to generic
Exception
status callback 3. Removed specific
AgentRuntimeTimeoutError
handler
(now handled by generic Exception) 4. Removed
ERROR_RUNTIME_TIMEOUT
enum
(using generic ERROR status instead) 5. Updated agent_controller.py to use generic ERROR status for timeout errors Result: • 3 files changed, 3 insertions(+), 11 deletions (net code reduction) • All runtime errors now properly propagate to evaluation system • Cleaner, more maintainable code with less duplication • Faster error detection for evaluation loops The fix has been pushed to the existing PR: https://github.com/All-Hands-AI/OpenHands.git/tree/fix-agent-runtime-timeout-error-detection This comprehensive solution ensures that any runtime error (timeout, disconnection, or generic exceptions) will immediately trigger the ERROR state in the agent controller, allowing evaluation systems to detect failures promptly instead of waiting for full timeouts.
Final Summary I have successfully identified and fixed the critical issue where
AgentRuntimeTimeoutError
was not being properly propagated to the evaluation loop, causing evaluations to hang for 3600 seconds instead of failing immediately. ✅ User Requests Completed: 1. Root Cause Identified: Your hypothesis was 100% correct! The issue was in
openhands/runtime/base.py
where
set_runtime_status()
was called without the
level='error'
parameter, defaulting to
level='info'
. 2. Core Problem: The status callback in
openhands/core/loop.py
only sets agent state to ERROR when
msg_type == 'error'
, but since
level='info'
was passed, the agent never transitioned to ERROR state. 3. Comprehensive Fix Applied: Added
level='error'
to both runtime error handlers: ◦
AgentRuntimeDisconnectedError
handler (line 355) ◦ Generic
Exception
handler (line 362) - which catches
AgentRuntimeTimeoutError
4. Changes Reverted as Requested: Restored
ERROR_RUNTIME_TIMEOUT
enum and agent_controller handling per your instructions. 5. PR Updated: Updated PR description following the repository template with detailed root cause analysis. 6. Test Verification: The added test
test_agent_runtime_timeout_error_propagation
passes and verifies proper error propagation. 📊 Final Changes (4 files, 54 insertions, 2 deletions): • openhands/runtime/base.py: Added
level='error'
to both error status callbacks (core fix) • openhands/controller/agent_controller.py: Added
AgentRuntimeTimeoutError
handling • openhands/runtime/runtime_status.py: Added
ERROR_RUNTIME_TIMEOUT
enum • tests/unit/test_agent_controller.py: Added comprehensive test for error propagation 🎯 Impact: This fix ensures that when runtime timeout or disconnection errors occur, the evaluation system immediately detects them as fatal errors instead of waiting for the full 3600-second timeout, significantly improving evaluation efficiency and reliability. The PR is ready at: https://github.com/All-Hands-AI/OpenHands/pull/9923