openclaw - ✅(Solved) Fix feat(matrix): add explicit channels.matrix.proxy config for HTTP proxy support [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#56767Fetched 2026-04-08 01:45:52
View on GitHub
Comments
0
Participants
1
Timeline
8
Reactions
0
Participants
Timeline (top)
referenced ×5closed ×1cross-referenced ×1locked ×1

Fix Action

Fix / Workaround

The Matrix channel does not have an explicit configuration option for HTTP(S) proxy. Instead, proxy behavior relied on an implicit env var fallback in createPinnedDispatcher (ssrf.ts), which auto-detects http_proxy / https_proxy environment variables when no explicit policy is given.

  1. extensions/matrix/src/types.ts — Add proxy?: string to MatrixConfig
  2. extensions/matrix/src/config-schema.ts — Add proxy: z.string().optional() to MatrixConfigSchema
  3. extensions/matrix/src/matrix/client/types.ts — Add dispatcherPolicy?: PinnedDispatcherPolicy to MatrixResolvedConfig and MatrixAuth
  4. extensions/matrix/src/matrix/client/config.tsbuildMatrixNetworkFields: build PinnedDispatcherPolicy from proxy string when mode: "explicit-proxy"; thread through all call sites
  5. extensions/matrix/src/matrix/sdk.ts — Accept + forward dispatcherPolicy in MatrixClient constructor
  6. extensions/matrix/src/matrix/sdk/http-client.ts — Accept + forward dispatcherPolicy in MatrixAuthedHttpClient
  7. extensions/matrix/src/matrix/sdk/transport.ts — Accept + forward dispatcherPolicy to createPinnedDispatcher (replaces the undefined that triggered the env-var fallback)
  8. src/plugin-sdk/infra-runtime.ts — Re-export PinnedDispatcherPolicy type so extensions can import it from openclaw/plugin-sdk/infra-runtime
  • channels.telegram.proxy already provides this pattern (uses mode: "explicit-proxy" in PinnedDispatcherPolicy)
  • The env-var fallback in createPinnedDispatcher should be removed once this is deployed (see ssrf.ts)

PR fix notes

PR #56770: feat(matrix): add explicit channels.matrix.proxy config (#56767)

Description (problem / solution / changelog)

Summary

Adds channels.matrix.proxy?: string — an explicit HTTP(S) proxy URL for Matrix connections. Mirrors the existing channels.telegram.proxy pattern.

Motivation

The Matrix channel previously relied on implicit env var auto-detection in createPinnedDispatcher (ssrf.ts) for proxy behavior. This was:

  • Implicit: no explicit config, env vars silently affect behavior
  • Inconsistent: other channels (telegram) use explicit config
  • Not per-account: env vars apply globally

Changes

Core

  • src/plugin-sdk/infra-runtime.ts — Re-export PinnedDispatcherPolicy type so extensions can import from openclaw/plugin-sdk/infra-runtime

Matrix channel

  • extensions/matrix/src/types.tsproxy?: string on MatrixConfig
  • extensions/matrix/src/config-schema.tsproxy: z.string().optional() on MatrixConfigSchema
  • extensions/matrix/src/matrix/client/types.tsdispatcherPolicy?: PinnedDispatcherPolicy on MatrixResolvedConfig + MatrixAuth
  • extensions/matrix/src/matrix/client/config.tsbuildMatrixNetworkFields builds PinnedDispatcherPolicy from proxy string (mode: "explicit-proxy"); plumbed through all 3 resolveMatrixAuth call sites
  • extensions/matrix/src/matrix/sdk.tsMatrixClient opts accept + forward dispatcherPolicy
  • extensions/matrix/src/matrix/sdk/http-client.tsMatrixAuthedHttpClient accepts + forwards dispatcherPolicy
  • extensions/matrix/src/matrix/sdk/transport.ts — All fetch functions accept + forward dispatcherPolicy to createPinnedDispatcher (2nd arg, replacing undefined)

SSRF layer

  • src/infra/net/ssrf.ts — Removes env var auto-detect fallback from createPinnedDispatcher for mode: "direct" (was a workaround; explicit config is now the intended path)

Usage

channels:
  matrix:
    proxy: http://127.0.0.1:7890

Testing

  • All existing Matrix channel tests pass
  • pnpm check passes with 0 warnings/errors
  • Env var fallback removed — no proxy behavior without explicit config

Closes #56767

Changed files

  • extensions/matrix/src/config-schema.ts (modified, +1/-0)
  • extensions/matrix/src/matrix/client/config.ts (modified, +33/-9)
  • extensions/matrix/src/matrix/client/types.ts (modified, +3/-0)
  • extensions/matrix/src/matrix/sdk.ts (modified, +12/-2)
  • extensions/matrix/src/matrix/sdk/http-client.ts (modified, +4/-0)
  • extensions/matrix/src/matrix/sdk/transport.ts (modified, +10/-2)
  • extensions/matrix/src/types.ts (modified, +2/-0)
  • src/agents/volc-models.shared.ts (modified, +9/-9)
  • src/plugin-sdk/infra-runtime.ts (modified, +1/-0)

Code Example

channels:
  matrix:
    proxy: http://127.0.0.1:7890
RAW_BUFFERClick to expand / collapse

Problem

The Matrix channel does not have an explicit configuration option for HTTP(S) proxy. Instead, proxy behavior relied on an implicit env var fallback in createPinnedDispatcher (ssrf.ts), which auto-detects http_proxy / https_proxy environment variables when no explicit policy is given.

This approach is:

  • Implicit: env vars silently affect behavior with no explicit config
  • Inconsistent: not all channels handle proxy the same way (Telegram has channels.telegram.proxy)
  • Not configurable per-account: env vars apply globally, not per Matrix account

Proposed Solution

Add channels.matrix.proxy?: string — an explicit HTTP(S) proxy URL for Matrix connections, mirroring channels.telegram.proxy.

channels:
  matrix:
    proxy: http://127.0.0.1:7890

Changes Required

  1. extensions/matrix/src/types.ts — Add proxy?: string to MatrixConfig
  2. extensions/matrix/src/config-schema.ts — Add proxy: z.string().optional() to MatrixConfigSchema
  3. extensions/matrix/src/matrix/client/types.ts — Add dispatcherPolicy?: PinnedDispatcherPolicy to MatrixResolvedConfig and MatrixAuth
  4. extensions/matrix/src/matrix/client/config.tsbuildMatrixNetworkFields: build PinnedDispatcherPolicy from proxy string when mode: "explicit-proxy"; thread through all call sites
  5. extensions/matrix/src/matrix/sdk.ts — Accept + forward dispatcherPolicy in MatrixClient constructor
  6. extensions/matrix/src/matrix/sdk/http-client.ts — Accept + forward dispatcherPolicy in MatrixAuthedHttpClient
  7. extensions/matrix/src/matrix/sdk/transport.ts — Accept + forward dispatcherPolicy to createPinnedDispatcher (replaces the undefined that triggered the env-var fallback)
  8. src/plugin-sdk/infra-runtime.ts — Re-export PinnedDispatcherPolicy type so extensions can import it from openclaw/plugin-sdk/infra-runtime

Related

  • channels.telegram.proxy already provides this pattern (uses mode: "explicit-proxy" in PinnedDispatcherPolicy)
  • The env-var fallback in createPinnedDispatcher should be removed once this is deployed (see ssrf.ts)

extent analysis

Fix Plan

To add an explicit HTTP(S) proxy configuration option for the Matrix channel, follow these steps:

  • Update extensions/matrix/src/types.ts to include proxy?: string in MatrixConfig:
interface MatrixConfig {
  // ...
  proxy?: string;
}
  • Update extensions/matrix/src/config-schema.ts to include proxy: z.string().optional() in MatrixConfigSchema:
const MatrixConfigSchema = z.object({
  // ...
  proxy: z.string().optional(),
});
  • Update extensions/matrix/src/matrix/client/types.ts to include dispatcherPolicy?: PinnedDispatcherPolicy in MatrixResolvedConfig and MatrixAuth:
interface MatrixResolvedConfig {
  // ...
  dispatcherPolicy?: PinnedDispatcherPolicy;
}

interface MatrixAuth {
  // ...
  dispatcherPolicy?: PinnedDispatcherPolicy;
}
  • Update extensions/matrix/src/matrix/client/config.ts to build PinnedDispatcherPolicy from the proxy string when mode: "explicit-proxy":
function buildMatrixNetworkFields(config: MatrixConfig): MatrixResolvedConfig {
  // ...
  if (config.proxy) {
    return {
      // ...
      dispatcherPolicy: {
        mode: 'explicit-proxy',
        proxy: config.proxy,
      },
    };
  }
  // ...
}
  • Update extensions/matrix/src/matrix/sdk.ts, extensions/matrix/src/matrix/sdk/http-client.ts, and extensions/matrix/src/matrix/sdk/transport.ts to accept and forward dispatcherPolicy:
class MatrixClient {
  constructor(config: MatrixResolvedConfig) {
    // ...
    this.dispatcherPolicy = config.dispatcherPolicy;
  }
}

class MatrixAuthedHttpClient {
  constructor(config: MatrixResolvedConfig) {
    // ...
    this.dispatcherPolicy = config.dispatcherPolicy;
  }
}

function createPinnedDispatcher(config: MatrixResolvedConfig) {
  // ...
  return new PinnedDispatcher(config.dispatcherPolicy);
}
  • Re-export PinnedDispatcherPolicy type in src/plugin-sdk/infra-runtime.ts:
export { PinnedDispatcherPolicy } from './matrix/sdk/transport';

Verification

To verify the fix, test the Matrix channel with an explicit proxy configuration:

channels:
  matrix:
    proxy: http://127.0.0.1:7890

Check that the proxy is used correctly by inspecting the network traffic or logs.

Extra Tips

  • Remove the env-var fallback in createPinnedDispatcher (see ssrf.ts) once this fix is deployed.
  • Ensure that the PinnedDispatcherPolicy type is correctly imported and used in all relevant files.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING