mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-08-14 14:31:00 +00:00
feat(agent): integrate structured runner interactions
This commit is contained in:
@@ -366,6 +366,36 @@ class TestMessageAggregatorAddMessage:
|
||||
# Should have buffered the message
|
||||
assert len(agg.buffers) == 1
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_control_variables_bypass_aggregation(self):
|
||||
"""Interaction callbacks must not merge with nearby chat messages."""
|
||||
aggregator = get_aggregator_module()
|
||||
app = make_aggregator_app()
|
||||
mock_pipeline = Mock()
|
||||
mock_pipeline.pipeline_entity = Mock()
|
||||
mock_pipeline.pipeline_entity.config = {'trigger': {'message-aggregation': {'enabled': True, 'delay': 10.0}}}
|
||||
app.pipeline_mgr.get_pipeline_by_uuid = AsyncMock(return_value=mock_pipeline)
|
||||
agg = aggregator.MessageAggregator(app)
|
||||
|
||||
chain = text_chain('approve')
|
||||
await agg.add_message(
|
||||
bot_uuid='test-bot',
|
||||
launcher_type=provider_session.LauncherTypes.PERSON,
|
||||
launcher_id=12345,
|
||||
sender_id=12345,
|
||||
message_event=friend_message_event(chain),
|
||||
message_chain=chain,
|
||||
adapter=mock_adapter(),
|
||||
pipeline_uuid='test-pipeline',
|
||||
variables={'_interaction_submission': {'interaction_id': 'form-1'}},
|
||||
)
|
||||
|
||||
assert agg.buffers == {}
|
||||
app.query_pool.add_query.assert_awaited_once()
|
||||
assert app.query_pool.add_query.call_args.kwargs['variables'] == {
|
||||
'_interaction_submission': {'interaction_id': 'form-1'}
|
||||
}
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_max_buffer_flushes_immediately(self):
|
||||
"""Reaching MAX_BUFFER_MESSAGES should flush immediately."""
|
||||
|
||||
Reference in New Issue
Block a user