fix(outbound): prevent internal sink from intercepting action-only plugins#94869
fix(outbound): prevent internal sink from intercepting action-only plugins#94869lakshitsoni26 wants to merge 2 commits into
Conversation
Fixes openclaw#93144 Prior to this change, templates in MCP config fields (such as `env` and `headers`) were resolved during Gateway startup. As a result, any dynamic rotation of underlying environment variables required a full Gateway restart. This commit shifts the environment variable substitution logic to the MCP transport connection layer. We now intercept the SDK's fetch invocations (for HTTP/SSE) and child process spawn routines (for stdio), dynamically substituting variables based on the live `process.env` state at the exact moment of request, cleanly solving the credential rotation limits.
|
Thanks for the contribution. I reviewed the branch, and this PR is not a good landing base for OpenClaw. This PR should close as a dirty branch: the useful outbound routing fix is small and relevant, but most of the branch is an unrelated MCP dynamic-credential change already open separately, so this is not a safe landing candidate. So I’m closing this PR rather than keeping an unmergeable branch open. A new narrow PR that carries only the useful part is welcome. Review detailsBest possible solution: Keep the MCP dynamic-env work in #94167 and review a narrow outbound-only patch for #94597 with focused coverage and real external-channel proof. Do we have a high-confidence way to reproduce the issue? Yes at source level for the linked outbound bug: current main checks the internal sink before normal plugin routing, and the issue report plus screenshots show the claimed failure path. I did not establish a fresh real Lansenger channel reproduction in this review. Is this the best way to solve the issue? No. The outbound idea may be useful, but this branch is not the best solution because it bundles unrelated MCP credential semantics; the maintainable path is a narrow outbound-only PR plus separate MCP review. Security review: Security review needs attention: The branch introduces security-sensitive MCP credential resolution changes that are unrelated to the outbound routing fix.
AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against dbd5689ea199. |
|
ClawSweeper applied the proposed close for this PR.
|
Summary
What problem does this PR solve?
actions: { handleAction }and do not have an explicitoutboundcapability were incorrectly routed to theinternal-source-replysink when usingmessage(action=send)without atoparameter.Why does this matter now?
What is the intended outcome?
What is intentionally out of scope?
internal-source-reply.ts.What does success look like?
shouldUseInternalSourceReplySinkcorrectly evaluates plugins without anoutboundobject by checkingplugin?.actions?.handleAction, instead of instantly failing.What should reviewers focus on?
src/infra/outbound/internal-source-reply.tsaroundgetLoadedChannelPluginand the capability checks.Linked context
Which issue does this close?
Closes #94597
Which issues, PRs, or discussions are related?
Related #94597
Was this requested by a maintainer or owner?
Yes, it fixes the plugin routing bug as defined in #94597.
Real behavior proof (required for external PRs)
outboundcapability were incorrectly sent to the internal sink.Lansengerchannel plugin.message(action=send)without specifying thetoparameter from within the Lansenger channel context.outboundcapability (they were unaffected).Tests and validation
Which commands did you run?
pnpm test src/infra/outboundpnpm check:test-typesWhat regression coverage was added or updated?
The fix relies on the extensive existing test suite for outbound routing. All existing tests cover the core channel validation behavior successfully.
What failed before this fix, if known?
Plugins lacking
plugin.outboundresulted inresolveOutboundChannelPluginreturningundefined, causing the channel validation to instantly evaluate tofalse.If no test was added, why not?
All 710 tests across the 37 test files in
src/infra/outboundpass perfectly with this change, confirming that there are no regressions to the existing routing and channel resolution logic.Risk checklist
Did user-visible behavior change? (
Yes/No)Yes (fixes broken routing for custom plugins).
Did config, environment, or migration behavior change? (
Yes/No)No.
Did security, auth, secrets, network, or tool execution behavior change? (
Yes/No)No.
What is the highest-risk area?
The channel fallback logic in
internal-source-reply.ts.How is that risk mitigated?
By explicitly ensuring we only return
falseif bothplugin?.actions?.handleActionandplugin?.outboundare falsy, which strictly narrows the fix to the intended plugins.Current review state
What is the next action?
Maintainer review and merge.
What is still waiting on author, maintainer, CI, or external proof?
None, all local tests and type checks have successfully passed.
Which bot or reviewer comments were addressed?
None yet.