Replies: 2 comments
|
Dug into how "API 密钥无效" actually gets produced for a custom OpenAI-compatible provider like yours, and found two real, verified things worth knowing. For a pi-ai-routed provider (which a custom third-party endpoint like micu-grok goes through), the AUTH classification comes from packages/llm/llm-pi-ai/src/stream.ts:43: /\b(?:401|403)\b/.test(message) — a bare regex looking for the digits 401 or 403 anywhere in the flattened error string. There's a code comment right above it explaining why: pi-ai itself discards the original Error and its cause chain before handing it back, leaving only error.message text to pattern-match on. This is acknowledged tech debt, not an oversight, but it means any upstream text that happens to contain "401" or "403" as a standalone token, even in an unrelated context, gets classified as AUTH. Then it gets worse for diagnosing this: packages/client/ui-chat/src/client/conversation-nodes/event-projection.ts:157 does if (code === 'AUTH') return { code, message: '' } — once something is classified AUTH, the actual upstream message is thrown away before it reaches the UI. So even if this is a misclassification, there is currently no way to see the real text that triggered it. That matches your own ask exactly: exposing the original sanitized upstream status/message would let you tell a real 401 apart from a false-positive match. Since this classifier is shared code (not Web-specific), the headless-vs-Web difference is probably not the classification logic itself, both would hit the same function for the same request. More likely explanations: the Web session is genuinely getting a different response intermittently (matches your own "sometimes fails" framing, could be a real transient auth/quota hiccup from the gateway), or one of the third-party plugins you mentioned updating is touching the request or response only on the Web profile path. Worth checking whether the failure correlates with anything plugin-related, and if you can get to the raw network response (even temporarily patching that message: '' line locally to keep it) that would settle whether this is a real 401 or a false-positive substring match. |
|
Complementing the verified classification details above with the UI-side of the same chain (checked on master
|
Uh oh!
There was an error while loading. Please reload this page.
Bug: Web UI reports "API key is invalid" while headless works with the same provider
Environment
@deepseek-ai/dsh@0.1.2-rc.1v24.19.0micu-grokgrok-4.6No API key is included in this report.
Problem
In the DSH Web UI, sending a new message sometimes fails with:
However, the same DSH installation, provider configuration, model, and API credential work correctly in headless mode.
For example:
dsh --profile headless "只回复 OK,不要调用工具"returns successfully:
This strongly suggests that the API credential itself is valid, and the failure may be specific to the Web profile/provider path or error classification.
Expected behavior
The Web profile and headless profile should resolve and use the same configured provider credentials consistently.
If the upstream provider returns a different authorization-related error, such as:
the Web UI should expose the real sanitized error/status instead of always displaying:
Actual behavior
Headless:
Web UI:
Additional context
This installation was recently upgraded from an older DSH RC version to:
The Web profile also contains third-party plugins, some of which needed updates because of changes to the settings/client-runtime APIs in DSH 0.1.2.
However, since headless works correctly, the problem appears to be specific to the Web/profile execution path, provider credential resolution, or failure projection.
It would be very useful if DSH exposed the original sanitized upstream HTTP status and error message in this case.
All reactions