mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-11-21 07:55:08 +00:00
fix(discord): persist streamed final delivery
Carry the original reply anchor through stream metadata so a successful final Discord edit marks the recovered source message complete.
This commit is contained in:
parent
d5b9c1ee37
commit
9412f2dd84
4 changed files with 47 additions and 1 deletions
|
|
@ -735,6 +735,25 @@ async def test_send_uses_notify_metadata_as_final_delivery_signal(adapter):
|
|||
assert adapter._discord_message_is_persistently_complete("94") is True
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_final_stream_edit_marks_original_request_complete(adapter):
|
||||
channel = FakeChannel(channel_id=123)
|
||||
message = SimpleNamespace(edit=AsyncMock())
|
||||
channel.fetch_message = AsyncMock(return_value=message)
|
||||
adapter._client.get_channel = lambda _channel_id: channel
|
||||
|
||||
result = await adapter.edit_message(
|
||||
"123",
|
||||
"9009",
|
||||
"complete streamed response",
|
||||
finalize=True,
|
||||
metadata={"reply_to_message_id": "102"},
|
||||
)
|
||||
|
||||
assert result.success is True
|
||||
assert adapter._discord_message_is_persistently_complete("102") is True
|
||||
|
||||
|
||||
def test_disabled_recovery_does_not_create_hot_path_ledger(adapter, monkeypatch):
|
||||
monkeypatch.setenv("DISCORD_MISSED_MESSAGE_BACKFILL", "false")
|
||||
message = make_message(message_id=90)
|
||||
|
|
|
|||
|
|
@ -9,6 +9,22 @@ import pytest
|
|||
from gateway.stream_consumer import GatewayStreamConsumer, StreamConsumerConfig
|
||||
|
||||
|
||||
def test_stream_send_metadata_carries_original_reply_anchor():
|
||||
consumer = GatewayStreamConsumer(
|
||||
adapter=MagicMock(),
|
||||
chat_id="123",
|
||||
initial_reply_to_id="456",
|
||||
)
|
||||
|
||||
assert consumer._metadata_for_send(final=False) == {
|
||||
"reply_to_message_id": "456",
|
||||
}
|
||||
assert consumer._metadata_for_send(final=True) == {
|
||||
"reply_to_message_id": "456",
|
||||
"notify": True,
|
||||
}
|
||||
|
||||
|
||||
# ── _clean_for_display unit tests ────────────────────────────────────────
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue