Handle missing reviewer LLM credentials

This commit is contained in:
robert
2026-06-03 20:52:07 -03:00
parent 115afed40a
commit f13dd0ac72
2 changed files with 35 additions and 1 deletions

View File

@@ -69,6 +69,18 @@ class AgentReviewer(A2AAgent[ReviewerConfig, NoAuth]):
if not ctx.cp_jwt or not ctx.cp_url:
return {"error": "no cp_jwt; this agent must run through the orchestrator"}
creds = ctx.llm
if not creds.api_key:
return {
"error": "llm_credentials_missing",
"final": (
"LLM credentials were not available for this review. "
"Hosted reviewer runs should receive a platform LLM grant."
),
"agent_name": agent_name,
"ref": ref,
}
await ctx.emit_progress(f"requesting read-only Gitea token for {agent_name}@{ref}")
try:
mint = await ctx.mint_gitea_token(
@@ -88,7 +100,6 @@ class AgentReviewer(A2AAgent[ReviewerConfig, NoAuth]):
f"minted token {token_name} (read on {gitea_owner}/{agent_name})"
)
creds = ctx.llm
await ctx.emit_progress(f"llm: {creds.model} via {creds.source}")
completion_box: dict[str, ReviewReport] = {}