Repository navigation
Auto-enable channels.helloagent on first plugin import - #3
Merged
Merged
Conversation
`openclaw channels login --channel helloagent` previously failed with
"Unsupported channel: helloagent" on a fresh install. OpenClaw's CLI
resolver only knows third-party channels via either the bundled official
catalog (we're not in it) or `cfg.channels.<id>` (the
"configured-channels" loader scope). Without a cfg entry the resolver
short-circuits before the plugin code ever runs, so users had to
manually run `openclaw config set channels.helloagent.enabled true`
before their first login.
Add `ensureHelloAgentChannelEnabled()` and call it as a top-level side
effect from setup-entry.ts and index.ts. OpenClaw imports setup-entry
during `applyPluginAutoEnable`, which runs before the channel resolver,
so we get a chance to:
1. Persist `channels.helloagent.enabled = true` to disk via an atomic
temp-file rename with a `.bak` backup. Idempotent; respects an
existing `enabled: false` so a user opt-out is never overwritten.
2. Mutate the in-memory runtime config snapshot returned by
`getRuntimeConfig()` so the current invocation sees the new entry
immediately. Without this, the disk write would only take effect
on the *next* invocation (openclaw caches cfg per-process and
never re-reads from disk during a single command).
Both steps are best-effort and wrapped in try/catch; failures degrade
the UX (user has to re-run once) but never break the plugin import.
The in-memory patch uses `createRequire` to dynamically load
`openclaw/plugin-sdk/runtime-config-snapshot` so an older openclaw that
doesn't expose this SDK surface still imports cleanly.
Verified end-to-end on a clean slate:
plugins uninstall helloagent # no cfg entry, no install record
plugins install <local path> # installed; cfg still untouched
channels login --channel helloagent # resolves; prompts for ha_* token
config get channels.helloagent # { "enabled": true } now persisted
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Replace `npm install` (would install as a project dep, wrong for end users) with `openclaw plugins install`, the supported entry point. - Note that `channels.helloagent.enabled` is now set automatically on first import, so login no longer requires a prior `config set`. - Drop the now-defunct `config set` step from the run-from-source recipe. - Add a Troubleshooting section covering the most common failure modes: Unsupported channel, empty stdin, gateway not picking up creds, expired tokens, corp proxies, verbose logs. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Replace separate Install / Log in / Alternate-modes sections with one Get-started block: install → restart gateway (if running) → login. Single copy-pasteable recipe. - Drop the oauth / device pairing-mode docs — the import-token flow covers every supported environment, and the alternates have been a source of "which one do I run?" confusion. The env vars and code paths still exist for power users; they're just no longer surfaced. - Trim the env-var table to the variables that actually affect the documented import flow. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…t to manual recovery - Remove the Usage block (channels list/logout, dmPolicy table) and the Multiple accounts block. The Get-started recipe is enough; the rest belonged in dedicated docs, not the front-page README. - In the "Unsupported channel" troubleshooting step, add the `openclaw gateway restart` line between the cfg flag write and the retry login. Same reasoning as the Get-started block: a running gateway needs to reload its plugin registry to pick up the new channel. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Covers the helper that this PR introduces: - channelAlreadyDecided across six cfg shapes (empty, partial, primitive, enabled:true, enabled:false, non-object entry). - patchCfgInPlace preserves sibling channels and existing helloagent keys (dmPolicy, allowFrom) when merging in enabled:true. - End-to-end ensureHelloAgentChannelEnabled disk behavior: - Missing cfg → fresh write, no .bak. - Existing cfg → patch in + .bak rotation. - User opt-out (enabled:false) preserved byte-for-byte. - Already enabled → no-op (no rewrite, no .bak). - Corrupt cfg → leave it alone. - Idempotent per process (attempted guard). - Post-reset re-evaluates and patches without losing existing keys. Exposes a narrow __testing namespace from auto-enable-channel.ts for the helpers and an attempted-flag reset; not part of the public API. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
openclaw channels login --channel helloagentpreviously failed withUnsupported channel: helloagenton a fresh install. OpenClaw's CLI resolver only knows third-party channels via either the bundled official catalog (we're not in it) orcfg.channels.<id>(the configured-channels loader scope). Without a cfg entry the resolver short-circuits before our plugin code ever runs, so users had to manually runopenclaw config set channels.helloagent.enabled truebefore their first login.This PR adds
ensureHelloAgentChannelEnabled()and calls it as a top-level side effect fromsetup-entry.tsandindex.ts. OpenClaw importssetup-entryduringapplyPluginAutoEnable, which runs before the channel resolver — giving us a chance to:channels.helloagent.enabled = trueto disk via an atomic temp-file rename +.bakbackup. Idempotent. Respects an existingenabled: falseso a user opt-out is never overwritten.getRuntimeConfig()so the current invocation sees the new entry immediately. Without this, the disk write would only take effect on the next invocation (openclaw caches cfg per-process and never re-reads from disk during a single command).Both steps are best-effort and wrapped in try/catch; failures degrade the UX (user has to re-run once) but never break the plugin import. The in-memory patch uses
createRequireso an older openclaw that doesn't exposeruntime-config-snapshotstill imports cleanly.Files
src/core/auto-enable-channel.ts(new) — disk + in-memory cfg patchersetup-entry.ts— call the patcher at module top levelindex.ts— same, mirrored, so whichever entry openclaw imports first winsTest plan
plugins uninstall helloagent && config unset channels.helloagentplugins install /local/path— cfg still has no helloagent entry afterwardchannels login --channel helloagentsucceeds first try (prompts forha_*token, no "Unsupported channel" error)config get channels.helloagentreturns{ "enabled": true }(disk persistence)channels logininvocations are idempotentconfig set channels.helloagent.enabled falsesurvives the next plugin import (opt-out respected)🤖 Generated with Claude Code