OpenCode credentials not detected although CLI auth works; task stalls at `OpenCode step started.`
Problem
WeSight reports “本机凭据未检测到本机登录或密钥” for OpenCode, even though OpenCode CLI itself detects credentials and can run normally.
In WeSight, an OpenCode task only shows:
OpenCode step started.
and does not proceed.
Environment
- macOS
- OpenCode binary:
/opt/homebrew/bin/opencode - OpenCode config directory:
~/.config/opencode - Config files present:
opencode.json,opencode.jsonc - Credentials file:
~/.local/share/opencode/auth.json
Verification
/opt/homebrew/bin/opencode auth list returns:
Credentials ~/.local/share/opencode/auth.json
DeepSeek api
Google api
Environment
DeepSeek DEEPSEEK_API_KEY
Google GEMINI_API_KEY
And this works successfully:
/opt/homebrew/bin/opencode run "只回复OK"
So OpenCode itself can detect and use the credentials correctly.
~/.config/opencode/opencode.json currently contains only:
{
"$schema": "https://opencode.ai/config.json"
}
Expected behavior
WeSight should detect the credentials that OpenCode already recognizes, and OpenCode tasks should continue past OpenCode step started..
Actual behavior
WeSight shows that no local login/key is detected and the OpenCode task stalls immediately after starting.
This looks like a WeSight-side credential detection / OpenCode process integration issue rather than an OpenCode authentication issue.
状态更新:修复 PR 是 #85,已同步到最新 main(f6dde0e),CI 全绿,等待维护者 review。
这个 issue 自 2026-08-26 起无活动,按仓库 stale.yml 的 60 天阈值,大约 2026-10-25 会被打上 stale 标签、再 14 天自动关闭。这条评论同时起到重置倒计时的作用——#61 就是在修复 PR 还开着的时候被 stale bot 关成 not_planned 的,离开列表不代表问题已解决。
PR #85 的根因与修复:OpenCode 的 auth.json 用 {"<provider>": {"api": "sk-..."}} 结构,键名 api 不在 WeSight 的通用凭据识别列表(api_key / auth_token 等)里,所以扫描结果为空,界面始终显示"未检测到本机登录或密钥",任务停在 OpenCode step started.。修复新增了针对该格式的专项解析,并额外处理了"已登录但没有声明模型"的情况(不写入默认模型,避免把未授权的 Anthropic 默认值固化进你的配置)。
提醒一句:#85 与 #83(opencode.jsonc 配置路径)在 applyProviderToLive 里有一处已知冲突,解法已写在 #85 的评论中,合并时注意顺序。