Skip to content

fix(gateway): dev mode suppresses ambient channel env auto-configuration - #112011

Merged
steipete merged 1 commit into
mainfrom
claude/dev-gateway-ambient-channel-suppression
Jul 21, 2026
Merged

steipete merged 1 commit into
mainfrom
claude/dev-gateway-ambient-channel-suppression

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Channel plugins declare package env triggers in their manifests, and ambient environment variables matching those triggers mark a channel as "configured" in any gateway that inherits them. A dev gateway (openclaw gateway run --dev) inherits the operator's shell environment, so real channel credentials exported there (e.g. reef guard keys, bot tokens) silently auto-configured channels in supposedly isolated development instances — which can then connect to live external services. This was observed live: an isolated stress-test dev gateway with an empty channels config warned about the operator's reef channel and held an outbound connection to a Telegram data-center range.

Why This Change Was Made

Maintainer decision after the live incident: dev gateways must not touch real channel surfaces via ambient credentials. Dev mode now drops channel presence signals whose only sources are env/manifest-env, threaded consistently through activation planning, plugin auto-enable, channel autostart, health monitoring/recovery, readiness, config reloads, and startup warnings. Explicitly configured channels (channels.<id> in the dev config) continue to work; a new additive --dev-ambient-channels flag restores the previous behavior; suppression is logged once at startup with the affected channel ids and the re-enable hint. Non-dev gateways are completely unchanged, and no new config keys or env vars are introduced.

User Impact

Developers running gateway run --dev get inert-by-default gateways: no accidental connections to production channels from shell credentials. Anyone who intentionally relied on ambient env to configure channels in dev mode passes --dev-ambient-channels. Docs updated (docs/cli/gateway.md, docs/help/debugging.md).

Evidence

  • New/updated tests across nine files: presence-policy suppression (ambient-only dropped, mixed-source retained, default unchanged), blocker warnings, startup planning, autostart, health recovery, readiness, reload, CLI flag validation (--dev-ambient-channels without --dev errors), and the one-time suppression log. 406 tests pass across the touched surfaces.
  • Test-env hygiene: server-startup-log.test.ts now scrubs the host's real reef env vars — six of its pre-existing tests failed on any machine exporting those vars (verified on this host); they are deterministic everywhere with this change.
  • Targeted oxfmt/oxlint clean, git diff --check clean, structured autoreview (Codex gpt-5.6-sol, xhigh) clean: "no concrete actionable defect."

Channel plugins declare package env triggers in manifests, and ambient
environment variables count as "channel configured". A dev gateway
(gateway run --dev) inherits the operator's shell, so real channel
credentials silently configured channels and could connect development
instances to live services (observed with reef and a Telegram-range
connection during isolated stress testing).

Dev mode now drops presence signals whose only sources are env or
manifest-env across activation planning, auto-enable, autostart, health
recovery, readiness, reloads, and startup warnings. Explicit
channels.<id> config still works, --dev-ambient-channels restores the
old behavior, and startup logs the suppressed channel ids once. Non-dev
gateways are unchanged.
@steipete
steipete marked this pull request as ready for review July 21, 2026 02:14
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime cli CLI command changes commands Command implementations size: L maintainer Maintainer-authored PR labels Jul 21, 2026
@steipete
steipete merged commit b61619e into main Jul 21, 2026
210 of 217 checks passed
@steipete
steipete deleted the claude/dev-gateway-ambient-channel-suppression branch July 21, 2026 02:28
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 21, 2026
…ion (openclaw#112011)

Channel plugins declare package env triggers in manifests, and ambient
environment variables count as "channel configured". A dev gateway
(gateway run --dev) inherits the operator's shell, so real channel
credentials silently configured channels and could connect development
instances to live services (observed with reef and a Telegram-range
connection during isolated stress testing).

Dev mode now drops presence signals whose only sources are env or
manifest-env across activation planning, auto-enable, autostart, health
recovery, readiness, reloads, and startup warnings. Explicit
channels.<id> config still works, --dev-ambient-channels restores the
old behavior, and startup logs the suppressed channel ids once. Non-dev
gateways are unchanged.
steipete added a commit that referenced this pull request Sep 25, 2026
Carry the selected Gateway ambient policy into initial config auto-enable,
matching reload preparation. Require that policy at the startup config
boundary and classify explicit channel presence from authored source rather
than generated runtime enablement. Remove duplicate detector defaults.

Preserve explicit channel configuration and both ambient opt-in flags.
Document that the policy also applies to reloads and managed services.

Release-note context: env-only channel activation bypassed the documented
opt-in in stable releases through v2026.9.6. Affected operators must add
channels.<id> configuration or use --ambient-channels. Existing suppression
warnings explain the enablement path; no config migration should infer
operator consent from environment credentials. Completes the policy work
from #112011 and #123174 across the loader extracted in #110779.

Validation: 440 focused tests passed. Before the fix, the new suite had two
expected failures (suppression bypass and generated consent) and three
passes; after the fix all five pass. The authored-config/prior-release
corpus run had 24 passes and five 120-second timeouts, all in the first
Doctor checkpoint before Gateway config loading. No causal connection to
this fix was found; migration/worker timing remains a separate follow-up.
A standalone replay was stopped while waiting for the legitimate artifact
lock held by check-changed, before it reached Vitest.

The changed-check aggregate passed production typing, all 25 test-type
graphs, formatting, config docs, plugin boundaries and earlier guards, but
failed on the full-tree Knip export scan's 600-second timeout. The same
scan timed out when run alone with its unchanged limit; production/script
export scans passed. Changed-file lint passed with zero warnings/errors.
The native-state schema guard passed. The supplemental database-first
scan was stopped after over 16 minutes under host load around 179; later
media, sidecar, import-cycle, webhook and pairing guards were not run.
Full changed-check validation is not claimed green.
steipete added a commit that referenced this pull request Sep 25, 2026
…7387)

Carry the selected Gateway ambient policy into initial config auto-enable,
matching reload preparation. Require that policy at the startup config
boundary and classify explicit channel presence from authored source rather
than generated runtime enablement. Remove duplicate detector defaults.

Preserve explicit channel configuration and both ambient opt-in flags.
Document that the policy also applies to reloads and managed services.

Release-note context: env-only channel activation bypassed the documented
opt-in in stable releases through v2026.9.6. Affected operators must add
channels.<id> configuration or use --ambient-channels. Existing suppression
warnings explain the enablement path; no config migration should infer
operator consent from environment credentials. Completes the policy work
from #112011 and #123174 across the loader extracted in #110779.

Validation: 440 focused tests passed. Before the fix, the new suite had two
expected failures (suppression bypass and generated consent) and three
passes; after the fix all five pass. The authored-config/prior-release
corpus run had 24 passes and five 120-second timeouts, all in the first
Doctor checkpoint before Gateway config loading. No causal connection to
this fix was found; migration/worker timing remains a separate follow-up.
A standalone replay was stopped while waiting for the legitimate artifact
lock held by check-changed, before it reached Vitest.

The changed-check aggregate passed production typing, all 25 test-type
graphs, formatting, config docs, plugin boundaries and earlier guards, but
failed on the full-tree Knip export scan's 600-second timeout. The same
scan timed out when run alone with its unchanged limit; production/script
export scans passed. Changed-file lint passed with zero warnings/errors.
The native-state schema guard passed. The supplemental database-first
scan was stopped after over 16 minutes under host load around 179; later
media, sidecar, import-cycle, webhook and pairing guards were not run.
Full changed-check validation is not claimed green.

Co-authored-by: Peter Steinberger <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 26, 2026
…nclaw#157387)

Carry the selected Gateway ambient policy into initial config auto-enable,
matching reload preparation. Require that policy at the startup config
boundary and classify explicit channel presence from authored source rather
than generated runtime enablement. Remove duplicate detector defaults.

Preserve explicit channel configuration and both ambient opt-in flags.
Document that the policy also applies to reloads and managed services.

Release-note context: env-only channel activation bypassed the documented
opt-in in stable releases through v2026.9.6. Affected operators must add
channels.<id> configuration or use --ambient-channels. Existing suppression
warnings explain the enablement path; no config migration should infer
operator consent from environment credentials. Completes the policy work
from openclaw#112011 and openclaw#123174 across the loader extracted in openclaw#110779.

Validation: 440 focused tests passed. Before the fix, the new suite had two
expected failures (suppression bypass and generated consent) and three
passes; after the fix all five pass. The authored-config/prior-release
corpus run had 24 passes and five 120-second timeouts, all in the first
Doctor checkpoint before Gateway config loading. No causal connection to
this fix was found; migration/worker timing remains a separate follow-up.
A standalone replay was stopped while waiting for the legitimate artifact
lock held by check-changed, before it reached Vitest.

The changed-check aggregate passed production typing, all 25 test-type
graphs, formatting, config docs, plugin boundaries and earlier guards, but
failed on the full-tree Knip export scan's 600-second timeout. The same
scan timed out when run alone with its unchanged limit; production/script
export scans passed. Changed-file lint passed with zero warnings/errors.
The native-state schema guard passed. The supplemental database-first
scan was stopped after over 16 minutes under host load around 179; later
media, sidecar, import-cycle, webhook and pairing guards were not run.
Full changed-check validation is not claimed green.

Co-authored-by: Peter Steinberger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes commands Command implementations docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR size: L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant