Repository navigation
fix(plugins): resolve native MCP header environment references - #160244
Patrick-Erichsen wants to merge 1 commit into
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs real behavior proof before merge. Reviewed September 28, 2026, 3:40 AM ET / 07:40 UTC (Revision 2). ClawSweeper reviewWhat this changesThe branch resolves environment references in enabled native plugin MCP headers, skips servers with missing required values, and adds documentation and loader tests. Merge readiness⛔ Blocked before merge - 6 items remain This PR remains useful because current main does not resolve native plugin MCP header references. The earlier security finding remains on the unchanged head: resolving a credential before Codex CLI projection places its value in a process argument. Priority: P2 Review scores
Verification
How this fits togetherEnabled plugin manifests supply MCP server definitions to OpenClaw's agent runtime. The loader combines them with operator configuration before a local transport or coding harness connects to the server. flowchart LR
A[Enabled plugin] --> B[Manifest MCP headers]
B --> C[Environment resolver]
C --> D{Required value available?}
D -->|Yes| E[Agent or coding harness]
D -->|No| F[Skip server and warn]
E --> G[MCP server connection]
Before merge
Findings
Agent review detailsSecurityNeeds attention: Native header substitution can put environment-sourced credentials into Codex CLI process arguments. PR surfaceSource +57, Tests +147, Docs +2. Total +206 across 4 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep native header references environment-backed through Codex projection, while retaining the loader's missing-value diagnostics and operator overrides. Do we have a high-confidence way to reproduce the issue? Yes. The source establishes a path from a native header reference to a literal Codex CLI argument; this read-only review did not execute a subprocess. Is this the best way to solve the issue? No. Resolving references at the native manifest boundary is coherent for in-process transports, but Codex needs its existing environment-backed header projection preserved. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against ff8c752d852f. LabelsLabel changes: No label changes. Label justifications:
EvidenceSecurity concerns:
What I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
This pull request has been automatically marked as stale due to inactivity. |
What Problem This Solves
Native plugin MCP headers currently retain literal environment references, preventing built-in provider adapters from using user-supplied credentials safely.
User Impact
Enabled native plugins resolve header references using the existing config substitution grammar. Missing or empty required variables omit that server and produce a redacted diagnostic; other servers remain available.
Why This Change Was Made
Resolve credentials at the existing native manifest boundary instead of adding per-company runtime code. This applies only to native MCP headers, preserving existing bundle format and command/URL behavior. Static inspection may retain authored references after validating required variables; runtime transports receive resolved headers.
Evidence
get_file_contents(SHAebaebf7c416761a32f932ad70ebe5d1d2e214f68). No credential was written to proof files.Stack-head validation
node scripts/check-changed.mjs --base 1fe560c198c2917154e2e1b130b0df3352ac5114passed: static guards, dependency/lock checks, generated metadata, all typecheck graphs, dead-code scans, lint and runtime import cycles.pnpm test src/agents/mcp-oauth.test.ts src/plugins/bundle-mcp.test.ts src/agents/bundle-mcp-config.test.ts src/cli/mcp-cli.test.ts src/cli/mcp-cli.plugins.test.ts src/cli/mcp-cli.oauth.test.ts src/plugins/contracts/package-manifest.contract.test.ts src/plugins/contracts/extension-runtime-dependencies.contract.test.ts --maxWorkers=1passed: 729 tests / 8 files / 5 routed shards in 420.34s. The new CLI plugin suite took 54.31s including cold transformation (3 tests); the infra suite took 200.74s (67 tests). Hosted CI timing was not yet available.Package and upgrade proof
Validated stack head
5859d7c3d184e80cfed01304a93681ff69d64036on macOS arm64 / Node 24.19.0:node scripts/package-openclaw-for-docker.mjs --allow-unreleased-changelog --output-dir .artifacts/claw-723/packagepassed (19m47.6s), including declaration builds, UI build, package inventory and extracted runtime import-graph checks.openclaw-2026.9.6.tgz, 99,082,240 bytes, SHA-2560ee3ab0c8d43e777431ce557797c9609dbeb10bef9fbaf40a0d5dcf4954bcb04. All 35 compiled entries are present; packed manifests match source exactly.plugins list --jsonfinds all 35 under the installed package, originbundled, disabled. Enabling GoDaddy/Excalidraw exposes native MCP servers without manual config; livemcp probereturns 2/5 tools. Authenticated GitHub returns 45 tools; output is redacted. Missing-key fail-closed behavior and regional endpoint overrides pass. npm lifecycle-script approvals are limited to this disposable fixture; no user/global npm policy changed.[email protected]ranupdate --tag <candidate.tgz> --yes --json --no-restart --timeout 900. Resultstatus: ok, installed build2026.9.6-5859d7c3d184-2026-09-28T06-43-34.310Z; maintained upgrade-survivor helper verified baseline, candidate and installed application-byte identities. Existing disabled MCP config and enabledmemory-coresurvived unchanged; all 35 additions remain disabled.An earlier package attempt correctly refused a namespace change caused by concurrent generated-doc work. The final build ran after generation and checks finished, on stable inputs. OAuth consent/account tools and ten additional key-service accounts remain unverified; discovery-only inclusion is the approved milestone.
Stack order
Review only; no merge or release is authorized.
Hosted CI follow-up
Hosted CI is not green. Local validation above passed on the pinned stack; GitHub's later merge-ref/stack runs reported:
service-operation-lock.retained-custody.test.tscases (missing,unknown-phase,unknown-version,relative-source); sibling jobs were cancelled. The newer merge base includes upstream b107d4af, whose handoff-store refactor makesrelease()throw for malformed custody where the unchanged test expectsfalse. The OAuth PR changes neither that owner nor its tests. A local replay of the same test-group order on pure upstreamc136ec631464reproduced all four failures with no CLAW-723 code present: 900 passed, 4 failed, 5 skipped across the same 18-file group in 112.43s (macOS; hosted run was Linux). The first archive attempt stopped before tests because scoped dependency links were missing; the corrected prerequisite setup is the reproducing run.These hosted outcomes remain review/landing context, not passing evidence. No merge is authorized.