Repository navigation
fix(channels): fail-fast headless channel setup with plugin-declared env contracts - #122530
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 12, 2026, 1:10 PM ET / 17:10 UTC. ClawSweeper reviewWhat this changesThe PR makes non-interactive channel setup fail clearly when a wizard would be required, validates plugin-declared environment credentials before writing config, and documents headless provisioning. Merge readinessKeep open: current main still permits a headless wizard path and lacks generic plugin-declared environment validation; this branch repairs those paths with no blocking correctness finding. The remaining gate is exact merge-result validation for the additive plugin setup contract. Priority: P1 Review scores
Verification
How this fits togetherThe channels CLI selects either guided or headless setup, then asks the owning channel plugin to validate credentials before persisting account configuration. Plugin setup metadata describes portable requirements while channel-specific conditional rules remain with the plugin. flowchart LR
A[Operator runs channels add] --> B[Choose wizard or headless setup]
B --> C[Terminal interactivity check]
B --> D[Plugin setup metadata]
D --> E[Credential validation]
E --> F[Plugin-specific validation]
F --> G[Persist channel config]
G --> H[Refresh plugin registry]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +103, Tests +229, Docs +54, Config +14, Generated 0, Other +41. Total +441 across 72 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Land the single generic metadata path after exact merge-result validation, keeping mode-dependent credential rules inside their owning channel plugins. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main can enter wizard setup without a terminal guard and has no generic pre-write environment validation; this review did not run artifact-producing commands. Is this the best way to solve the issue? Yes: portable credential presence belongs in shared setup metadata and validation, while Slack's mode-specific requirements remain in the Slack plugin rather than leaking provider policy into core. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against bea0e398fa07. LabelsLabel justifications:
EvidenceAcceptance criteria:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (5 earlier review cycles)
|
ccaa508 to
858921c
Compare
61a6c4f to
33249a1
Compare
18392b4 to
6602a7e
Compare
Static --use-env declaration keeps only the unconditional SLACK_BOT_TOKEN; socket-vs-HTTP conditional requirements (app token, signing secret) stay in Slack's own setup validation so HTTP mode no longer demands an irrelevant SLACK_APP_TOKEN.
6602a7e to
a331817
Compare
…env contracts (openclaw#122530) * fix(channels): validate headless channel setup * docs(channels): document headless provisioning * fix(channels): repair setup metadata typing * chore(channels): regenerate official channel catalog for env metadata * fix(slack): keep mode-conditional env contract plugin-owned Static --use-env declaration keeps only the unconditional SLACK_BOT_TOKEN; socket-vs-HTTP conditional requirements (app token, signing secret) stay in Slack's own setup validation so HTTP mode no longer demands an irrelevant SLACK_APP_TOKEN. * chore(sdk): regenerate api baselines and catalog after rebase * fix(slack): align manifest env declaration with runtime contract * chore(sdk): regenerate api baselines after rebase * chore(sdk): regenerate api baselines after rebase * chore(sdk): regenerate api baselines after rebase
What Problem This Solves
Headless/cloud bootstrap needs scriptable channel provisioning, and
channels addhad three silent-failure defects in that path:openclaw channels add --channel <id>enters the interactive wizard with no TTY guard — an unattended script hangs forever (src/commands/channels/add.ts,src/wizard/clack-prompter.ts).--use-envsetups bypass required-credential validation without checking the environment variable actually exists (e.g. Telegram,extensions/telegram/src/setup-core.ts). A typo'd or missing env var yields a "configured" channel that never connects, with nothing explaining why. Buzz and Matrix already validated env presence locally — the policy existed, duplicated, in two plugins.--use-envwas broken end-to-end: setup cleared the stored key while runtime account resolution never readNOSTR_PRIVATE_KEY(extensions/nostr/src/setup-adapter.ts,extensions/nostr/src/types.ts) — a guaranteed dead channel.Why This Change Was Made
Second step of the cloud-container deployment track (after #122477): make
openclaw channels add --channel <id> --use-enva safe, fail-fast primitive for scripted deployments.channels addwithout a TTY now exits 1 with the non-interactive alternative named, instead of hanging. Guard placed inchannels add(notcreateClackPrompter, which has 14 other production consumers).useEnvboolean field gains optionalenvVars: readonly string[]andenvVarMode: "all" | "any"(src/channels/plugins/setup-contract.ts). Core validates presence generically at the shared account-config seam (src/channels/plugins/account-config-mutation.ts) and fails fast naming the exact missing variables. Channels without the declaration behave exactly as before, so third-party plugins are unaffected. Core stays plugin-agnostic — no channel names or env names in core.SLACK_BOT_TOKEN+SLACK_APP_TOKEN, Google Chat withany-of value/file, IRC, LINE, Mattermost, Nextcloud Talk, Synology Chat, Zalo, ClickClack, Buzz, Nostr). Buzz's duplicate local check is removed in the same change. Matrix keeps its account-scopedMATRIX_*validation — that contract is per-account and not expressible as a static list.resolveNostrPrivateKeyresolver now honorsNOSTR_PRIVATE_KEYin both setup and runtime, matching the Telegram/Discord ambient-fallback pattern.channels add --use-env→ gateway env requirements → config hot-reload behavior) on the channels CLI and Docker install pages.User Impact
--use-envsemantics are otherwise unchanged (ambient runtime fallback; no SecretRef changes).Evidence
pnpm plugin-sdk:surface:check) and API gates: pass (28 generated surface baselines updated for the additive fields).TELEGRAM_BOT_TOKEN/ Slack token pair exit 1 naming the variables; present env succeeds and commits config exactly as before.