Set up no agent run for a request with no token or API key

The answer routes refuse such a request with 401, but only after building
the agent, so a public agent's prompt tools were pre-fetched, and their
actions run, for nobody. Anonymous chat without an agent key is not
supported, so the processor now stops before any setup and the route
answers 401 as before.
This commit is contained in:
arc53-machine committed 2026-09-29 15:46:32 +01:00
1 parent daf6af57ae
commit 029189fe0c
3 files changed
+66

No files matched your search

@@ -396,7 +396,13 @@ class StreamProcessor:
share it with the rest of the turn. It is always generated here, never
taken from the request body: request quotas count distinct request
ids, so a client-chosen id would let every call count as one.
A request with neither a token nor an agent API key has nobody to run
for: nothing is set up (no pre-fetch runs the agent's tools), None is
returned and the route answers 401.
"""
if not self.decoded_token and not self.data.get("api_key"):
return None
if not getattr(self, "request_id", None):
self.request_id = str(uuid.uuid4())
self.initialize()