Remove/reduce unused content in a CmdOutputObservation (#7404)

Co-authored-by: openhands <openhands@all-hands.dev>
This commit is contained in:
Engel Nyst
2025-07-17 19:34:46 +02:00
committed by GitHub
parent eecc00fa4a
commit e65e0a98f0
4 changed files with 105 additions and 2 deletions

View File

@@ -369,8 +369,11 @@ class ConversationMemory:
message: Message
if isinstance(obs, CmdOutputObservation):
# if it doesn't have tool call metadata, it was triggered by a user action
# Note: CmdOutputObservation content is already truncated at initialization,
# and the observation content should not have been modified after initialization
# we keep this truncation for backwards compatibility for a time
if obs.tool_call_metadata is None:
# if it doesn't have tool call metadata, it was triggered by a user action
text = truncate_content(
f'\nObserved result of command executed by user:\n{obs.to_agent_observation()}',
max_message_chars,