fix(gateway): use resolved runtime config for message actions#81477
fix(gateway): use resolved runtime config for message actions#81477KatTate wants to merge 2 commits into
Conversation
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Close: the useful SecretRef-backed message-action fix is superseded by the narrower open replacement at #84535, while this branch still changes broader send/poll paths and lacks real behavior proof. Canonical path: Use #84535 as the canonical message-action SecretRef fix; split any direct-send or auth-marker work only if a separate repro proves it is needed. So I’m closing this here and keeping the remaining discussion on #84535. Review detailsBest possible solution: Use #84535 as the canonical message-action SecretRef fix; split any direct-send or auth-marker work only if a separate repro proves it is needed. Do we have a high-confidence way to reproduce the issue? Yes for the underlying bug: #84530 gives concrete live Discord SecretRef channel-info steps and logs, and the source path shows message.action dispatch uses the selected cfg. I did not run a live repro in this read-only review. Is this the best way to solve the issue? No. This branch is broader than the confirmed failure and skips source matching in the shared gateway resolution path; the narrower replacement PR is the more maintainable solution. Security review: Security review needs attention: The diff changes secrets/runtime config selection and can route message actions or sends through a mismatched active credential snapshot.
What I checked:
Likely related people:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 38e1654e0988. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3b30213361
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const activeSecretsRuntimeConfig = getActiveSecretsRuntimeSnapshot()?.config; | ||
| const cfg = applyPluginAutoEnable({ | ||
| config: params.context.getRuntimeConfig(), | ||
| config: activeSecretsRuntimeConfig ?? params.context.getRuntimeConfig(), |
There was a problem hiding this comment.
Avoid cloning the full secrets snapshot on sends
In the gateway runtime this helper runs for both message.action and send, and an active secrets snapshot is present after startup. getActiveSecretsRuntimeSnapshot() deep-clones sourceConfig, config, every authStore, and webTools before returning, so each outbound message now pays O(config + auth stores) CPU/memory just to read the config (src/secrets/runtime.ts:81 and src/secrets/runtime.ts:476). Use the already pinned runtime config/context or add a config-only accessor so the hot send path does not clone all auth profile stores per request.
Useful? React with 👍 / 👎.
8a45661 to
b409d92
Compare
|
ClawSweeper applied the proposed close for this PR.
|
Summary
message.actionsend resolution instead of the legacy secrets-runtime wrapperValidation
pnpm exec oxfmt --check --threads=1 src/agents/model-auth-markers.ts src/agents/model-auth-markers.test.ts src/gateway/server-methods/send.ts src/gateway/server-methods/send.test.ts src/channels/message/send.ts src/channels/message/send.test.ts src/infra/outbound/message.ts src/infra/outbound/message.test.tsOPENCLAW_VITEST_MAX_WORKERS=1 pnpm test src/agents/model-auth-markers.test.ts src/gateway/server-methods/send.test.ts src/infra/outbound/message.test.ts src/channels/message/send.test.ts -- --runpnpm buildRuntime contract
Source-shaped SecretRef config stays on control-plane paths. Matching source configs upgrade to the resolved runtime snapshot on actual send paths. Explicit per-call configs remain explicit when runtime source snapshot data is unavailable, matching the existing plugin-tool runtime selection contract.