mirror of
https://github.com/OpenHands/OpenHands.git
synced 2025-12-26 05:48:36 +08:00
Fix flaky test_condenser_metrics_included by creating new action objects (#11555)
Co-authored-by: openhands <openhands@all-hands.dev>
This commit is contained in:
parent
97403dfbdb
commit
58e690ef75
@ -1582,16 +1582,15 @@ async def test_condenser_metrics_included(mock_agent_with_stats, test_event_stre
|
||||
# Attach the condenser to the mock_agent
|
||||
mock_agent.condenser = condenser
|
||||
|
||||
# Create a real CondensationAction
|
||||
action = CondensationAction(
|
||||
forgotten_events_start_id=1,
|
||||
forgotten_events_end_id=5,
|
||||
summary='Test summary',
|
||||
summary_offset=1,
|
||||
)
|
||||
action._source = EventSource.AGENT # Required for event_stream.add_event
|
||||
|
||||
def agent_step_fn(state):
|
||||
# Create a new CondensationAction each time to avoid ID reuse
|
||||
action = CondensationAction(
|
||||
forgotten_events_start_id=1,
|
||||
forgotten_events_end_id=5,
|
||||
summary='Test summary',
|
||||
summary_offset=1,
|
||||
)
|
||||
action._source = EventSource.AGENT # Required for event_stream.add_event
|
||||
return action
|
||||
|
||||
mock_agent.step = agent_step_fn
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user