docs(agent): fix stale runtime comments about token injection

amStartTemplateAgent no longer claims OPENAI_API_KEY is uninjected or that
access_token is left empty for a future V2 path: the handler now mints +
injects both OPENAI_API_KEY and the per-agent AGENT_ACCESS_TOKEN (forwarded
as-is), and HM returns its own access_token to the client.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-04 22:29:40 +08:00
co-authored by Claude Opus 4.8
parent b01bba53f0
commit ed46acd4d3
+7 -5
View File
@@ -160,9 +160,9 @@ func amStartTemplateAgent(ctx context.Context, args amStartArgs) (amStartResult,
}
env["MODEL_NAME"] = modelName
env["OPENAI_BASE_URL"] = publicV1BaseURL()
// NOTE: OPENAI_API_KEY is intentionally NOT injected here — the desktop
// client passes its own api_key per A2A request (CODING_A2A §7). A future
// V2-decrypt path may hand the agent a scoped key instead.
// NOTE: OPENAI_API_KEY and AGENT_ACCESS_TOKEN are already in args.Env (the
// handler mints + injects them before calling us) and are forwarded as-is by
// the copy loop above. We don't add model/auth keys here.
// env may carry plaintext secrets (db password, blob key…) — warn on http.
base := agentRuntimeClientConfigForMode(agentRuntimeModeAgent).BaseURL
@@ -188,8 +188,10 @@ func amStartTemplateAgent(ctx context.Context, args amStartArgs) (amStartResult,
return amStartResult{}, err
}
// AM exposes the agent via access_info.{domain,external_ip}; the instance id
// is name/namespace. access_token is not issued by AM (auth = per-request
// api_key); left empty until the V2-decrypt path lands.
// is name/namespace. AM's access_token (if any) is ignored — HM mints its own
// per-agent access token (AGENT_ACCESS_TOKEN) and returns that to the client;
// AM authorizes callers by comparing the X-Agent-Access-Token header to its
// env AGENT_ACCESS_TOKEN locally.
subdomain := stringFromMap(data, "subdomain", "address", "url")
if subdomain == "" {
if ai, ok := data["access_info"].(map[string]any); ok {