fix: apply ruff lint and format fixes

- Remove unused variable 'original_error' in exception handler
- Format long function call arguments across multiple lines

Co-authored-by: openhands <openhands@all-hands.dev>
This commit is contained in:
openhands
2026-03-14 04:06:50 +00:00
parent 28d300adeb
commit 87176c62ff
2 changed files with 14 additions and 7 deletions

View File

@@ -347,7 +347,7 @@ class Runtime(FileEditRuntimeMixin):
return self._run_cmd_with_retry(
cmd, f'Failed to {context} for env vars {var_names}'
)
except RuntimeError as original_error:
except RuntimeError:
# Log the original error at debug level for operators, but redact secret values
# We only log the variable names, not the command which contains secrets
logger.debug(
@@ -438,7 +438,10 @@ class Runtime(FileEditRuntimeMixin):
logger.debug(f'Adding env vars to .bashrc: {var_names}')
self._run_env_cmd_redacted(
bashrc_cmd, 'persist environment variables to .bashrc', var_names, is_windows=False
bashrc_cmd,
'persist environment variables to .bashrc',
var_names,
is_windows=False,
)
def on_event(self, event: Event) -> None:

View File

@@ -167,7 +167,9 @@ class TestAddEnvVarsSecretRedaction:
# Should NOT contain any secret values
for secret in secrets.values():
assert secret not in error_message, f'Secret "{secret}" leaked in error message'
assert secret not in error_message, (
f'Secret "{secret}" leaked in error message'
)
# Should contain the variable names (keys) - they get uppercased
assert 'API_KEY' in error_message
@@ -277,10 +279,12 @@ class TestAddEnvVarsSecretRedaction:
runtime = StubRuntime(run_handler=run_handler)
# Should not raise
runtime.add_env_vars({
'VALID_VAR_1': 'value1',
'VALID_VAR_2': 'value2',
})
runtime.add_env_vars(
{
'VALID_VAR_1': 'value1',
'VALID_VAR_2': 'value2',
}
)
def test_var_names_are_uppercased_in_error(self):
"""Test that variable names in errors are uppercased as they would be set."""