Matrix threads in the transport (M2.1, PR A)
CI / checks (push) Skipped
CI / checks (pull_request) Successful in 1m47s
CI / checks (push) Skipped
CI / checks (pull_request) Successful in 1m47s
Transport.post(text, thread=...) returns the event ID, which can root a thread; a threaded post carries m.thread with the reply fallback for clients without threads. Inbound messages carry their event ID and thread root: a message in a thread gives its root, a plain reply joins the thread of the message it replies to when known, and the quoted lines of a rich reply are no longer part of the text. The in-memory transport plays threads for tests. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PPQ14L3LikyefCMFBqEbKE
This commit is contained in:
1 parent
5077ed0067
commit
6dff36f458
4 files changed
+266
-12
No files matched your search
@@ -51,3 +51,25 @@ def test_send_lands_in_test_room(live_config: AgentConfig) -> None:
|
||||
assert marker in bodies
|
||||
finally:
|
||||
transport.close()
|
||||
|
||||
|
||||
def test_a_threaded_post_is_kept_in_its_thread(live_config: AgentConfig) -> None:
|
||||
"""The homeserver accepts the thread relation and lists the reply under
|
||||
its root (L5: a work item's conversation is a thread)."""
|
||||
config = live_config.matrix
|
||||
marker = uuid.uuid4().hex
|
||||
transport = MatrixTransport(config)
|
||||
try:
|
||||
_assert_testing_identity(transport, config)
|
||||
root = transport.post(f"thread smoke test root {marker}")
|
||||
reply = transport.post(f"thread smoke test reply {marker}", thread=root)
|
||||
# The relations API is v1, not the transport's v3.
|
||||
response = transport._http.get(
|
||||
f"{config.homeserver}/_matrix/client/v1/rooms/{config.room_id}"
|
||||
f"/relations/{root}/m.thread"
|
||||
)
|
||||
response.raise_for_status()
|
||||
in_thread = [e["event_id"] for e in response.json().get("chunk", [])]
|
||||
assert reply in in_thread
|
||||
finally:
|
||||
transport.close()
|
||||
Reference in new issue
Block a user