feat(agent): integrate structured runner interactions

This commit is contained in:
fdc310
2026-07-22 11:12:26 +08:00
parent e3df35e7f7
commit 6b13c37c3b
58 changed files with 6153 additions and 319 deletions
@@ -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."""