Skip to content

The agent that grows with you

fix(gateway): every hosted room transport declares attachments

unsupportedpastels5fc69f9b1094
diff --git a/tests/tui_gateway/test_hosted_room_driver_runtime.py b/tests/tui_gateway/test_hosted_room_driver_runtime.py
index 9b9675e4072..852d22f748e 100644
--- a/tests/tui_gateway/test_hosted_room_driver_runtime.py
+++ b/tests/tui_gateway/test_hosted_room_driver_runtime.py
@@ -177,7 +177,7 @@ class FakeSessionRPC:
task: state.TaskIdentity,
execution_generation: int,
on_terminal,
- member_id="",
+ member_id="", attachments=None,
):
self._assert_lock(profile)
params = {
diff --git a/tests/tui_gateway/test_hosted_room_member_submit.py b/tests/tui_gateway/test_hosted_room_member_submit.py
index 93a492eb966..fe32988e240 100644
--- a/tests/tui_gateway/test_hosted_room_member_submit.py
+++ b/tests/tui_gateway/test_hosted_room_member_submit.py
@@ -61,6 +61,7 @@ class MemberIdRequiringRPC(FakeSessionRPC):
execution_generation: int,
on_terminal,
member_id: str,
+ attachments=None,
):
self.member_ids.append(member_id)
return super().submit(
diff --git a/tests/tui_gateway/test_hosted_room_service.py b/tests/tui_gateway/test_hosted_room_service.py
index cec66d09e01..3db279d35c1 100644
--- a/tests/tui_gateway/test_hosted_room_service.py
+++ b/tests/tui_gateway/test_hosted_room_service.py
@@ -68,7 +68,7 @@ class _FakeRPC:
task,
execution_generation,
on_terminal,
- member_id="",
+ member_id="", attachments=None,
):
on_terminal({"status": "settled", "text": f"reply from {profile}"})
return {"accepted": True}
@@ -280,7 +280,7 @@ class _PromptRecordingRPC(_FakeRPC):
task,
execution_generation,
on_terminal,
- member_id="",
+ member_id="", attachments=None,
):
self.prompts.append((profile, prompt))
on_terminal({"status": "settled", "text": f"reply from {profile}"})
diff --git a/tui_gateway/hosted_room_driver.py b/tui_gateway/hosted_room_driver.py
index 1ceb1046eb4..eb2b9176cc6 100644
--- a/tui_gateway/hosted_room_driver.py
+++ b/tui_gateway/hosted_room_driver.py
@@ -608,7 +608,7 @@ class HostedRoomRuntime:
transport.submit(
**_session_kw(profile, session_id), prompt=task["payload"]["prompt"],
task=attempt.identity, execution_generation=attempt.execution_generation,
- **({"attachments": attachments} if attachments else {}),
+ attachments=attachments,
member_id=_member_id(task),
on_terminal=lambda receipt: self._on_terminal(binding, attempt, receipt))
self._unavailable_route_retries.pop(
diff --git a/tui_gateway/hosted_room_peer_transport.py b/tui_gateway/hosted_room_peer_transport.py
index b0319c46107..461ff4bd1fe 100644
--- a/tui_gateway/hosted_room_peer_transport.py
+++ b/tui_gateway/hosted_room_peer_transport.py
@@ -196,8 +196,10 @@ class PeerHostedRoomTransport(InternalSessionRPC):
def submit(
self, *, profile: str, session_id: str, prompt: str, source: str, task: TaskIdentity,
execution_generation: int, on_terminal: Callable[[Mapping[str, Any]], None],
- member_id: str | None = None,
+ member_id: str | None = None, attachments: Sequence[Mapping[str, Any]] | None = None,
) -> Mapping[str, Any]:
+ if attachments: # the driver refuses files before submit on this route
+ raise ValueError("attachments_unsupported_on_route: peer route cannot carry files")
# The signed route names one member: a task for another member reached the wrong route.
if member_id is not None and member_id != self.route.member_id:
raise ValueError("peer room transport member does not match its grant")
diff --git a/tui_gateway/hosted_room_server_rpc.py b/tui_gateway/hosted_room_server_rpc.py
index a0f9b68d625..3b4f499aeb9 100644
--- a/tui_gateway/hosted_room_server_rpc.py
+++ b/tui_gateway/hosted_room_server_rpc.py
@@ -70,7 +70,10 @@ class HostedRoomServerRPC:
def submit(
self, *, profile: str, session_id: str, prompt: str, source: str, task: state.TaskIdentity,
execution_generation: int, on_terminal: Callable[[Mapping[str, Any]], None], member_id: str,
+ attachments: Sequence[Mapping[str, Any]] | None = None,
) -> Mapping[str, Any]:
+ if attachments: # the driver refuses files before submit on this route
+ raise ValueError("attachments_unsupported_on_route: in-process route cannot carry files")
try:
return self._call("prompt.submit", {
"profile": profile, "session_id": session_id, "text": prompt, "source": source,