[Bug]: [Platform] v0.4.0 conversation workspace: Claude Code with a Bearer-only Anthropic gateway fails (CLI_EXIT_NONZERO / misleading unrecognized_model)
Component / host
Platform — web / API
Edition
Platform
LoopForge version
v0.4.0
What happened?
Actual behavior
A conversation running on the Claude Code engine against a custom Anthropic-compatible
gateway that only accepts Authorization: Bearer fails after the turn enters the
conversation workspace.
-
The first local CLI phase ends normally (
exitCode: 0,protocol: completed). -
After
workbench_workspace_open, the resumed workspace attempt retries for ~3 minutes and exits 1. -
The platform reports:
code: CLI_EXIT_NONZERO message: CLI 异常退出,未完成本轮回复 error: exit status 1; stderr=[claude-code:unrecognized_model] {"model":"...","query_source":"sdk"} -
The CLI transcript for the workspace attempt shows 10 retries of:
401 Credentials missing. (MISSING_CREDENTIALS)
unrecognized_model is a benign warning: it also appears in the successful first
attempt, and the transcript records hasUnknownModelCost: true. It is not the failure
reason.
Expected behavior
The workspace turn should authenticate with the configured Claude Code key using Bearer,
exactly like the local phase. If authentication still fails, the platform should report
AUTHENTICATION_FAILED (401/403) instead of surfacing the unrecognized_model warning
as the error.
Why this is a v0.4.0 regression path
BindClaudeCode only sets ANTHROPIC_API_KEY (x-api-key) and never
ANTHROPIC_AUTH_TOKEN (Authorization: Bearer) — internal/runtime/command_binding.go,
case BindClaudeCode. This gap is old (present in v0.3.8 too), but v0.4.0 added
conversation-workspace execution (#494 / #947). The workspace resolves claude from
PATH (/opt/loopforge/conversation-cli/bin/claude, npm ^2.1.329) instead of the
host-configured AGENTFLOW_CLAUDE_BIN, so a host-side wrapper that maps
ANTHROPIC_API_KEY to ANTHROPIC_AUTH_TOKEN no longer covers this phase.
Additional context
- Verified outside the platform with the same key:
x-api-keyreturns 401MISSING_CREDENTIALS;Authorization: Bearerreturns 200 for the same model. isCredentialRejection(internal/httpapi/assistant.go) only matches text starting with401/403, soFailed to authenticate. API Error: 401 Credentials missingis not recognized and the real cause is hidden by the stderr warning.- Same binding is used by SOP/executor Claude Code runs.
- Official
api.anthropic.comis not affected; gateways that acceptx-api-keyare not affected. Impact requires: Claude Code engine + Bearer-only Base URL + workspace mode.
Reproduction
- In 个人配置, set a Claude Code API Key and a Base URL pointing to an
Anthropic-compatible gateway that requires
Authorization: Bearer. - Save at least one custom, non-Anthropic model id under Claude Code models.
- Start a new AI conversation, choose the Claude Code engine and that model.
- Send a message that makes the assistant open the conversation workspace (for example: "read the project files and summarize what this repo does").
- Observe
workbench_workspace_open; the turn then retries and fails withCLI_EXIT_NONZERO, while stderr only shows[claude-code:unrecognized_model]. - Open the turn diagnostics: attempt 1 is
completedwithexitCode: 0; attempt 2 (resume, workspace) retries401 Credentials missingand exits 1.
Expected: the workspace turn continues with Bearer auth, or reports a clear
authentication failure.
Actual: the turn fails and the diagnostic message points at unrecognized_model.
loopforge-diagnostics-afdmzs7neslbtf.json
Sanitized diagnostics
Safety checks
- [x] I removed credentials, private endpoints, internal identifiers, and personal data.
- [x] I searched existing issues for duplicates.
Thanks for the report. As I understand it, on LoopForge v0.4.0 a Claude Code conversation against an Anthropic-compatible gateway that only accepts Authorization: Bearer finishes the first local CLI phase, then fails after the conversation workspace opens, and the message shown is CLI_EXIT_NONZERO / unrecognized_model instead of a clear authentication failure.
We've seen this and will look at it alongside the existing open issues.