π OpenHands: AI-Driven Development
[Feat]: Add timestamp info to CmdOutputObservation (#7514)
Rohit Malhotraa18e0dbbb693
diff --git a/openhands/events/observation/commands.py b/openhands/events/observation/commands.pyindex db0c6ab9ee..f4983da5ca 100644--- a/openhands/events/observation/commands.py+++ b/openhands/events/observation/commands.py@@ -9,6 +9,7 @@ from pydantic import BaseModelfrom openhands.core.logger import openhands_logger as loggerfrom openhands.core.schema import ObservationTypefrom openhands.events.observation.observation import Observation+from datetime import datetime, timezoneCMD_OUTPUT_PS1_BEGIN = '\n###PS1JSON###\n'CMD_OUTPUT_PS1_END = '\n###PS1END###'@@ -161,6 +162,9 @@ class CmdOutputObservation(Observation):ret += f'\n[Python interpreter: {self.metadata.py_interpreter_path}]'if self.metadata.exit_code != -1:ret += f'\n[Command finished with exit code {self.metadata.exit_code}]'++ utc_now = datetime.now(timezone.utc)+ ret += f'\n[Timestamp (UTC): {utc_now.strftime('%a %b %d %H:%M:%S %Z %Y')}]' # Formatted time, e.g Mon Mar 25 22:01:53 UTC 2025return ret