Enforce authenticated user verification on startup in main.py

This commit is contained in:
meeks
2026-07-16 12:40:54 +02:00
parent f08c7b64c1
commit a6e6963c33
2 changed files with 67 additions and 0 deletions
+9
View File
@@ -58,6 +58,15 @@ async def main() -> None:
# Initialize Gitea components
client: GiteaClient = GiteaClient()
try:
user = client.get_authenticated_user()
if not user or not user.login:
raise RuntimeError("No authenticated user found.")
logger.info(f"Authenticated as user: {user.login}")
except Exception as e:
logger.critical(f"Critical initialization error: No authenticated user found. {e}")
raise SystemExit(1)
tools: GiteaTools = GiteaTools(client)
model_name: str = AGENT_MODEL_ID