Skip to content

WorkBuddy harness cannot authenticate in headless spawn: desktop-app login writes encrypted credentials the bundled CLI cannot read #464

Closed

Description

@zxd-666

Description

On macOS, the WorkBuddy harness always spawns the CLI bundled inside the WorkBuddy app (WorkBuddy.app/Contents/Resources/app.asar.unpacked/cli/bin/codebuddy) with an isolated config root (CODEBUDDY_CONFIG_DIR forced to ~/.workbuddy-ai, see workBuddyEnvironment in packages/adapters/hermes/workbuddy plugin command.ts).

That bundled CLI cannot authenticate in this headless-spawn context, even after the user signs in inside the WorkBuddy desktop app:

  • The desktop app's login writes credentials to ~/Library/Application Support/CodeBuddyExtension/Data/Public/auth/workbuddy-desktop.info, but the auth.accessToken stored there is an encrypted envelope ({"$wbEncrypted": 1, "envelope": "..."}). Decryption is tied to the GUI process's secure storage; there is no WorkBuddy Safe Storage keychain entry afterwards, and a directly spawned CLI child cannot decrypt it.
  • Meanwhile the standalone node CLI (codebuddy installed via npm, reading ~/.codebuddy with a plaintext JWT in Tencent-Cloud.coding-copilot.info) authenticates fine against the same account.

Result: every Turn fails with

WorkBuddy: Native Turn stopped: refusal (FAILED_MODEL_REQUEST)

and the native side logs:

[ACP Agent] refusal classified: category=auth, rpcCode=-32000
[ACP Agent] Prompt refused: errorMsg=Authentication required. Please use /login command to sign in to your account

There is no /login flow reachable from codexhost, so the user is stuck with no in-product remedy.

Environment

  • macOS (Apple Silicon)
  • codexhost 0.11.0
  • WorkBuddy.app with bundled CLI 2.147.0, standalone codebuddy CLI 2.151.0
  • WorkBuddy desktop app signed in (credentials present in CodeBuddyExtension/Data/Public/auth/)

Reproduction

  1. Install WorkBuddy.app and sign in inside the desktop app.
  2. In codexhost, create a WorkBuddy thread and send a message.
  3. Observe Native Turn stopped: refusal (FAILED_MODEL_REQUEST); ~/.workbuddy-ai/logs/** shows Prompt refused: ... Authentication required.

Expected behavior

One of:

  • The bundled CLI can consume the desktop app's login (decrypt the envelope or obtain a token via IPC with the running app), or
  • codexhost offers a supported way to authenticate the headless WorkBuddy CLI (a /login-equivalent handshake surfaced through the connection settings), or
  • The connection settings' launch path accepts a standalone codebuddy CLI and, in that mode, does not force CODEBUDDY_CONFIG_DIR away from the user's existing ~/.codebuddy login.

Workaround (verified)

Setting WORKBUDDY_CONFIG_DIR=/Users/<user>/.codebuddy (the env takes precedence when workBuddyEnvironment resolves the root) plus pointing the WorkBuddy launch path at the standalone node CLI makes the same flow authenticate and complete turns — but this relies on an undocumented escape hatch and shares the CodeBuddy session history.

Notes

The forced config isolation itself is a deliberate design (avoid leaking CodeBuddy history into WorkBuddy, per the code comment) — the gap is that no headless authentication path exists for the isolated root.

Activity

  1. BytePioneer-AI commented on Nov 13, 2026

    @BytePioneer-AI
    Owner

    PR #533 已加入 WorkBuddy 加密凭据引导并在 Windows 实测成功,现按修复已合入关闭,macOS 尚未完成实机验证;如升级后仍有问题,欢迎再次评论。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions