Skip to content

feat(transport): add LARK_CLI_NO_PROXY_WARN to silence proxy warning#1647

Merged
liangshuo-1 merged 1 commit into
mainfrom
proxy-warn-opt-out-env
Jun 29, 2026
Merged

feat(transport): add LARK_CLI_NO_PROXY_WARN to silence proxy warning#1647
liangshuo-1 merged 1 commit into
mainfrom
proxy-warn-opt-out-env

Conversation

@liangshuo-1

@liangshuo-1 liangshuo-1 commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

Background

The [lark-cli] [WARN] proxy detected: ... line is a human-oriented warning written to stderr, and only when stderr is a terminal. But agents typically run the CLI inside a PTY and merge stderr into stdout, so the warning ends up in the --format json output stream and downstream consumers (models/scripts) fail to parse it as JSON.

The only existing way to silence it, LARK_CLI_NO_PROXY=1, also disables the proxy — not acceptable when the proxy is the required egress path.

Change

Add LARK_CLI_NO_PROXY_WARN: set to any non-empty value to silence the warning while leaving proxy behavior unchanged.

Env var Behavior
LARK_CLI_NO_PROXY_WARN=1 Keep the proxy, only silence the warning
LARK_CLI_NO_PROXY=1 Existing behavior: disable the proxy (no warning as a side effect)
  • internal/transport/warn.go: add the EnvNoProxyWarn constant; short-circuit at the top of WarnIfProxied, covering both the env-proxy and proxy-plugin warnings; the warning message now advertises this option.
  • internal/transport/warn_test.go: add two tests — the warning is silenced while the proxy stays configured, and the plugin-mode warning is silenced too.

Verification

  • go build ./...
  • go test ./internal/transport/ ./internal/cmdutil/

Summary by CodeRabbit

  • New Features

    • Added a new environment option to silence proxy-detected warnings while keeping proxy usage enabled.
    • Updated the warning message to clearly explain both available proxy-related options.
  • Bug Fixes

    • Prevented proxy warnings from appearing when the new opt-out setting is enabled.
    • Kept proxy credentials hidden when proxy details are shown.
  • Tests

    • Added coverage for the new warning-suppression behavior in both standard and proxy-plugin scenarios.

@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f5d2c0d1-f4af-45a5-8429-8ba649160aab

📥 Commits

Reviewing files that changed from the base of the PR and between fb3bf34 and 6221d4f.

📒 Files selected for processing (2)
  • internal/transport/warn.go
  • internal/transport/warn_test.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • internal/transport/warn.go
  • internal/transport/warn_test.go

📝 Walkthrough

Walkthrough

Adds EnvNoProxyWarn (LARK_CLI_NO_PROXY_WARN) in internal/transport/warn.go. WarnIfProxied now exits early when it is set, the warning text mentions both opt-out variables, and tests cover suppression for direct and plugin-triggered warnings.

Proxy warning silent opt-out

Layer / File(s) Summary
EnvNoProxyWarn constant and warning opt-out
internal/transport/warn.go
Adds EnvNoProxyWarn, returns early in WarnIfProxied when it is set, and updates the warning text to mention both EnvNoProxy and EnvNoProxyWarn.
WarnIfProxied suppression tests
internal/transport/warn_test.go
Adds tests that set EnvNoProxyWarn and assert no warning output is emitted for both the proxy and proxy-plugin paths.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Possibly related PRs

  • larksuite/cli#247: Both PRs change proxy-detection warning behavior via environment variables and overlap in the same warning/opt-out logic.
  • larksuite/cli#1448: Both PRs modify the proxy-warning flow centered on internal/transport/warn.go and its plugin-warning behavior.

Suggested labels

feature

Poem

I twitched my nose and kept it bright,
The proxy stayed, but logs grew light.
One tiny var made warnings hush —
Hop hop, the console is less much!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately highlights the new proxy-warning opt-out env var.
Description check ✅ Passed The description covers motivation, changes, and verification, though it uses custom headings and omits related issues.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch proxy-warn-opt-out-env

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the size/M Single-domain feat or fix with limited business impact label Jun 29, 2026
@liangshuo-1
liangshuo-1 force-pushed the proxy-warn-opt-out-env branch from fb3bf34 to a8f00b1 Compare June 29, 2026 09:46
@liangshuo-1 liangshuo-1 changed the title feat(transport): add LARK_CLI_NO_PROXY_WARN to silence proxy warning feat(transport): 新增 LARK_CLI_NO_PROXY_WARN 静默代理告警 Jun 29, 2026
The proxy-detected warning is human-oriented but lands on stderr, which
agents running the CLI in a PTY merge into stdout — polluting --format
json output so consumers fail to parse it. The only existing way to
silence it, LARK_CLI_NO_PROXY=1, also disables the proxy, which is not
acceptable when the proxy is required for egress.

Add a dedicated opt-out, LARK_CLI_NO_PROXY_WARN=1, that suppresses the
warning (both env-proxy and proxy-plugin variants) while leaving proxy
behavior unchanged. The warning message now advertises this option.
@liangshuo-1
liangshuo-1 force-pushed the proxy-warn-opt-out-env branch from a8f00b1 to 6221d4f Compare June 29, 2026 09:47
@liangshuo-1 liangshuo-1 changed the title feat(transport): 新增 LARK_CLI_NO_PROXY_WARN 静默代理告警 feat(transport): add LARK_CLI_NO_PROXY_WARN to silence proxy warning Jun 29, 2026
@github-actions

github-actions Bot commented Jun 29, 2026

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

npm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@a8f00b1c797df562193c7c925a48e2041efdf9ef

🧩 Skill update

npx skills add larksuite/cli#proxy-warn-opt-out-env -y -g

@codecov

codecov Bot commented Jun 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.69%. Comparing base (602c788) to head (6221d4f).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1647   +/-   ##
=======================================
  Coverage   74.69%   74.69%           
=======================================
  Files         808      808           
  Lines       81527    81529    +2     
=======================================
+ Hits        60896    60898    +2     
  Misses      16093    16093           
  Partials     4538     4538           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@liangshuo-1
liangshuo-1 merged commit 5c0a36b into main Jun 29, 2026
68 of 74 checks passed
@liangshuo-1
liangshuo-1 deleted the proxy-warn-opt-out-env branch June 29, 2026 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Single-domain feat or fix with limited business impact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants