Skip to content

CLI: openclaw agents list fails with unresolved SecretRef; CLI process hangs after completion #66936

@richardmqq

Description

@richardmqq

Description

Two related bugs in the openclaw agents CLI commands:

Bug 1: agents list fails when Telegram botTokens use SecretRef

openclaw agents list calls buildProviderStatusIndex() which attempts to resolve Telegram botToken SecretRef entries. In CLI context (outside the gateway runtime), SecretRef resolution fails:

[openclaw] Failed to start CLI: Error: channels.telegram.accounts.claude.botToken: 
unresolved SecretRef "file:filemain:/telegram/claude/botToken". 
Resolve this command against an active gateway runtime snapshot before reading it.

Stack trace:

at assertSecretInputResolved (types.secrets-C9RpLzA0.js:61:8)
at normalizeResolvedSecretInputString (types.secrets-C9RpLzA0.js:66:2)
at resolveTelegramToken (token-BxA0B3me.js:41:23)
at buildProviderStatusIndex (agents-B6LfZxia.js:727:34)
at agentsListCommand (agents-B6LfZxia.js:862:31)

Expected behavior: agents list should gracefully degrade when secrets are unavailable — show agent list without Telegram status, or skip unresolvable accounts with a warning.

Bug 2: CLI process does not exit after command completion

All openclaw agents subcommands (add, delete, list, bind) complete their operations but the Node.js process never exits. Likely caused by unclosed handles/timers from plugin loading (e.g. native-tools-bridge).

This means the CLI hangs indefinitely until killed externally (SIGKILL from timeout, Ctrl-C, etc.).

For agents add and agents delete, the operations complete successfully before the hang, so the practical impact is cosmetic (process needs to be killed). For agents list, the operation fails (Bug 1) AND the process hangs.

Steps to Reproduce

Bug 1

  1. Configure Telegram accounts with SecretRef botTokens in openclaw.json
  2. Run openclaw agents list
  3. Observe the unresolved SecretRef error

Bug 2

  1. Run any openclaw agents subcommand (e.g. openclaw agents add test --workspace ~/.openclaw/workspace-test --model anthropic/claude-sonnet-4-6 --non-interactive)
  2. Observe the operation completes (config written, workspace created) but the process never exits
  3. Process must be killed externally

Environment

  • OpenClaw 2026.4.14 (323493f)
  • macOS 15.7.3 (Sequoia) arm64
  • Node.js v25.7.0
  • Secrets stored in secrets.json with source: "file", provider: "filemain" SecretRefs
  • Plugin: native-tools-bridge (non-bundled, discovered via extensions/)

Workaround

  • For agents list: read openclaw.json directly with python3 -c "import json; ..."
  • For agents add/delete/bind: the operations succeed despite the hang; just kill the process after seeing the expected output

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions