Skip to content

Commit efa0606

Browse files
Fix bash executor session reuse by resetting closed sessions (#964)
Co-authored-by: openhands <[email protected]>
1 parent 67746a6 commit efa0606

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

openhands-tools/openhands/tools/execute_bash/impl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def __call__(
129129
if action.reset and action.is_input:
130130
raise ValueError("Cannot use reset=True with is_input=True")
131131

132-
if action.reset:
132+
if action.reset or self.session._closed:
133133
reset_result = self.reset()
134134

135135
# Handle command execution after reset

tests/tools/execute_bash/test_secrets_masking.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ def test_bash_executor_with_conversation_secrets():
6565
output="Token: secret-value-123, Key: another-secret-456",
6666
)
6767
mock_session.execute.return_value = mock_observation
68+
mock_session._closed = False
6869
executor.session = mock_session
6970

7071
# Execute command with conversation - secrets should be exported and masked

0 commit comments

Comments
 (0)