Repository navigation
fix(mcp): dedupe blocked stdio env warnings - #128102
vincentkoc merged 3 commits into
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 23, 2026, 3:20 AM ET / 07:20 UTC. ClawSweeper reviewWhat this changesThe PR deduplicates blocked stdio environment-variable warnings once per MCP server/key pair per process while still removing unsafe keys. Merge readinessKeep open: current main still emits the blocked-env warning for every resolver call, while this PR moves deduplication to the shared resolver and preserves the safety filter. Likely related people: ClawSweeper (low-confidence current-source provenance). Priority: P2 Review scores
Verification
Live VerificationCommand: Result: FAIL (partial) — step 2 Assertions:
How this fits togetherMCP server configuration passes through a shared transport resolver before OpenClaw starts a stdio, SSE, or HTTP transport. For stdio servers, the resolver drops unsafe environment keys, logs the operator-facing warning, and passes the sanitized environment to startup. flowchart LR
A[MCP server configuration] --> B[Transport resolver]
B --> C[Stdio environment safety filter]
C --> D[Bounded warning dedupe]
C --> E[Sanitized launch configuration]
D --> F[Gateway or CLI logs]
E --> G[MCP transport startup]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +16, Tests +66. Total +82 across 2 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the bounded JSON-tuple dedupe at the resolver boundary, preserving the existing dropped-key filter and explicit silent callers. Do we have a high-confidence way to reproduce the issue? Yes—current main’s dropped-env callback directly logs on every resolution, and the exact-head terminal transcript demonstrates the changed bounded-warning behavior; no local execution was performed because this is a read-only review. Is this the best way to solve the issue? Yes—the shared resolver is the narrowest owner because stdio normalization reports dropped keys there and several runtime and CLI callers use it; caller-local suppression would be incomplete. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 352095882e60. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (5 earlier review cycles)
|
Punchcard-Session: clear-willow-orchard-hd
adfb8df to
c4e94b2
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Punchcard-Session: quiet-valley-harbor-ep
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Merged via squash.
|
* fix(mcp): dedupe blocked stdio env warnings * test(mcp): cover warning dedupe boundaries Punchcard-Session: clear-willow-orchard-hd * fix(mcp): encode warning dedupe identity Punchcard-Session: quiet-valley-harbor-ep --------- Co-authored-by: gaoanze <[email protected]> Co-authored-by: Vincent Koc <[email protected]>
Closes #92474
What Problem This Solves
MCP servers configured with blocked stdio environment keys such as
PYTHONPATHcould log the same safety warning on every transport resolution, flooding
gateway logs even though the key was still removed.
Fix
The shared transport resolver keeps the existing blocked-key filter and routes
the warning through its bounded process-local cache. The cache identity is the
JSON encoding of the raw
[serverName, key]tuple, so different pairs cannotcollide through delimiter text. Sanitization remains limited to log output.
This is the resolver-owned fix: callers that use the default warning behavior
share the same dedupe boundary, while callers that explicitly pass
logWarnings: falseremain silent.Evidence
Exact head:
7842329d69a14a5e21ccfb3f40e9b92fbf399a6fgpt-5.6-solat high reasoning: clean, noactionable P0/P1 findings.
networking, no Tailscale, no hydrated credentials, and no IAM role
credentials.
dist/mcp-transport-config-*.jsresolver chunk.13/13passed.0, including core and core-test typechecks,formatting, lint, dead-code, boundary, and repository guards.
oxfmt --checkandgit diff --check: passed.207success,47skipped,1neutral, no failuresor pending checks.
Sanitized unmocked resolver transcript:
The seven resolutions cover:
(svc, LD_A:LD_B)and(svc:LD_A, LD_B).The old delimiter identity aliases the final two pairs and emits only four
warnings. The built fixed resolver emits five distinct warnings, while every
blocked value is removed (
env={}in all seven results).Caller Audit
Not every inspection caller uses
logWarnings: false. Selected bundle andOAuth request paths suppress warnings, while
src/cli/mcp-cli.ts,src/agents/mcp-config-mutation.ts,src/agents/mcp-auth-profile.ts, andsrc/agents/mcp-transport.tsuse the resolver's default warning behavior.Resolver-boundary dedupe therefore covers the shared warning owner without
adding caller policy or changing global logger behavior.
Scope
+22/-6(net+16) for the bounded resolver-owneddedupe state.
+66/-0.+1/-1(net0); tests+23/-1.lifecycle, reset, or logger-policy changes.
Punchcard-Session: quiet-valley-harbor-ep
AI-assisted implementation; I reviewed the changed code and validation output.