Repository navigation
fix(gateway): suppress ambient channel auto-enable from env credentials - #123174
Merged
Merged
Conversation
Contributor
|
🦞👀 Pull request received. I will update this pull request when review starts. |
steipete
marked this pull request as ready for review
August 13, 2026 12:05
steipete
force-pushed
the
steipete/upbeat-mahavira-c3cce3
branch
from
August 13, 2026 17:32
54deb6f to
ccf873f
Compare
Contributor
Author
|
Merged via squash.
|
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Aug 14, 2026
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]>
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.
What Problem This Solves
A gateway with no channel configuration could auto-enable channels purely from ambient host environment credentials inherited from the launching shell, and then mutate remote service state owned by the operator's real deployment. Observed on a scratch-profile gateway (
plugins: {}, nochannels.*config) started from a shell carrying the operator's env: Discord and SMS auto-enabled fromDISCORD_BOT_TOKEN/TWILIO_*, and the Discord channel's native slash-command reconciliation deleted remote slash-command registrations belonging to the operator's production bot (extensions/discord/src/internal/command-deploy.tsdeletes every remote global command not in its desired set; Telegram similarly runsdeleteWebhook/setWebhookand a full command-menu clear at startup).Why This Change Was Made
PR #112011 already built the suppression machinery (
ambientEnvTriggers: "allow" | "suppress"across presence detection, activation planning, autostart, startup logging) but scoped it to--devgateways only; production gateways defaulted to"allow"(src/gateway/server-startup-bootstrap.ts). The incident gateway ran a scratch profile, not--dev, so it got the production default.Zero-config env-only activation is not the documented contract: every documented flow (
openclaw channels add --use-env, onboarding, Docker, Fly) writeschannels.<id>.enabled: trueand uses env only as the default-account secret source ("Each channel starts automatically when its config section exists" — docs/gateway/config-channels.md). So the fix flips the default: ambient env-only channel presence no longer activates channels on any gateway. Explicitchannels.<id>config still activates exactly as documented, and env vars still supply the default-account token for configured channels.The opt-in is generalized:
openclaw gateway run --ambient-channelsrestores ambient auto-configuration in any mode;--dev-ambient-channelsremains as a deprecated alias. Startup logs the suppressed channel ids once and names the enablement path (openclaw channels add <id>/channels.<id>.enabled: true/--ambient-channels).User Impact
channels.<id>config sections keep working, including env-var token fallback for the default account.--ambient-channels(or a one-linechannels.<id>.enabled: true). The startup warning states this when ambient-only credentials are detected.configuredState.envtriggers — both areAMBIENT_ENV_SOURCESin the presence policy; no per-channel code changed.Evidence
src/gateway/server-startup-minimal-boot.test.ts):prepareGatewayServerBootstrapwith the ambient option omitted resolvesambientEnvTriggers: "suppress"— fails on pre-fix code (default was"allow").src/cli/gateway-cli/run.option-collisions.test.ts): default suppress with and without--dev;--ambient-channels(subcommand + inherited parent form) and the deprecated--dev-ambient-channelsalias both resolve to"allow"; removed the obsolete dev-only-rejection test.channel-plugin-ids(170),run.option-collisions(74),server-startup-minimal-boot(2),server-startup-plugins(26),server-startup-log(14),server-channels(95),channel-plugin-blockers(34) vianode scripts/run-vitest.mjs.node scripts/check-changed.mjs: delegated to Blacksmith Testbox, exit 0 (lease stopped cleanly).--helpshows both flags; default launch suppresses Discord (excluded from loaded plugins, suppression warning logged);--ambient-channelsloads Discord without the warning.