Handle missing reviewer LLM credentials
This commit is contained in:
13
agent.py
13
agent.py
@@ -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] = {}
|
||||
|
||||
Reference in New Issue
Block a user