mirror of
https://github.com/bunny-lab-io/Borealis.git
synced 2025-10-26 22:01:59 -06:00
Guard identity creation with cross-process lock
This commit is contained in:
@@ -1068,6 +1068,16 @@ class AgentHttpClient:
|
||||
headers = self.auth_headers()
|
||||
response = self.session.post(url, json=payload, headers=headers, timeout=30)
|
||||
if response.status_code in (401, 403) and require_auth:
|
||||
snippet = ""
|
||||
try:
|
||||
snippet = response.text[:256]
|
||||
except Exception:
|
||||
snippet = "<unavailable>"
|
||||
_log_agent(
|
||||
"Authenticated request rejected "
|
||||
f"path={path} status={response.status_code} body_snippet={snippet}",
|
||||
fname="agent.error.log",
|
||||
)
|
||||
self.clear_tokens()
|
||||
self.ensure_authenticated()
|
||||
headers = self.auth_headers()
|
||||
|
||||
Reference in New Issue
Block a user