feat(server,watch): threads remember the dispatch origin header and report it back

This commit is contained in:
hh committed 2026-10-23 22:24:45 +02:00
1 parent f4c54b6e16
commit 7413223269
5 files changed
+42 -3

No files matched your search

+23
View File
@@ -625,6 +625,29 @@ async def test_dispatch_tracks_thread(client: Client, registry: Registry) -> Non
)
async def test_dispatch_remembers_its_origin(
client: Client, registry: Registry, monkeypatch: pytest.MonkeyPatch
) -> None:
from t3code_mcp import server
from t3code_mcp.watch import Event, Watcher
monkeypatch.setattr(
server, "get_http_headers", lambda: {"x-conversation-origin": "conv-7"}
)
async with client:
started = data(
await client.call_tool(
"t3_dispatch",
{"machine": "mac", "project": "t3-smoke", "prompt": "from a branch"},
)
)
tid = started["thread_id"]
assert registry.tracker.threads[tid].origin == "conv-7"
watcher = Watcher(registry, registry.tracker, None)
payload = await watcher.payload(Event("completed", tid, "mac"))
assert payload["origin"] == "conv-7"
def test_tracker_watch_flag(tmp_path) -> None:
from t3code_mcp.watch import Tracker