AI chat: streaming LLM 401 'No cookie auth credentials found' #130
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_aibroker#130
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Calling chat through the Hero OS AI island returns:
The UI echoes the user message correctly, but the upstream streaming endpoint rejects on auth.
Repro
LLM streaming API error 401 Unauthorized: No cookie auth credentials found.Context
The aibroker JSON-RPC endpoint (/rpc) was fixed in
0d90081(issue #129) via a route + socket symlink. The streaming endpoint is separate and appears to enforce cookie-based auth that the iframe-less Dioxus client doesn't carry.Expected
Streaming chat returns tokens.
Updated diagnosis: the
"No cookie auth credentials found"401 originates at OpenRouter, not at aibroker.hero_agent'sllm_client.rs:305-311final fallback target ishttps://openrouter.ai/api/v1/chat/completionswithapi_key: None, andtry_stream(llm_client.rs:668-671) only setsbearer_authwhentarget.api_keyisSome(_). So the request goes out anonymous, and OpenRouter responds with its standard cookie-auth-fallback 401.The actual root cause is the deployment env:
hero_agentandhero_aibrokerboth haveOPENROUTER_API_KEY=""(empty),GROQ_API_KEY="", noAIBROKER_API_ENDPOINT. Either:OPENROUTER_API_KEYon hero_agent (smallest fix), orAIBROKER_API_ENDPOINT=http://127.0.0.1:<port>/api/v1on hero_agent AND populate keys on hero_aibroker (so aibroker brokers the call).Recommend re-routing this issue to hero_agent or hero_os (Settings) since aibroker itself is correct — it just has no keys to forward.
Settings island in Hero OS displays a stored OpenRouter key (
••••••••test), so there's a propagation gap from the Settings store to thehero_agentservice env.Cookie auth path resolved — upstream now returns standard
invalid_api_key(an unrelated upstream-key issue, tracked separately as #133), no longerNo cookie auth credentials found. Verified live via Playwright on local hero_os_app.