Skip to content

fix(feishu): disable ambient proxy inheritance for websocket by default - #84702

Closed
googlerest wants to merge 4 commits into
openclaw:mainfrom
googlerest:codex/pr-65802-feishu-ws-proxy
Closed

googlerest wants to merge 4 commits into
openclaw:mainfrom
googlerest:codex/pr-65802-feishu-ws-proxy

Conversation

@googlerest

Copy link
Copy Markdown
Contributor

Summary

  • Disable Feishu WebSocket ambient proxy inheritance by default.
  • Add OPENCLAW_FEISHU_WS_USE_PROXY=1 as the explicit opt-in for Feishu WS proxy routing.
  • Cover default/no-proxy and opt-in proxy behavior in Feishu client tests.

Closes #65799.

Real behavior proof

  • Behavior or issue addressed: Feishu WebSocket should not inherit ambient HTTPS_PROXY / https_proxy by default. It should only use ambient proxy env when OPENCLAW_FEISHU_WS_USE_PROXY=1.
  • Real environment tested: macOS local OpenClaw worktree, real @larksuiteoapi/node-sdk WSClient, real @openclaw/proxyline ambient proxy agent, local TLS wss:// server, local HTTP proxy recording CONNECT.
  • Exact steps or command run after this patch: Ran a local proof script that starts a temporary wss://127.0.0.1:<port> WebSocket server and temporary HTTP proxy, sets https_proxy=http://127.0.0.1:<proxyPort>, then connects once without a WS agent and once with the ambient proxy agent.
  • Evidence after fix:
default ambient env, no ws agent:
  stateAfterReady: connected
  wsConnectionsDelta: 1
  proxyEvents: []
  agentConstructed: false

explicit opt-in agent from ambient env:
  stateAfterReady: connected
  wsConnectionsDelta: 1
  proxyEvents:
    CONNECT 127.0.0.1:<port>
  agentConstructed: true
  • Observed result after fix: Ambient proxy env no longer affects Feishu WS by default; explicit opt-in routes the same WS connection through the proxy.
  • What was not tested: No live Feishu production app credentials were used; the proof isolates the WebSocket/proxy transport behavior with a local TLS WS endpoint.

Verification

node scripts/run-vitest.mjs run --config test/vitest/vitest.extension-feishu.config.ts extensions/feishu/src/client.test.ts
Test Files  1 passed (1)
Tests  16 passed (16)
node scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.extensions.json extensions/feishu/src/client.ts extensions/feishu/src/client.test.ts
Found 0 warnings and 0 errors.
node scripts/run-tsgo.mjs -p extensions/feishu/tsconfig.json --noEmit

@openclaw-barnacle openclaw-barnacle Bot added channel: feishu Channel integration: feishu size: XS proof: supplied External PR includes structured after-fix real behavior proof. labels May 20, 2026
@clawsweeper

clawsweeper Bot commented May 20, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

Workflow note: Future ClawSweeper reviews update this same comment in place.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

Summary
The PR gates Feishu WebSocket ambient proxy agent creation behind OPENCLAW_FEISHU_WS_USE_PROXY=1 and adds Feishu client tests, docs, and a changelog entry for the new opt-in.

Reproducibility: yes. at source level. Current main unconditionally resolves an ambient proxy agent for Feishu WebSocket creation, and the PR body supplies after-fix local WSS/proxy output for the same transport boundary.

PR rating
Overall: 🐚 platinum hermit
Proof: 🦞 diamond lobster
Patch quality: 🐚 platinum hermit
Summary: Strong transport proof and a focused patch; the remaining readiness limit is maintainer acceptance of the proxy-default policy tradeoff.

Rank-up moves:

  • Get maintainer approval of the Feishu WebSocket direct-by-default proxy policy before merge.
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Real behavior proof
Sufficient (live_output): The PR body includes after-fix live output from a local TLS WSS endpoint and HTTP proxy using the real Lark WSClient and OpenClaw Proxyline ambient-agent path.

Risk before merge

  • Existing Feishu deployments that intentionally rely on ambient proxy env for WebSocket egress will switch to direct connections after upgrade unless operators set OPENCLAW_FEISHU_WS_USE_PROXY=1 in the durable gateway environment.
  • Proxy-only or egress-controlled deployments can lose Feishu inbound message delivery, or route around an expected outbound proxy boundary, if the upgrade note is missed.
  • An older same-fix PR remains open at fix(feishu): disable ambient proxy inheritance for websocket by default #65802, so maintainers should choose this as the canonical fix or explicitly supersede it after landing.

Maintainer options:

  1. Approve direct default with opt-in (recommended)
    Merge this PR as the canonical fix if maintainers accept that proxy-routed Feishu deployments must set OPENCLAW_FEISHU_WS_USE_PROXY=1 after upgrade.
  2. Require compatibility-preserving behavior
    Ask for a default, migration, or stronger startup warning that preserves existing ambient-proxy deployments if maintainers do not want upgrades to change Feishu WebSocket egress.
  3. Pause for proxy policy ownership
    Hold the PR if Feishu WebSocket egress policy should be decided with broader channel, proxy-runtime, or security owners before changing the default.

Next step before merge
No automated repair remains; maintainers need to approve the Feishu WebSocket proxy-default upgrade and egress-policy tradeoff before merge.

Security
Needs attention: The diff intentionally changes Feishu WebSocket egress-control semantics from ambient-proxy inheritance to direct-by-default.

Review details

Best possible solution:

Land this Feishu-owned direct-by-default policy only after maintainer approval of the upgrade and egress-boundary tradeoff, then use this PR as the canonical fix for the linked bug and close older duplicate attempts.

Do we have a high-confidence way to reproduce the issue?

Yes, at source level. Current main unconditionally resolves an ambient proxy agent for Feishu WebSocket creation, and the PR body supplies after-fix local WSS/proxy output for the same transport boundary.

Is this the best way to solve the issue?

Mostly yes. The code change is narrow and Feishu-owned, with docs and tests, but direct-by-default behavior is an upgrade and egress-policy choice that maintainers should explicitly accept.

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes after-fix live output from a local TLS WSS endpoint and HTTP proxy using the real Lark WSClient and OpenClaw Proxyline ambient-agent path.

Label justifications:

  • P1: The linked bug can break real Feishu inbound message delivery and affects proxy/security-sensitive deployments.
  • merge-risk: 🚨 compatibility: The PR changes the upgrade default for deployments that previously relied on ambient proxy env for Feishu WebSocket egress.
  • merge-risk: 🚨 message-delivery: Proxy-only Feishu deployments can stop receiving inbound messages if operators miss the new opt-in env var.
  • merge-risk: 🚨 security-boundary: Deployments using proxy env as an outbound egress-control boundary may route Feishu WebSocket traffic direct after this change unless they opt in.
  • rating: 🐚 platinum hermit: Current PR rating is 🐚 platinum hermit because proof is 🦞 diamond lobster, patch quality is 🐚 platinum hermit, and Strong transport proof and a focused patch; the remaining readiness limit is maintainer acceptance of the proxy-default policy tradeoff.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (live_output): The PR body includes after-fix live output from a local TLS WSS endpoint and HTTP proxy using the real Lark WSClient and OpenClaw Proxyline ambient-agent path.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes after-fix live output from a local TLS WSS endpoint and HTTP proxy using the real Lark WSClient and OpenClaw Proxyline ambient-agent path.

Security concerns:

  • [medium] Approve the egress boundary change before merge — extensions/feishu/src/client.ts:96
    The changed default can route Feishu WebSocket traffic directly in deployments that used proxy env as an outbound control boundary unless operators add OPENCLAW_FEISHU_WS_USE_PROXY=1.
    Confidence: 0.86

Acceptance criteria:

  • node scripts/run-vitest.mjs run --config test/vitest/vitest.extension-feishu.config.ts extensions/feishu/src/client.test.ts
  • node scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.extensions.json extensions/feishu/src/client.ts extensions/feishu/src/client.test.ts
  • node scripts/run-tsgo.mjs -p extensions/feishu/tsconfig.json --noEmit

What I checked:

  • Current main Feishu WS proxy behavior: Current main unconditionally resolves an ambient Node proxy agent in getWsProxyAgent(), so Feishu WebSocket creation inherits process proxy env whenever the shared helper reports an ambient proxy. (extensions/feishu/src/client.ts:93, 23c58081d062)
  • Current main WSClient call site: createFeishuWSClient() awaits getWsProxyAgent() and passes the resulting agent into the Lark WSClient constructor when present. (extensions/feishu/src/client.ts:214, 23c58081d062)
  • PR diff behavior: The PR head adds FEISHU_WS_USE_PROXY_ENV_VAR, only calls resolveAmbientNodeProxyAgent() when the env var equals 1, and adds default-direct plus opt-in proxy tests including ALL_PROXY. (extensions/feishu/src/client.ts:88, c339ff0229e8)
  • PR docs and upgrade note: The PR documents that Feishu/Lark WebSocket connections are direct by default and tells proxy-only deployments to set both standard proxy env and OPENCLAW_FEISHU_WS_USE_PROXY=1 in the durable gateway environment. Public docs: docs/channels/feishu.md. (docs/channels/feishu.md:214, c339ff0229e8)
  • Supplied real behavior proof: The PR body includes after-fix local live output using a real Lark WSClient, real Proxyline ambient proxy path, local TLS WSS endpoint, and local HTTP proxy, showing no proxy events by default and a CONNECT event when explicitly opted in. (c339ff0229e8)
  • Lark dependency contract: The published @larksuiteoapi/[email protected] types expose agent?: any on WS client params, and the bundled implementation stores that agent and passes it to new WebSocket(connectUrl, { agent }).

Likely related people:

  • colin719: Commit 0a23739c3795d38292a2a20072f893b952b82f88 added Feishu WS proxy agent creation and tests for passing a proxy agent to the Lark WSClient. (role: introduced behavior; confidence: high; commits: 0a23739c3795; files: extensions/feishu/src/client.ts, extensions/feishu/src/client.test.ts)
  • steipete: Commits 380a396266872aceb3767b52e90f936b273bc3b2 and 59be6d6390eaf1faacc2290c57dc200023290e17 moved Feishu WS proxy handling onto shared ambient proxy helpers and then Proxyline. (role: proxy helper and recent area contributor; confidence: high; commits: 380a39626687, 59be6d6390ea; files: extensions/feishu/src/client.ts, extensions/feishu/src/client.test.ts, src/plugin-sdk/extension-shared.ts)
  • vincentkoc: Recent commits d93e6f61580a3ab9955a3905d7f785bd094a9d33 and f9b47ad2a169442c09f062372bee5f9276b1a5fa changed Feishu WebSocket reconnect/heartbeat behavior, and the live PR metadata shows this person assigned to the PR. (role: recent Feishu WebSocket contributor and assignee; confidence: high; commits: d93e6f61580a, f9b47ad2a169; files: extensions/feishu/src/client.ts, extensions/feishu/src/monitor.transport.ts, extensions/feishu/src/client.test.ts)

Codex review notes: model gpt-5.5, reasoning high; reviewed against 23c58081d062.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. labels May 20, 2026
@clawsweeper

clawsweeper Bot commented May 20, 2026 •

Copy link
Copy Markdown
Contributor

ClawSweeper PR egg

🔥 Warming up: real-behavior proof passed; findings, security review, or rank-up moves are still in progress.

Hatch command

Comment @clawsweeper hatch when this PR is hatchable.

Hatchability rules:

  • Merged PRs are hatchable.
  • Open PRs are hatchable when they are status: 👀 ready for maintainer look, status: 🚀 automerge armed, or labeled clawsweeper:automerge.
  • Closed unmerged PRs are hatchable only when one of those hatchable labels is still present in the durable record.
What is this egg doing here?
  • Eggs appear after the PR passes real-behavior proof. It is here for vibes, not verdicts: it does not change labels, ratings, merge decisions, or automation.
  • The shell reacts to review momentum: open follow-up work warms it up, re-review makes it wobble, and a clean final review lets it hatch.
  • Hatchability usually comes from sufficient real-behavior proof, no blocking P0/P1/P2 findings, no security attention needed, and clean correctness. A merged PR is already final, so merge makes the egg hatchable independently.
  • The hatch is seeded from this repository and PR number, so the same PR keeps the same creature; the reviewed head SHA can only change safe visual details.
  • Rarity is just collectible sparkle: 🥚 common, 🌱 uncommon, 💎 rare, ✨ glimmer, and 🌈 legendary.

@openclaw-barnacle openclaw-barnacle Bot added the docs Improvements or additions to documentation label May 20, 2026
@googlerest

Copy link
Copy Markdown
Contributor Author

Addressed the ClawSweeper findings in fdd1ed575b:

  • Restored OPENCLAW_FEISHU_WS_USE_PROXY in Feishu client test setup/teardown so the non-isolated Vitest worker does not retain proxy opt-in state.
  • Added Feishu operator docs for proxy-only deployments: keep standard proxy env configured and set OPENCLAW_FEISHU_WS_USE_PROXY=1 to preserve the previous ambient-proxy behavior after upgrade.
  • Added an Unreleased changelog entry for the default behavior change and upgrade opt-in.

Verification rerun:

OPENCLAW_VITEST_NO_OUTPUT_TIMEOUT_MS=20000 node scripts/run-vitest.mjs run --config test/vitest/vitest.extension-feishu.config.ts extensions/feishu/src/client.test.ts
Test Files  1 passed (1)
Tests  16 passed (16)
node scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.extensions.json extensions/feishu/src/client.ts extensions/feishu/src/client.test.ts
Found 0 warnings and 0 errors.
node scripts/run-tsgo.mjs -p extensions/feishu/tsconfig.json --noEmit

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented May 20, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels May 20, 2026
@googlerest
googlerest force-pushed the codex/pr-65802-feishu-ws-proxy branch from fdd1ed5 to 3eb63f0 Compare May 21, 2026 12:36
@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 21, 2026
@googlerest

Copy link
Copy Markdown
Contributor Author

Rebased the PR branch onto current origin/main to resolve the dirty merge state.

New head: 3eb63f0869

Local verification after rebase:

OPENCLAW_VITEST_NO_OUTPUT_TIMEOUT_MS=20000 node scripts/run-vitest.mjs run --config test/vitest/vitest.extension-feishu.config.ts extensions/feishu/src/client.test.ts
Test Files  1 passed (1)
Tests  16 passed (16)
node scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.extensions.json extensions/feishu/src/client.ts extensions/feishu/src/client.test.ts
Found 0 warnings and 0 errors.
node scripts/run-tsgo.mjs -p extensions/feishu/tsconfig.json --noEmit

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented May 21, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 21, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 21, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 21, 2026
@vincentkoc vincentkoc self-assigned this May 21, 2026
@openclaw-barnacle openclaw-barnacle Bot added size: S and removed size: XS proof: sufficient ClawSweeper judged the real behavior proof convincing. labels May 21, 2026
@vincentkoc
vincentkoc force-pushed the codex/pr-65802-feishu-ws-proxy branch from db8db65 to d540d5b Compare May 21, 2026 15:40
@vincentkoc
vincentkoc force-pushed the codex/pr-65802-feishu-ws-proxy branch from d540d5b to 8245167 Compare May 21, 2026 15:48
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 21, 2026
@vincentkoc
vincentkoc force-pushed the codex/pr-65802-feishu-ws-proxy branch from 8245167 to 77b3f4b Compare May 21, 2026 15:58
@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 21, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. and removed status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels May 21, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 21, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 21, 2026
@googlerest

Copy link
Copy Markdown
Contributor Author

Superseded by #90324, which is a clean rebase of the same fix onto current main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: feishu Channel integration: feishu docs Improvements or additions to documentation merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: supplied External PR includes structured after-fix real behavior proof. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feishu WebSocket should not inherit ambient proxy env by default

2 participants